From da54696d83df4d1ffc95ca65a77e941bf8e04d9e Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Wed, 9 Jul 2025 23:56:54 +0800 Subject: [PATCH 01/35] initial net10 update --- Dependencies.targets | 6 +- Directory.Build.props | 6 +- global.json | 4 +- .../Internal/JetStringMethodTranslator.cs | 61 +- .../Internal/JetLiftOrderByPostprocessor.cs | 4 +- .../JetLocateScalarSubqueryVisitor.cs | 5 + .../Internal/JetQueryCompilationContext.cs | 6 +- .../JetQueryCompilationContextFactory.cs | 5 +- .../JetQueryTranslationPostprocessor.cs | 4 +- ...yableMethodTranslatingExpressionVisitor.cs | 18 +- .../JetSqlTranslatingExpressionVisitor.cs | 66 +- ...rchConditionConvertingExpressionVisitor.cs | 5 + .../Storage/Internal/JetGuidTypeMapping.cs | 2 +- .../Storage/Internal/JetTypeMappingSource.cs | 3 +- .../JetSequentialGuidValueGenerator.cs | 2 +- .../BuiltInDataTypesJetTest.cs | 56 +- .../ComplexTypeBulkUpdatesJetTest.cs | 83 +- .../NonSharedModelBulkUpdatesJetTest.cs | 87 +- .../NorthwindBulkUpdatesJetTest.cs | 444 +- ...TPCFiltersInheritanceBulkUpdatesJetTest.cs | 23 +- .../TPCInheritanceBulkUpdatesJetTest.cs | 31 +- .../TPHInheritanceBulkUpdatesJetTest.cs | 43 +- ...TPTFiltersInheritanceBulkUpdatesJetTest.cs | 24 +- .../TPTInheritanceBulkUpdatesJetTest.cs | 32 +- .../ComputedColumnTest.cs | 7 +- .../ConnectionSpecificationTest.cs | 46 +- .../DefaultValuesTest.cs | 7 +- .../EFCore.Jet.FunctionalTests.csproj | 4 + .../EntitySplittingSqlServerTest.cs | 3 +- .../EFCore.Jet.FunctionalTests/FindJetTest.cs | 224 +- .../JetConfigPatternsTest.cs | 34 +- .../JetDatabaseCreatorTest.cs | 32 +- .../JetEndToEndTest.cs | 68 +- .../JetValueGenerationScenariosTestBase.cs | 126 +- .../JsonTypesJetTest.cs | 2 +- .../LazyLoadProxyJetTest.cs | 128 +- .../EFCore.Jet.FunctionalTests/LoadJetTest.cs | 388 +- .../ManyToManyFieldsLoadSqlServerTest.cs | 60 +- .../ManyToManyLoadSqlServerTest.cs | 66 +- .../MaterializationInterceptionJetTest.cs | 3 +- .../Migrations/MigrationsJetTest.cs | 26 +- .../AdHocAdvancedMappingsQueryJetTest.cs | 32 +- .../Query/AdHocComplexTypeQueryJetTest.cs | 13 +- .../Query/AdHocJsonQueryJetTestBase.cs | 31 - .../Query/AdHocManyToManyQueryJetTest.cs | 29 +- .../Query/AdHocMiscellaneousQueryJetTest.cs | 207 +- .../Query/AdHocNavigationsQueryJetTest.cs | 2 +- .../Query/AdHocPrecompiledQueryJetTest.cs | 4 +- .../Query/AdHocQueryFiltersQueryJetTest.cs | 44 +- .../Query/AdHocQuerySplittingQueryJetTest.cs | 12 +- ...mplexNavigationsCollectionsQueryJetTest.cs | 12 +- ...NavigationsCollectionsSplitQueryJetTest.cs | 33 +- .../Query/ComplexNavigationsQueryJetTest.cs | 180 +- .../Query/ComplexTypeQueryJetTest.cs | 78 +- .../Query/DbFunctionsJetTest.cs | 24 - .../Query/Ef6GroupByJetTest.cs | 10 +- .../Query/EntitySplittingQueryJetTest.cs | 9 +- .../Query/FromSqlQueryJetTest.cs | 68 +- .../Query/FromSqlSprocQueryJetTest.cs | 12 +- .../Query/FunkyDataQueryJetTest.cs | 126 +- .../Query/GearsOfWarQueryJetTest.cs | 2280 +-- .../Query/ManyToManyNoTrackingQueryJetTest.cs | 16 +- .../Query/ManyToManyQueryJetTest.cs | 22 +- ...teOperatorsQueryJetTest.ResultOperators.cs | 96 +- .../NorthwindChangeTrackingQueryJetTest.cs | 12 +- .../Query/NorthwindCompiledQueryJetTest.cs | 434 +- .../NorthwindEFPropertyIncludeQueryJetTest.cs | 43 +- ...orthwindFunctionsQueryJetTest.Functions.cs | 2812 +-- .../Query/NorthwindGroupByQueryJetTest.cs | 80 +- .../NorthwindIncludeNoTrackingQueryJetTest.cs | 43 +- .../Query/NorthwindIncludeQueryJetTest.cs | 43 +- .../Query/NorthwindJoinQueryJetTest.cs | 106 +- .../NorthwindKeylessEntitiesQueryJetTest.cs | 8 +- .../NorthwindMiscellaneousQueryJetTest.cs | 867 +- .../Query/NorthwindNavigationsQueryJetTest.cs | 22 +- .../NorthwindQueryFiltersQueryJetTest.cs | 116 +- .../NorthwindQueryTaggingQueryJetTest.cs | 32 + .../Query/NorthwindSelectQueryJetTest.cs | 110 +- .../NorthwindSetOperationsQueryJetTest.cs | 20 +- ...hwindSplitIncludeNoTrackingQueryJetTest.cs | 132 +- .../NorthwindSplitIncludeQueryJetTest.cs | 134 +- .../NorthwindStringIncludeQueryJetTest.cs | 43 +- .../Query/NorthwindWhereQueryJetTest.cs | 1100 +- .../Query/NullSemanticsQueryJetTest.cs | 501 +- .../Query/OperatorsProceduralJetTest.cs | 3 +- .../Query/OperatorsQueryJetTest.cs | 2 +- .../Query/OwnedEntityQueryJetTest.cs | 20 +- .../Query/OwnedQueryJetTest.cs | 12 +- .../Query/PrecompiledQueryJetTest.cs | 268 +- ...PrecompiledSqlPregenerationQueryJetTest.cs | 60 +- .../Query/PrimitiveCollectionsQueryJetTest.cs | 345 +- .../Query/QueryFilterFuncletizationJetTest.cs | 510 +- .../ComplexRelationshipsJetFixture.cs | 17 + .../Include/NavigationIncludeJetTest.cs | 153 + .../NavigationRelationshipsJetFixture.cs | 17 + .../OwnedJsonRelationshipsJetFixture.cs | 17 + .../OwnedJsonTypeRelationshipsJetFixture.cs | 33 + .../OwnedRelationshipsJetFixture.cs | 44 + ...edTableSplittingRelationshipsJetFixture.cs | 17 + .../ComplexNoTrackingProjectionJetTest.cs | 162 + .../Projection/ComplexProjectionJetTest.cs | 162 + .../NavigationNoTrackingProjectionJetTest.cs | 202 + .../Projection/NavigationProjectionJetTest.cs | 202 + ...ionReferenceNoTrackingProjectionJetTest.cs | 231 + .../NavigationReferenceProjectionJetTest.cs | 231 + .../OwnedJsonNoTrackingProjectionJetTest.cs | 189 + .../Projection/OwnedJsonProjectionJetTest.cs | 71 + ...sonReferenceNoTrackingProjectionJetTest.cs | 191 + .../OwnedJsonReferenceProjectionJetTest.cs | 93 + ...wnedJsonTypeNoTrackingProjectionJetTest.cs | 25 + ...ypeReferenceNoTrackingProjectionJetTest.cs | 25 + .../OwnedNoTrackingProjectionJetTest.cs | 229 + .../Projection/OwnedProjectionJetTest.cs | 68 + ...nedReferenceNoTrackingProjectionJetTest.cs | 353 + .../OwnedReferenceProjectionJetTest.cs | 170 + ...bleSplittingNoTrackingProjectionJetTest.cs | 281 + ...ingReferenceProjectionNoTrackingJetTest.cs | 507 + .../Query/SharedTypeQueryJetTest.cs | 5 +- .../Query/SqlQueryJetTest.cs | 76 +- .../TPCFiltersInheritanceQueryJetTest.cs | 6 +- .../Query/TPCGearsOfWarQueryJetTest.cs | 14214 +++++++--------- .../Query/TPCInheritanceQueryJetTestBase.cs | 2 +- .../TPCManyToManyNoTrackingQueryJetTest.cs | 44 +- .../Query/TPCManyToManyQueryJetTest.cs | 44 +- .../Query/TPHInheritanceQueryJetTest.cs | 2 +- .../TPTFiltersInheritanceQueryJetTest.cs | 6 +- .../Query/TPTGearsOfWarQueryJetTest.cs | 2697 +-- .../Query/TPTInheritanceQueryJetTest.cs | 2 +- .../TPTManyToManyNoTrackingQueryJetTest.cs | 44 +- .../Query/TPTManyToManyQueryJetTest.cs | 44 +- .../Query/ToSqlQueryJetTest.cs | 5 +- .../Translations/BasicTypesQueryJetFixture.cs | 148 + .../ByteArrayTranslationsJetTest.cs | 115 + .../Translations/EnumTranslationsJetTest.cs | 317 + .../Translations/GuidTranslationsJetTest.cs | 69 + .../Translations/MathTranslationsJetTest.cs | 748 + .../MiscellaneousTranslationsJetTest.cs | 783 + .../ArithmeticOperatorTranslationsJetTest.cs | 87 + .../BitwiseOperatorTranslationsJetTest.cs | 217 + .../ComparisonOperatorTranslationsJetTest.cs | 99 + .../LogicalOperatorTranslationsJetTest.cs | 99 + ...iscellaneousOperatorTranslationsJetTest.cs | 51 + .../Translations/StringTranslationsJetTest.cs | 1631 ++ .../Temporal/DateOnlyTranslationsJetTest.cs | 232 + .../DateTimeOffsetTranslationsJetTest.cs | 313 + .../Temporal/DateTimeTranslationsJetTest.cs | 256 + .../Temporal/TimeOnlyTranslationsJetTest.cs | 225 + .../Temporal/TimeSpanTranslationsJetTest.cs | 99 + .../SequentialGuidEndToEndTest.cs | 7 +- .../TPTTableSplittingJetTest.cs | 2 +- .../TableSplittingJetTest.cs | 12 +- .../TestUtilities/JetTestStore.cs | 4 +- .../TestRelationalCommandBuilderFactory.cs | 15 +- .../Update/MismatchedKeyTypesJetTest.cs | 8 +- .../Update/NonSharedModelUpdatesJetTest.cs | 2 +- .../Update/StoredProcedureUpdateJetTest.cs | 7 +- .../test.runsettings | 2 +- .../EFCore.Jet.IntegrationTests.csproj | 1 - 158 files changed, 21205 insertions(+), 18687 deletions(-) create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/ComplexRelationshipsJetFixture.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Include/NavigationIncludeJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/NavigationRelationshipsJetFixture.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/OwnedJsonRelationshipsJetFixture.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/OwnedJsonTypeRelationshipsJetFixture.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/OwnedRelationshipsJetFixture.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/OwnedTableSplittingRelationshipsJetFixture.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/ComplexNoTrackingProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/ComplexProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/NavigationNoTrackingProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/NavigationProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/NavigationReferenceNoTrackingProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/NavigationReferenceProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonNoTrackingProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonReferenceNoTrackingProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonReferenceProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonTypeNoTrackingProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonTypeReferenceNoTrackingProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedNoTrackingProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedReferenceNoTrackingProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedReferenceProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedTableSplittingNoTrackingProjectionJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedTableSplittingReferenceProjectionNoTrackingJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/BasicTypesQueryJetFixture.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/ByteArrayTranslationsJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/EnumTranslationsJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/GuidTranslationsJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/MathTranslationsJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/MiscellaneousTranslationsJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/ArithmeticOperatorTranslationsJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/BitwiseOperatorTranslationsJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/ComparisonOperatorTranslationsJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/LogicalOperatorTranslationsJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/MiscellaneousOperatorTranslationsJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/StringTranslationsJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateTimeOffsetTranslationsJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateTimeTranslationsJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/TimeOnlyTranslationsJetTest.cs create mode 100644 test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/TimeSpanTranslationsJetTest.cs diff --git a/Dependencies.targets b/Dependencies.targets index bb7b8e3d..07d2b42f 100644 --- a/Dependencies.targets +++ b/Dependencies.targets @@ -1,8 +1,8 @@ - [9.0.6,9.0.999] - [9.0.6,9.0.999] - [9.0.6,9.0.999] + [10.0.0-preview.5.25277.114,10.0.999] + [10.0.0-preview.5.25277.114,10.0.999] + [10.0.0-preview.5.25277.114,10.0.999] diff --git a/Directory.Build.props b/Directory.Build.props index a0ee38dc..0ff6b5a6 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -8,7 +8,7 @@ CirrusRed Copyright © 2017-$([System.DateTime]::Now.Year) CirrusRed True - 13.0 + preview enable portable False @@ -24,10 +24,10 @@ - net8.0 + net10.0 $(EfCoreTargetFramework) $(EfCoreTargetFramework) - net9.0 + net10.0 $(JetTestTargetFramework)-windows7.0 diff --git a/global.json b/global.json index db8627a2..04cf10f6 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "9.0.100", - "allowPrerelease": false, + "version": "10.0.100-preview.5.25277.114", + "allowPrerelease": true, "rollForward": "latestFeature" } } diff --git a/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetStringMethodTranslator.cs b/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetStringMethodTranslator.cs index 2731d1b1..0b48ed5e 100644 --- a/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetStringMethodTranslator.cs +++ b/src/EFCore.Jet/Query/ExpressionTranslators/Internal/JetStringMethodTranslator.cs @@ -14,15 +14,24 @@ public class JetStringMethodTranslator(ISqlExpressionFactory sqlExpressionFactor { private readonly JetSqlExpressionFactory _sqlExpressionFactory = (JetSqlExpressionFactory)sqlExpressionFactory; - private static readonly MethodInfo IndexOfMethodInfo + private static readonly MethodInfo IndexOfMethodInfoString = typeof(string).GetRuntimeMethod(nameof(string.IndexOf), [typeof(string)])!; - private static readonly MethodInfo IndexOfMethodInfoWithStartingPosition + private static readonly MethodInfo IndexOfMethodInfoChar + = typeof(string).GetRuntimeMethod(nameof(string.IndexOf), [typeof(char)])!; + + private static readonly MethodInfo IndexOfMethodInfoWithStartingPositionString = typeof(string).GetRuntimeMethod(nameof(string.IndexOf), [typeof(string), typeof(int)])!; - private static readonly MethodInfo _replaceMethodInfo + private static readonly MethodInfo IndexOfMethodInfoWithStartingPositionChar + = typeof(string).GetRuntimeMethod(nameof(string.IndexOf), [typeof(char), typeof(int)])!; + + private static readonly MethodInfo ReplaceMethodInfoString = typeof(string).GetRuntimeMethod(nameof(string.Replace), [typeof(string), typeof(string)])!; + private static readonly MethodInfo ReplaceMethodInfoChar + = typeof(string).GetRuntimeMethod(nameof(string.Replace), [typeof(char), typeof(char)])!; + private static readonly MethodInfo _toLowerMethodInfo = typeof(string).GetRuntimeMethod(nameof(string.ToLower), Type.EmptyTypes)!; @@ -76,16 +85,36 @@ private static readonly MethodInfo _lastOrDefaultMethodInfoWithoutArgs { if (instance != null) { - if (IndexOfMethodInfo.Equals(method)) + if (IndexOfMethodInfoString.Equals(method) || IndexOfMethodInfoChar.Equals(method)) { return TranslateIndexOf(instance, method, arguments[0], null); } - if (IndexOfMethodInfoWithStartingPosition.Equals(method)) + if (IndexOfMethodInfoWithStartingPositionString.Equals(method) || IndexOfMethodInfoWithStartingPositionChar.Equals(method)) { return TranslateIndexOf(instance, method, arguments[0], arguments[1]); } + if (ReplaceMethodInfoString.Equals(method) || ReplaceMethodInfoChar.Equals(method)) + { + var firstArgument = arguments[0]; + var secondArgument = arguments[1]; + var stringTypeMapping = + ExpressionExtensions.InferTypeMapping(instance, firstArgument, secondArgument); + + instance = _sqlExpressionFactory.ApplyTypeMapping(instance, stringTypeMapping); + firstArgument = _sqlExpressionFactory.ApplyTypeMapping(firstArgument, firstArgument.Type == typeof(char) ? CharTypeMapping.Default : stringTypeMapping); + secondArgument = _sqlExpressionFactory.ApplyTypeMapping(secondArgument, secondArgument.Type == typeof(char) ? CharTypeMapping.Default : stringTypeMapping); + + return _sqlExpressionFactory.Function( + "REPLACE", + [instance, firstArgument, secondArgument], + nullable: true, + argumentsPropagateNullability: [true, true, true], + method.ReturnType, + stringTypeMapping); + } + // Jet TRIM does not take arguments. // _trimWithNoParam is only available since .NET Core 2.0 (or .NET Standard 2.1). if (Equals(method, _trimMethodInfoWithoutArgs) || @@ -169,26 +198,6 @@ private static readonly MethodInfo _lastOrDefaultMethodInfoWithoutArgs method.ReturnType, instance.TypeMapping); } - - if (_replaceMethodInfo.Equals(method)) - { - var firstArgument = arguments[0]; - var secondArgument = arguments[1]; - var stringTypeMapping = - ExpressionExtensions.InferTypeMapping(instance, firstArgument, secondArgument); - - instance = _sqlExpressionFactory.ApplyTypeMapping(instance, stringTypeMapping); - firstArgument = _sqlExpressionFactory.ApplyTypeMapping(firstArgument, stringTypeMapping); - secondArgument = _sqlExpressionFactory.ApplyTypeMapping(secondArgument, stringTypeMapping); - - return _sqlExpressionFactory.Function( - "REPLACE", - [instance, firstArgument, secondArgument], - nullable: true, - argumentsPropagateNullability: [true, true, true], - method.ReturnType, - stringTypeMapping); - } } if (_isNullOrEmptyMethodInfo.Equals(method)) @@ -267,7 +276,7 @@ private SqlExpression TranslateIndexOf( SqlExpression? startIndex) { var stringTypeMapping = ExpressionExtensions.InferTypeMapping(instance, searchExpression)!; - searchExpression = _sqlExpressionFactory.ApplyTypeMapping(searchExpression, stringTypeMapping); + searchExpression = _sqlExpressionFactory.ApplyTypeMapping(searchExpression, searchExpression.Type == typeof(char) ? CharTypeMapping.Default : stringTypeMapping); instance = _sqlExpressionFactory.ApplyTypeMapping(instance, stringTypeMapping); var charIndexArguments = new List { instance, searchExpression }; diff --git a/src/EFCore.Jet/Query/Internal/JetLiftOrderByPostprocessor.cs b/src/EFCore.Jet/Query/Internal/JetLiftOrderByPostprocessor.cs index 7a5e48d3..233d576a 100644 --- a/src/EFCore.Jet/Query/Internal/JetLiftOrderByPostprocessor.cs +++ b/src/EFCore.Jet/Query/Internal/JetLiftOrderByPostprocessor.cs @@ -50,8 +50,8 @@ public virtual Expression Process(Expression expression) relationalSplitCollectionShaperExpression.ParentIdentifier, relationalSplitCollectionShaperExpression.ChildIdentifier, (SelectExpression)newSelect, newInner); return relationalSplitCollectionShaperExpression; - case NonQueryExpression nonQueryExpression: - return nonQueryExpression; + case UpdateExpression or DeleteExpression: + return expression; case SelectExpression selectExpression: { Dictionary columnsToRewrite = []; diff --git a/src/EFCore.Jet/Query/Internal/JetLocateScalarSubqueryVisitor.cs b/src/EFCore.Jet/Query/Internal/JetLocateScalarSubqueryVisitor.cs index e89e3a8a..e1c43580 100644 --- a/src/EFCore.Jet/Query/Internal/JetLocateScalarSubqueryVisitor.cs +++ b/src/EFCore.Jet/Query/Internal/JetLocateScalarSubqueryVisitor.cs @@ -185,6 +185,11 @@ protected override Expression VisitProjection(ProjectionExpression projectionExp return projectionExpression.Update(expression); } + protected override Expression VisitRightJoin(RightJoinExpression rightJoinExpression) + { + throw new NotImplementedException(); + } + protected override Expression VisitTableValuedFunction(TableValuedFunctionExpression tableValuedFunctionExpression) { var arguments = new SqlExpression[tableValuedFunctionExpression.Arguments.Count]; diff --git a/src/EFCore.Jet/Query/Internal/JetQueryCompilationContext.cs b/src/EFCore.Jet/Query/Internal/JetQueryCompilationContext.cs index a895354f..82e4ad31 100644 --- a/src/EFCore.Jet/Query/Internal/JetQueryCompilationContext.cs +++ b/src/EFCore.Jet/Query/Internal/JetQueryCompilationContext.cs @@ -16,8 +16,7 @@ public class JetQueryCompilationContext( QueryCompilationContextDependencies dependencies, RelationalQueryCompilationContextDependencies relationalDependencies, bool async, - bool precompiling, - IReadOnlySet? nonNullableReferenceTypeParameters) : RelationalQueryCompilationContext(dependencies, relationalDependencies, async, precompiling, nonNullableReferenceTypeParameters) + bool precompiling) : RelationalQueryCompilationContext(dependencies, relationalDependencies, async, precompiling) { /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -30,8 +29,7 @@ public JetQueryCompilationContext( RelationalQueryCompilationContextDependencies relationalDependencies, bool async) : this( - dependencies, relationalDependencies, async, precompiling: false, - nonNullableReferenceTypeParameters: null) + dependencies, relationalDependencies, async, precompiling: false) { } diff --git a/src/EFCore.Jet/Query/Internal/JetQueryCompilationContextFactory.cs b/src/EFCore.Jet/Query/Internal/JetQueryCompilationContextFactory.cs index 5fa3a368..d13bbf13 100644 --- a/src/EFCore.Jet/Query/Internal/JetQueryCompilationContextFactory.cs +++ b/src/EFCore.Jet/Query/Internal/JetQueryCompilationContextFactory.cs @@ -47,8 +47,7 @@ public virtual QueryCompilationContext Create(bool async) /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - public virtual QueryCompilationContext CreatePrecompiled(bool async, IReadOnlySet nonNullableReferenceTypeParameters) + public virtual QueryCompilationContext CreatePrecompiled(bool async) => new JetQueryCompilationContext( - Dependencies, RelationalDependencies, async, precompiling: true, - nonNullableReferenceTypeParameters); + Dependencies, RelationalDependencies, async, precompiling: true); } diff --git a/src/EFCore.Jet/Query/Internal/JetQueryTranslationPostprocessor.cs b/src/EFCore.Jet/Query/Internal/JetQueryTranslationPostprocessor.cs index 85074cc1..285cb95d 100644 --- a/src/EFCore.Jet/Query/Internal/JetQueryTranslationPostprocessor.cs +++ b/src/EFCore.Jet/Query/Internal/JetQueryTranslationPostprocessor.cs @@ -72,8 +72,8 @@ private sealed class SkipWithoutOrderByInSplitQueryVerifier : ExpressionVisitor case SelectExpression { Offset: not null, Orderings.Count: 0 }: throw new InvalidOperationException(JetStrings.SplitQueryOffsetWithoutOrderBy); - case NonQueryExpression nonQueryExpression: - return nonQueryExpression; + case UpdateExpression or DeleteExpression: + return expression; default: return base.Visit(expression); diff --git a/src/EFCore.Jet/Query/Internal/JetQueryableMethodTranslatingExpressionVisitor.cs b/src/EFCore.Jet/Query/Internal/JetQueryableMethodTranslatingExpressionVisitor.cs index 4177eaf8..32455963 100644 --- a/src/EFCore.Jet/Query/Internal/JetQueryableMethodTranslatingExpressionVisitor.cs +++ b/src/EFCore.Jet/Query/Internal/JetQueryableMethodTranslatingExpressionVisitor.cs @@ -76,9 +76,7 @@ protected override ShapedQueryExpression? /// doing so can result in application failures when updating to a new Entity Framework Core release. /// protected override bool IsValidSelectExpressionForExecuteDelete( - SelectExpression selectExpression, - StructuralTypeShaperExpression shaper, - [NotNullWhen(true)] out TableExpression? tableExpression) + SelectExpression selectExpression) { if (selectExpression.Offset == null && selectExpression.GroupBy.Count == 0 @@ -86,32 +84,22 @@ protected override bool IsValidSelectExpressionForExecuteDelete( && selectExpression.Orderings.Count == 0 && selectExpression.Limit == null) { - TableExpressionBase table; + TableExpressionBase? table; if (selectExpression.Tables.Count == 1) { table = selectExpression.Tables[0]; } else { - var projectionBindingExpression = (ProjectionBindingExpression)shaper.ValueBufferExpression; - var projection = (StructuralTypeProjectionExpression)selectExpression.GetProjection(projectionBindingExpression); - var column = projection.BindProperty(shaper.StructuralType.GetProperties().First()); - table = selectExpression.GetTable(column).UnwrapJoin(); - //TODO: do I need the following given we now have an unwrapjoin in the above line? - if (table is JoinExpressionBase joinExpressionBase) - { - table = joinExpressionBase.Table; - } + table = null; } if (table is TableExpression te) { - tableExpression = te; return true; } } - tableExpression = null; return false; } diff --git a/src/EFCore.Jet/Query/Internal/JetSqlTranslatingExpressionVisitor.cs b/src/EFCore.Jet/Query/Internal/JetSqlTranslatingExpressionVisitor.cs index 5cb2053b..ed1aa0ab 100644 --- a/src/EFCore.Jet/Query/Internal/JetSqlTranslatingExpressionVisitor.cs +++ b/src/EFCore.Jet/Query/Internal/JetSqlTranslatingExpressionVisitor.cs @@ -60,15 +60,24 @@ private static readonly HashSet ArithmeticOperatorTypes ExpressionType.Modulo ]; - private static readonly MethodInfo StringStartsWithMethodInfo + private static readonly MethodInfo StringStartsWithMethodInfoString = typeof(string).GetRuntimeMethod(nameof(string.StartsWith), [typeof(string)])!; - private static readonly MethodInfo StringEndsWithMethodInfo + private static readonly MethodInfo StringStartsWithMethodInfoChar + = typeof(string).GetRuntimeMethod(nameof(string.StartsWith), [typeof(char)])!; + + private static readonly MethodInfo StringEndsWithMethodInfoString = typeof(string).GetRuntimeMethod(nameof(string.EndsWith), [typeof(string)])!; - private static readonly MethodInfo StringContainsMethodInfo + private static readonly MethodInfo StringEndsWithMethodInfoChar + = typeof(string).GetRuntimeMethod(nameof(string.EndsWith), [typeof(char)])!; + + private static readonly MethodInfo StringContainsMethodInfoString = typeof(string).GetRuntimeMethod(nameof(string.Contains), [typeof(string)])!; + private static readonly MethodInfo StringContainsMethodInfoChar + = typeof(string).GetRuntimeMethod(nameof(string.Contains), [typeof(char)])!; + private static readonly MethodInfo EscapeLikePatternParameterMethod = typeof(JetSqlTranslatingExpressionVisitor).GetTypeInfo().GetDeclaredMethod(nameof(ConstructLikePatternParameter))!; @@ -175,21 +184,21 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp methodCallExpression.Type); } - if (method == StringStartsWithMethodInfo + if ((method == StringStartsWithMethodInfoString || method == StringStartsWithMethodInfoChar) && TryTranslateStartsEndsWithContains( methodCallExpression.Object!, methodCallExpression.Arguments[0], StartsEndsWithContains.StartsWith, out var translation1)) { return translation1; } - if (method == StringEndsWithMethodInfo + if ((method == StringEndsWithMethodInfoString || method == StringEndsWithMethodInfoChar) && TryTranslateStartsEndsWithContains( methodCallExpression.Object!, methodCallExpression.Arguments[0], StartsEndsWithContains.EndsWith, out var translation2)) { return translation2; } - if (method == StringContainsMethodInfo + if ((method == StringContainsMethodInfoString || method == StringContainsMethodInfoChar) && TryTranslateStartsEndsWithContains( methodCallExpression.Object!, methodCallExpression.Arguments[0], StartsEndsWithContains.Contains, out var translation3)) { @@ -256,14 +265,39 @@ bool TryTranslateStartsEndsWithContains( _ => throw new ArgumentOutOfRangeException(nameof(methodType), methodType, null) })), + char s when !IsLikeWildChar(s) + => _sqlExpressionFactory.Like( + translatedInstance, + _sqlExpressionFactory.Constant( + methodType switch + { + StartsEndsWithContains.StartsWith => s + "%", + StartsEndsWithContains.EndsWith => "%" + s, + StartsEndsWithContains.Contains => $"%{s}%", + + _ => throw new ArgumentOutOfRangeException(nameof(methodType), methodType, null) + })), + + char s => _sqlExpressionFactory.Like( + translatedInstance, + _sqlExpressionFactory.Constant( + methodType switch + { + StartsEndsWithContains.StartsWith => LikeEscapeChar + s + "%", + StartsEndsWithContains.EndsWith => "%" + LikeEscapeChar + s, + StartsEndsWithContains.Contains => $"%{LikeEscapeChar}{s}%", + + _ => throw new ArgumentOutOfRangeException(nameof(methodType), methodType, null) + }), + _sqlExpressionFactory.Constant(LikeEscapeString)), + _ => throw new UnreachableException() }; return true; } - case SqlParameterExpression patternParameter - when patternParameter.Name.StartsWith(QueryCompilationContext.QueryParameterPrefix, StringComparison.Ordinal): + case SqlParameterExpression patternParameter: { // The pattern is a parameter, register a runtime parameter that will contain the rewritten LIKE pattern, where // all special characters have been escaped. @@ -370,6 +404,22 @@ StartsEndsWithContains.StartsWith or StartsEndsWithContains.EndsWith _ => throw new ArgumentOutOfRangeException(nameof(methodType), methodType, null) }, + char s when !IsLikeWildChar(s) => methodType switch + { + StartsEndsWithContains.StartsWith => s + "%", + StartsEndsWithContains.EndsWith => "%" + s, + StartsEndsWithContains.Contains => $"%{s}%", + _ => throw new ArgumentOutOfRangeException(nameof(methodType), methodType, null) + }, + + char s => methodType switch + { + StartsEndsWithContains.StartsWith => LikeEscapeChar + s + "%", + StartsEndsWithContains.EndsWith => "%" + LikeEscapeChar + s, + StartsEndsWithContains.Contains => $"%{LikeEscapeChar}{s}%", + _ => throw new ArgumentOutOfRangeException(nameof(methodType), methodType, null) + }, + _ => throw new UnreachableException() }; diff --git a/src/EFCore.Jet/Query/Internal/SearchConditionConvertingExpressionVisitor.cs b/src/EFCore.Jet/Query/Internal/SearchConditionConvertingExpressionVisitor.cs index f1fb389b..be2a3cdc 100644 --- a/src/EFCore.Jet/Query/Internal/SearchConditionConvertingExpressionVisitor.cs +++ b/src/EFCore.Jet/Query/Internal/SearchConditionConvertingExpressionVisitor.cs @@ -403,6 +403,11 @@ protected override Expression VisitSqlFunction(SqlFunctionExpression sqlFunction return ApplyConversion(newFunction, /* condition */ false); } + protected override Expression VisitRightJoin(RightJoinExpression rightJoinExpression) + { + throw new NotImplementedException(); + } + /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in diff --git a/src/EFCore.Jet/Storage/Internal/JetGuidTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetGuidTypeMapping.cs index 53f0bc7b..3aa86914 100644 --- a/src/EFCore.Jet/Storage/Internal/JetGuidTypeMapping.cs +++ b/src/EFCore.Jet/Storage/Internal/JetGuidTypeMapping.cs @@ -24,6 +24,6 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p /// Gets the string format to be used to generate SQL literals of this type. /// protected override string SqlLiteralFormatString - => "'{{{0}}}'"; + => "{{{0}}}"; } } \ No newline at end of file diff --git a/src/EFCore.Jet/Storage/Internal/JetTypeMappingSource.cs b/src/EFCore.Jet/Storage/Internal/JetTypeMappingSource.cs index 11a48388..461953c4 100644 --- a/src/EFCore.Jet/Storage/Internal/JetTypeMappingSource.cs +++ b/src/EFCore.Jet/Storage/Internal/JetTypeMappingSource.cs @@ -49,7 +49,6 @@ public class JetTypeMappingSource : RelationalTypeMappingSource private readonly JetStringTypeMapping _variableLengthUnicodeString = new("varchar", unicode: true); private readonly JetStringTypeMapping _variableLengthMaxUnicodeString = new("varchar", unicode: true, size: 255, storeTypePostfix: StoreTypePostfix.Size); private readonly JetStringTypeMapping _unboundedUnicodeString = new("longchar", unicode: true, storeTypePostfix: StoreTypePostfix.None); - private readonly JetJsonTypeMapping _jsonTypeMapping = new("longchar"); private readonly JetGuidTypeMapping _guid = new("uniqueidentifier", DbType.Guid); private readonly JetByteArrayTypeMapping _rowversion = new("varbinary", size: 8, comparer: new ValueComparer( @@ -191,7 +190,7 @@ public JetTypeMappingSource( {typeof(TimeSpan), _timespan}, {typeof(TimeOnly), _timeonly}, {typeof(Guid), _guid}, - { typeof(JsonElement), _jsonTypeMapping } + { typeof(JsonTypePlaceholder), JetJsonTypeMapping.Default } }; // These are disallowed only if specified without any kind of length specified in parenthesis. diff --git a/src/EFCore.Jet/ValueGeneration/JetSequentialGuidValueGenerator.cs b/src/EFCore.Jet/ValueGeneration/JetSequentialGuidValueGenerator.cs index b91fe02c..2cff99ce 100644 --- a/src/EFCore.Jet/ValueGeneration/JetSequentialGuidValueGenerator.cs +++ b/src/EFCore.Jet/ValueGeneration/JetSequentialGuidValueGenerator.cs @@ -4,7 +4,7 @@ namespace EntityFrameworkCore.Jet.ValueGeneration; /// /// Generates sequential values according to the UUID version 7 specification. -/// Will be updated to use when available. +/// Will be updated to use when available. /// public class JetSequentialGuidValueGenerator : ValueGenerator { diff --git a/test/EFCore.Jet.FunctionalTests/BuiltInDataTypesJetTest.cs b/test/EFCore.Jet.FunctionalTests/BuiltInDataTypesJetTest.cs index a636515c..86e639f4 100644 --- a/test/EFCore.Jet.FunctionalTests/BuiltInDataTypesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/BuiltInDataTypesJetTest.cs @@ -78,13 +78,13 @@ var results Assert.Empty(results); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__timeSpan_0='02:01:00' (Nullable = true)")} - - SELECT `m`.`Int` - FROM `MappedNullableDataTypes` AS `m` - WHERE `m`.`TimeSpanAsTime` = {AssertSqlHelper.Parameter("@__timeSpan_0")} - """); + """ +@timeSpan='02:01:00' (Nullable = true) + +SELECT `m`.`Int` +FROM `MappedNullableDataTypes` AS `m` +WHERE `m`.`TimeSpanAsTime` = @timeSpan +"""); } [ConditionalFact] @@ -101,13 +101,13 @@ var results Assert.Empty(results); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__timeSpan_1='02:01:00' (Nullable = true)")} - - SELECT `m`.`Int` - FROM `MappedNullableDataTypes` AS `m` - WHERE DATEDIFF('h', `m`.`TimeSpanAsTime`, {AssertSqlHelper.Parameter("@__timeSpan_1")}) = 0 - """); + """ +@timeSpan='02:01:00' (Nullable = true) + +SELECT `m`.`Int` +FROM `MappedNullableDataTypes` AS `m` +WHERE DATEDIFF('h', `m`.`TimeSpanAsTime`, @timeSpan) = 0 +"""); } [ConditionalFact] @@ -124,13 +124,13 @@ var results Assert.Empty(results); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__timeSpan_1='02:01:00' (Nullable = true)")} - - SELECT `m`.`Int` - FROM `MappedNullableDataTypes` AS `m` - WHERE DATEDIFF('n', `m`.`TimeSpanAsTime`, {AssertSqlHelper.Parameter("@__timeSpan_1")}) = 0 - """); + """ +@timeSpan='02:01:00' (Nullable = true) + +SELECT `m`.`Int` +FROM `MappedNullableDataTypes` AS `m` +WHERE DATEDIFF('n', `m`.`TimeSpanAsTime`, @timeSpan) = 0 +"""); } [ConditionalFact] @@ -147,13 +147,13 @@ var results Assert.Empty(results); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__timeSpan_1='02:01:00' (Nullable = true)")} - - SELECT `m`.`Int` - FROM `MappedNullableDataTypes` AS `m` - WHERE DATEDIFF('s', `m`.`TimeSpanAsTime`, {AssertSqlHelper.Parameter("@__timeSpan_1")}) = 0 - """); + """ +@timeSpan='02:01:00' (Nullable = true) + +SELECT `m`.`Int` +FROM `MappedNullableDataTypes` AS `m` +WHERE DATEDIFF('s', `m`.`TimeSpanAsTime`, @timeSpan) = 0 +"""); } [ConditionalFact] diff --git a/test/EFCore.Jet.FunctionalTests/BulkUpdates/ComplexTypeBulkUpdatesJetTest.cs b/test/EFCore.Jet.FunctionalTests/BulkUpdates/ComplexTypeBulkUpdatesJetTest.cs index 025e3d10..e093ef9c 100644 --- a/test/EFCore.Jet.FunctionalTests/BulkUpdates/ComplexTypeBulkUpdatesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/BulkUpdates/ComplexTypeBulkUpdatesJetTest.cs @@ -42,8 +42,10 @@ public override async Task Update_property_inside_complex_type(bool async) AssertExecuteUpdateSql( """ +@p='12345' + UPDATE `Customer` AS `c` -SET `c`.`ShippingAddress_ZipCode` = 12345 +SET `c`.`ShippingAddress_ZipCode` = @p WHERE `c`.`ShippingAddress_ZipCode` = 7728 """); } @@ -54,8 +56,10 @@ public override async Task Update_property_inside_nested_complex_type(bool async AssertExecuteUpdateSql( """ +@p='United States Modified' (Size = 255) + UPDATE `Customer` AS `c` -SET `c`.`ShippingAddress_Country_FullName` = 'United States Modified' +SET `c`.`ShippingAddress_Country_FullName` = @p WHERE `c`.`ShippingAddress_Country_Code` = 'US' """); } @@ -66,10 +70,12 @@ public override async Task Update_multiple_properties_inside_multiple_complex_ty AssertExecuteUpdateSql( """ +@p='54321' + UPDATE `Customer` AS `c` -SET `c`.`BillingAddress_ZipCode` = 54321, +SET `c`.`Name` = `c`.`Name` & 'Modified', `c`.`ShippingAddress_ZipCode` = `c`.`BillingAddress_ZipCode`, - `c`.`Name` = `c`.`Name` & 'Modified' + `c`.`BillingAddress_ZipCode` = @p WHERE `c`.`ShippingAddress_ZipCode` = 7728 """); } @@ -80,8 +86,10 @@ public override async Task Update_projected_complex_type(bool async) AssertExecuteUpdateSql( """ +@p='12345' + UPDATE `Customer` AS `c` -SET `c`.`ShippingAddress_ZipCode` = 12345 +SET `c`.`ShippingAddress_ZipCode` = @p """); } @@ -91,9 +99,11 @@ public override async Task Update_multiple_projected_complex_types_via_anonymous AssertExecuteUpdateSql( """ +@p='54321' + UPDATE `Customer` AS `c` -SET `c`.`BillingAddress_ZipCode` = 54321, - `c`.`ShippingAddress_ZipCode` = `c`.`BillingAddress_ZipCode` +SET `c`.`ShippingAddress_ZipCode` = `c`.`BillingAddress_ZipCode`, + `c`.`BillingAddress_ZipCode` = @p """); } @@ -110,20 +120,20 @@ public override async Task Update_complex_type_to_parameter(bool async) AssertExecuteUpdateSql( """ -@__complex_type_newAddress_0_AddressLine1='New AddressLine1' (Size = 255) -@__complex_type_newAddress_0_AddressLine2='New AddressLine2' (Size = 255) -@__complex_type_newAddress_0_Tags='["new_tag1","new_tag2"]' (Size = 255) -@__complex_type_newAddress_0_ZipCode='99999' (Nullable = true) -@__complex_type_newAddress_0_Code='FR' (Size = 255) -@__complex_type_newAddress_0_FullName='France' (Size = 255) +@complex_type_p_AddressLine1='New AddressLine1' (Size = 255) +@complex_type_p_AddressLine2='New AddressLine2' (Size = 255) +@complex_type_p_Tags='["new_tag1","new_tag2"]' (Size = 255) +@complex_type_p_ZipCode='99999' (Nullable = true) +@complex_type_p_Code='FR' (Size = 255) +@complex_type_p_FullName='France' (Size = 255) UPDATE `Customer` AS `c` -SET `c`.`ShippingAddress_AddressLine1` = @__complex_type_newAddress_0_AddressLine1, - `c`.`ShippingAddress_AddressLine2` = @__complex_type_newAddress_0_AddressLine2, - `c`.`ShippingAddress_Tags` = @__complex_type_newAddress_0_Tags, - `c`.`ShippingAddress_ZipCode` = @__complex_type_newAddress_0_ZipCode, - `c`.`ShippingAddress_Country_Code` = @__complex_type_newAddress_0_Code, - `c`.`ShippingAddress_Country_FullName` = @__complex_type_newAddress_0_FullName +SET `c`.`ShippingAddress_AddressLine1` = @complex_type_p_AddressLine1, + `c`.`ShippingAddress_AddressLine2` = @complex_type_p_AddressLine2, + `c`.`ShippingAddress_Tags` = @complex_type_p_Tags, + `c`.`ShippingAddress_ZipCode` = @complex_type_p_ZipCode, + `c`.`ShippingAddress_Country_Code` = @complex_type_p_Code, + `c`.`ShippingAddress_Country_FullName` = @complex_type_p_FullName """); } @@ -132,13 +142,13 @@ public override async Task Update_nested_complex_type_to_parameter(bool async) await base.Update_nested_complex_type_to_parameter(async); AssertExecuteUpdateSql( - """ -@__complex_type_newCountry_0_Code='FR' (Size = 255) -@__complex_type_newCountry_0_FullName='France' (Size = 255) + """ +@complex_type_p_Code='FR' (Size = 255) +@complex_type_p_FullName='France' (Size = 255) UPDATE `Customer` AS `c` -SET `c`.`ShippingAddress_Country_Code` = @__complex_type_newCountry_0_Code, - `c`.`ShippingAddress_Country_FullName` = @__complex_type_newCountry_0_FullName +SET `c`.`ShippingAddress_Country_Code` = @complex_type_p_Code, + `c`.`ShippingAddress_Country_FullName` = @complex_type_p_FullName """); } @@ -163,14 +173,21 @@ public override async Task Update_complex_type_to_inline_without_lambda(bool asy await base.Update_complex_type_to_inline_without_lambda(async); AssertExecuteUpdateSql( - """ + """ +@complex_type_p_AddressLine1='New AddressLine1' (Size = 255) +@complex_type_p_AddressLine2='New AddressLine2' (Size = 255) +@complex_type_p_Tags='["new_tag1","new_tag2"]' (Size = 255) +@complex_type_p_ZipCode='99999' (Nullable = true) +@complex_type_p_Code='FR' (Size = 255) +@complex_type_p_FullName='France' (Size = 255) + UPDATE `Customer` AS `c` -SET `c`.`ShippingAddress_AddressLine1` = 'New AddressLine1', - `c`.`ShippingAddress_AddressLine2` = 'New AddressLine2', - `c`.`ShippingAddress_Tags` = '["new_tag1","new_tag2"]', - `c`.`ShippingAddress_ZipCode` = 99999, - `c`.`ShippingAddress_Country_Code` = 'FR', - `c`.`ShippingAddress_Country_FullName` = 'France' +SET `c`.`ShippingAddress_AddressLine1` = @complex_type_p_AddressLine1, + `c`.`ShippingAddress_AddressLine2` = @complex_type_p_AddressLine2, + `c`.`ShippingAddress_Tags` = @complex_type_p_Tags, + `c`.`ShippingAddress_ZipCode` = @complex_type_p_ZipCode, + `c`.`ShippingAddress_Country_Code` = @complex_type_p_Code, + `c`.`ShippingAddress_Country_FullName` = @complex_type_p_FullName """); } @@ -221,8 +238,10 @@ public override async Task Update_collection_inside_complex_type(bool async) AssertExecuteUpdateSql( """ +@p='["new_tag1","new_tag2"]' (Size = 255) + UPDATE `Customer` AS `c` -SET `c`.`ShippingAddress_Tags` = '["new_tag1","new_tag2"]' +SET `c`.`ShippingAddress_Tags` = @p """); } diff --git a/test/EFCore.Jet.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesJetTest.cs b/test/EFCore.Jet.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesJetTest.cs index 1adcd955..f941a745 100644 --- a/test/EFCore.Jet.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesJetTest.cs @@ -1,17 +1,18 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.BulkUpdates; using Microsoft.EntityFrameworkCore.TestUtilities; +using System; +using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; namespace EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates; -public class NonSharedModelBulkUpdatesJetTest : NonSharedModelBulkUpdatesRelationalTestBase +public class NonSharedModelBulkUpdatesJetTest(NonSharedFixture fixture) : NonSharedModelBulkUpdatesRelationalTestBase(fixture) { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; @@ -72,9 +73,11 @@ public override async Task Replace_ColumnExpression_in_column_setter(bool async) AssertSql( """ +@p='SomeValue' (Size = 255) + UPDATE `Owner` AS `o` INNER JOIN `OwnedCollection` AS `o0` ON `o`.`Id` = `o0`.`OwnerId` -SET `o0`.`Value` = 'SomeValue' +SET `o0`.`Value` = @p """); } @@ -83,9 +86,11 @@ public override async Task Update_non_owned_property_on_entity_with_owned(bool a await base.Update_non_owned_property_on_entity_with_owned(async); AssertSql( -""" + """ +@p='SomeValue' (Size = 255) + UPDATE `Owner` AS `o` -SET `o`.`Title` = 'SomeValue' +SET `o`.`Title` = @p """); } @@ -105,10 +110,12 @@ public override async Task Update_non_owned_property_on_entity_with_owned_in_joi await base.Update_non_owned_property_on_entity_with_owned_in_join(async); AssertSql( - """ + """ +@p='NewValue' (Size = 255) + UPDATE `Owner` AS `o` INNER JOIN `Owner` AS `o0` ON `o`.`Id` = `o0`.`Id` -SET `o`.`Title` = 'NewValue' +SET `o`.`Title` = @p """); } @@ -119,8 +126,8 @@ public override async Task Update_owned_and_non_owned_properties_with_table_shar AssertSql( """ UPDATE `Owner` AS `o` -SET `o`.`OwnedReference_Number` = IIF(LEN(`o`.`Title`) IS NULL, NULL, CLNG(LEN(`o`.`Title`))), - `o`.`Title` = IIF((`o`.`OwnedReference_Number` & '') IS NULL, '', (`o`.`OwnedReference_Number` & '')) +SET `o`.`Title` = IIF((`o`.`OwnedReference_Number` & '') IS NULL, '', (`o`.`OwnedReference_Number` & '')), + `o`.`OwnedReference_Number` = IIF(LEN(`o`.`Title`) IS NULL, NULL, CLNG(LEN(`o`.`Title`))) """); } @@ -140,11 +147,11 @@ public override async Task Update_non_main_table_in_entity_with_entity_splitting await base.Update_non_main_table_in_entity_with_entity_splitting(async); AssertSql( - """ + """ UPDATE `Blogs` AS `b` INNER JOIN `BlogsPart1` AS `b0` ON `b`.`Id` = `b0`.`Id` -SET `b0`.`Rating` = IIF(LEN(`b0`.`Title`) IS NULL, NULL, CLNG(LEN(`b0`.`Title`))), - `b0`.`Title` = (`b0`.`Rating` & '') +SET `b0`.`Title` = (`b0`.`Rating` & ''), + `b0`.`Rating` = IIF(LEN(`b0`.`Title`) IS NULL, NULL, CLNG(LEN(`b0`.`Title`))) """); } @@ -153,10 +160,13 @@ public override async Task Delete_entity_with_auto_include(bool async) await base.Delete_entity_with_auto_include(async); AssertSql( -""" -DELETE `c`.* -FROM `Context30572_Principal` AS `c` -LEFT JOIN `Context30572_Dependent` AS `c0` ON `c`.`DependentId` = `c0`.`Id` + """ +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` +) """); } @@ -165,11 +175,14 @@ public override async Task Delete_predicate_based_on_optional_navigation(bool as await base.Delete_predicate_based_on_optional_navigation(async); AssertSql( -""" -DELETE `p`.* -FROM `Posts` AS `p` -LEFT JOIN `Blogs` AS `b` ON `p`.`BlogId` = `b`.`Id` -WHERE `b`.`Title` LIKE 'Arthur%' + """ +DELETE FROM `Posts` AS `p` +WHERE `p`.`Id` IN ( + SELECT `p0`.`Id` + FROM `Posts` AS `p0` + LEFT JOIN `Blogs` AS `b` ON `p0`.`BlogId` = `b`.`Id` + WHERE `b`.`Title` LIKE 'Arthur%' +) """); } @@ -189,6 +202,36 @@ FROM [Orders] AS [o] """); } + public override async Task Delete_with_view_mapping(bool async) + { + await base.Delete_with_view_mapping(async); + + AssertSql( + """ +DELETE FROM `Blogs` AS `b` +"""); + } + + public override async Task Update_with_view_mapping(bool async) + { + await base.Update_with_view_mapping(async); +AssertSql( + """ +@p='Updated' (Size = 255) + +UPDATE `Blogs` AS `b` +SET `b`.`Data` = @p +"""); + } + + public override async Task Update_complex_type_with_view_mapping(bool async) + { + await base.Update_complex_type_with_view_mapping(async); + + // #34706 + AssertSql(); + } + private void AssertSql(params string[] expected) => TestSqlLoggerFactory.AssertBaseline(expected); diff --git a/test/EFCore.Jet.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesJetTest.cs b/test/EFCore.Jet.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesJetTest.cs index 962ee6af..08312b27 100644 --- a/test/EFCore.Jet.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesJetTest.cs @@ -24,6 +24,8 @@ public override async Task Delete_Where_TagWith(bool async) AssertSql( """ +-- MyDelete + DELETE FROM `Order Details` AS `o` WHERE `o`.`OrderID` < 10300 """); @@ -45,11 +47,11 @@ public override async Task Delete_Where_parameter(bool async) await base.Delete_Where_parameter(async); AssertSql( - $""" -@__quantity_0='1' (Nullable = true) (DbType = Int16) + """ +@quantity='1' (Nullable = true) (DbType = Int16) DELETE FROM `Order Details` AS `o` -WHERE `o`.`Quantity` = {AssertSqlHelper.Parameter("@__quantity_0")} +WHERE `o`.`Quantity` = @quantity """, // """ @@ -173,7 +175,7 @@ DELETE FROM `Order Details` AS `o` WHERE EXISTS ( SELECT 1 FROM ( - SELECT TOP 100 `o0`.`OrderID`, `o0`.`ProductID` + SELECT TOP @p `o0`.`OrderID`, `o0`.`ProductID` FROM `Order Details` AS `o0` WHERE `o0`.`OrderID` < 10300 ) AS `o1` @@ -228,18 +230,20 @@ public override async Task Delete_Where_predicate_with_GroupBy_aggregate_2(bool AssertSql( """ -DELETE `o`.* -FROM `Order Details` AS `o` -INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` -WHERE `o0`.`OrderID` IN ( - SELECT ( - SELECT TOP 1 `o2`.`OrderID` +DELETE FROM `Order Details` AS `o` +WHERE EXISTS ( + SELECT 1 + FROM `Order Details` AS `o0` + INNER JOIN `Orders` AS `o1` ON `o0`.`OrderID` = `o1`.`OrderID` + WHERE `o1`.`OrderID` IN ( + SELECT ( + SELECT TOP 1 `o3`.`OrderID` + FROM `Orders` AS `o3` + WHERE `o2`.`CustomerID` = `o3`.`CustomerID` OR (`o2`.`CustomerID` IS NULL AND `o3`.`CustomerID` IS NULL)) FROM `Orders` AS `o2` - WHERE `o1`.`CustomerID` = `o2`.`CustomerID` OR (`o1`.`CustomerID` IS NULL AND `o2`.`CustomerID` IS NULL)) - FROM `Orders` AS `o1` - GROUP BY `o1`.`CustomerID` - HAVING COUNT(*) > 9 -) + GROUP BY `o2`.`CustomerID` + HAVING COUNT(*) > 9 + ) AND `o0`.`OrderID` = `o`.`OrderID` AND `o0`.`ProductID` = `o`.`ProductID`) """); } @@ -269,15 +273,15 @@ SELECT 1 FROM ( SELECT `o4`.`OrderID`, `o4`.`ProductID` FROM ( - SELECT TOP 5 `o3`.`OrderID`, `o3`.`ProductID` + SELECT TOP @p2 `o3`.`OrderID`, `o3`.`ProductID` FROM ( - SELECT TOP 25 `o0`.`OrderID`, `o0`.`ProductID` + SELECT TOP @p1 + @p2 `o0`.`OrderID`, `o0`.`ProductID` FROM ( SELECT `o6`.`OrderID`, `o6`.`ProductID` FROM ( - SELECT TOP 100 `o5`.`OrderID`, `o5`.`ProductID` + SELECT TOP @p `o5`.`OrderID`, `o5`.`ProductID` FROM ( - SELECT TOP 200 `o1`.`OrderID`, `o1`.`ProductID` + SELECT TOP @p + @p `o1`.`OrderID`, `o1`.`ProductID` FROM `Order Details` AS `o1` WHERE `o1`.`OrderID` < 10300 ) AS `o5` @@ -307,10 +311,12 @@ public override async Task Delete_SelectMany(bool async) AssertSql( """ -DELETE `o0`.* -FROM `Orders` AS `o` -INNER JOIN `Order Details` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` -WHERE `o`.`OrderID` < 10250 +DELETE FROM `Order Details` AS `o` +WHERE EXISTS ( + SELECT 1 + FROM `Orders` AS `o0` + INNER JOIN `Order Details` AS `o1` ON `o0`.`OrderID` = `o1`.`OrderID` + WHERE `o0`.`OrderID` < 10250 AND `o1`.`OrderID` = `o`.`OrderID` AND `o1`.`ProductID` = `o`.`ProductID`) """); } @@ -339,10 +345,12 @@ public override async Task Delete_Where_using_navigation(bool async) AssertSql( """ -DELETE `o`.* -FROM `Order Details` AS `o` -INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` -WHERE DATEPART('yyyy', `o0`.`OrderDate`) = 2000 +DELETE FROM `Order Details` AS `o` +WHERE EXISTS ( + SELECT 1 + FROM `Order Details` AS `o0` + INNER JOIN `Orders` AS `o1` ON `o0`.`OrderID` = `o1`.`OrderID` + WHERE DATEPART('yyyy', `o1`.`OrderDate`) = 2000 AND `o0`.`OrderID` = `o`.`OrderID` AND `o0`.`ProductID` = `o`.`ProductID`) """); } @@ -352,11 +360,13 @@ public override async Task Delete_Where_using_navigation_2(bool async) AssertSql( """ -DELETE `o`.* -FROM (`Order Details` AS `o` -INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) -LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` -WHERE `c`.`CustomerID` LIKE 'F%' +DELETE FROM `Order Details` AS `o` +WHERE EXISTS ( + SELECT 1 + FROM (`Order Details` AS `o0` + INNER JOIN `Orders` AS `o1` ON `o0`.`OrderID` = `o1`.`OrderID`) + LEFT JOIN `Customers` AS `c` ON `o1`.`CustomerID` = `c`.`CustomerID` + WHERE (`c`.`CustomerID` LIKE 'F%') AND `o0`.`OrderID` = `o`.`OrderID` AND `o0`.`ProductID` = `o`.`ProductID`) """); } @@ -495,11 +505,13 @@ public override async Task Delete_Where_optional_navigation_predicate(bool async AssertSql( """ -DELETE `o`.* -FROM (`Order Details` AS `o` -INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) -LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` -WHERE `c`.`City` LIKE 'Se%' +DELETE FROM `Order Details` AS `o` +WHERE EXISTS ( + SELECT 1 + FROM (`Order Details` AS `o0` + INNER JOIN `Orders` AS `o1` ON `o0`.`OrderID` = `o1`.`OrderID`) + LEFT JOIN `Customers` AS `c` ON `o1`.`CustomerID` = `c`.`CustomerID` + WHERE (`c`.`City` LIKE 'Se%') AND `o0`.`OrderID` = `o`.`OrderID` AND `o0`.`ProductID` = `o`.`ProductID`) """); } @@ -509,48 +521,81 @@ public override async Task Delete_with_join(bool async) AssertSql( """ -DELETE `o`.* -FROM `Order Details` AS `o` -INNER JOIN ( - SELECT `o3`.`OrderID` - FROM ( - SELECT TOP 100 `o2`.`OrderID` +DELETE FROM `Order Details` AS `o` +WHERE EXISTS ( + SELECT 1 + FROM `Order Details` AS `o0` + INNER JOIN ( + SELECT `o4`.`OrderID` FROM ( - SELECT TOP 100 `o0`.`OrderID` - FROM `Orders` AS `o0` - WHERE `o0`.`OrderID` < 10300 - ORDER BY `o0`.`OrderID` - ) AS `o2` - ORDER BY `o2`.`OrderID` DESC - ) AS `o3` - ORDER BY `o3`.`OrderID` -) AS `o1` ON `o`.`OrderID` = `o1`.`OrderID` + SELECT TOP @p0 `o3`.`OrderID` + FROM ( + SELECT TOP @p + @p0 `o2`.`OrderID` + FROM `Orders` AS `o2` + WHERE `o2`.`OrderID` < 10300 + ORDER BY `o2`.`OrderID` + ) AS `o3` + ORDER BY `o3`.`OrderID` DESC + ) AS `o4` + ORDER BY `o4`.`OrderID` + ) AS `o1` ON `o0`.`OrderID` = `o1`.`OrderID` + WHERE `o0`.`OrderID` = `o`.`OrderID` AND `o0`.`ProductID` = `o`.`ProductID`) """); } - public override async Task Delete_with_left_join(bool async) + public override async Task Delete_with_LeftJoin(bool async) { - await base.Delete_with_left_join(async); + await base.Delete_with_LeftJoin(async); AssertSql( """ -DELETE `o`.* -FROM `Order Details` AS `o` -LEFT JOIN ( - SELECT `o3`.`OrderID` - FROM ( - SELECT TOP 100 `o2`.`OrderID` +DELETE FROM `Order Details` AS `o` +WHERE EXISTS ( + SELECT 1 + FROM `Order Details` AS `o0` + LEFT JOIN ( + SELECT `o4`.`OrderID` FROM ( - SELECT TOP 100 `o0`.`OrderID` - FROM `Orders` AS `o0` - WHERE `o0`.`OrderID` < 10300 - ORDER BY `o0`.`OrderID` - ) AS `o2` - ORDER BY `o2`.`OrderID` DESC - ) AS `o3` - ORDER BY `o3`.`OrderID` -) AS `o1` ON `o`.`OrderID` = `o1`.`OrderID` -WHERE `o`.`OrderID` < 10276 + SELECT TOP @p0 `o3`.`OrderID` + FROM ( + SELECT TOP @p + @p0 `o2`.`OrderID` + FROM `Orders` AS `o2` + WHERE `o2`.`OrderID` < 10300 + ORDER BY `o2`.`OrderID` + ) AS `o3` + ORDER BY `o3`.`OrderID` DESC + ) AS `o4` + ORDER BY `o4`.`OrderID` + ) AS `o1` ON `o0`.`OrderID` = `o1`.`OrderID` + WHERE `o0`.`OrderID` < 10276 AND `o0`.`OrderID` = `o`.`OrderID` AND `o0`.`ProductID` = `o`.`ProductID`) +"""); + } + + public override async Task Delete_with_LeftJoin_via_flattened_GroupJoin(bool async) + { + await base.Delete_with_LeftJoin_via_flattened_GroupJoin(async); + + AssertSql( + """ +DELETE FROM `Order Details` AS `o` +WHERE EXISTS ( + SELECT 1 + FROM `Order Details` AS `o0` + LEFT JOIN ( + SELECT `o4`.`OrderID` + FROM ( + SELECT TOP @p0 `o3`.`OrderID` + FROM ( + SELECT TOP @p + @p0 `o2`.`OrderID` + FROM `Orders` AS `o2` + WHERE `o2`.`OrderID` < 10300 + ORDER BY `o2`.`OrderID` + ) AS `o3` + ORDER BY `o3`.`OrderID` DESC + ) AS `o4` + ORDER BY `o4`.`OrderID` + ) AS `o1` ON `o0`.`OrderID` = `o1`.`OrderID` + WHERE `o0`.`OrderID` < 10276 AND `o0`.`OrderID` = `o`.`OrderID` AND `o0`.`ProductID` = `o`.`ProductID`) """); } @@ -559,17 +604,26 @@ public override async Task Delete_with_cross_join(bool async) await base.Delete_with_cross_join(async); AssertSql( -""" -DELETE FROM [o] -FROM [Order Details] AS [o] -CROSS JOIN ( - SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] - FROM [Orders] AS [o0] - WHERE [o0].[OrderID] < 10300 - ORDER BY [o0].[OrderID] - OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY -) AS [t] -WHERE [o].[OrderID] < 10276 + """ +DELETE FROM `Order Details` AS `o` +WHERE EXISTS ( + SELECT 1 + FROM `Order Details` AS `o0`, + ( + SELECT 1 + FROM ( + SELECT TOP 100 `o3`.`OrderID` + FROM ( + SELECT TOP 0 + 100 `o2`.`OrderID` + FROM `Orders` AS `o2` + WHERE `o2`.`OrderID` < 10300 + ORDER BY `o2`.`OrderID` + ) AS `o3` + ORDER BY `o3`.`OrderID` DESC + ) AS `o4` + ORDER BY `o4`.`OrderID` + ) AS `o1` + WHERE `o0`.`OrderID` < 10276 AND `o0`.`OrderID` = `o`.`OrderID` AND `o0`.`ProductID` = `o`.`ProductID`) """); } @@ -611,14 +665,40 @@ WHERE [o].[OrderID] < 10276 """); } + public override async Task Delete_with_RightJoin(bool async) + { + await base.Delete_with_RightJoin(async); + + AssertSql( + """ +@p='0' +@p0='100' + +DELETE FROM [o] +FROM [Order Details] AS [o] +RIGHT JOIN ( + SELECT [o0].[OrderID] + FROM [Orders] AS [o0] + WHERE [o0].[OrderID] < 10300 + ORDER BY [o0].[OrderID] + OFFSET @p ROWS FETCH NEXT @p0 ROWS ONLY +) AS [o1] ON [o].[OrderID] = [o1].[OrderID] +WHERE [o].[OrderID] < 10276 +"""); + } + public override async Task Update_Where_set_constant_TagWith(bool async) { await base.Update_Where_set_constant_TagWith(async); AssertExecuteUpdateSql( """ +@p='Updated' (Size = 30) + +-- MyUpdate + UPDATE `Customers` AS `c` -SET `c`.`ContactName` = 'Updated' +SET `c`.`ContactName` = @p WHERE `c`.`CustomerID` LIKE 'F%' """); } @@ -627,6 +707,20 @@ public override async Task Update_Where_set_constant(bool async) { await base.Update_Where_set_constant(async); + AssertExecuteUpdateSql( + """ +@p='Updated' (Size = 30) + +UPDATE `Customers` AS `c` +SET `c`.`ContactName` = @p +WHERE `c`.`CustomerID` LIKE 'F%' +"""); + } + + public override async Task Update_Where_set_constant_via_lambda(bool async) + { + await base.Update_Where_set_constant_via_lambda(async); + AssertExecuteUpdateSql( """ UPDATE `Customers` AS `c` @@ -640,20 +734,21 @@ public override async Task Update_Where_parameter_set_constant(bool async) await base.Update_Where_parameter_set_constant(async); AssertExecuteUpdateSql( - $""" -@__customer_0='ALFKI' (Size = 5) + """ +@p='Updated' (Size = 30) +@customer='ALFKI' (Size = 5) UPDATE `Customers` AS `c` -SET `c`.`ContactName` = 'Updated' -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customer_0")} +SET `c`.`ContactName` = @p +WHERE `c`.`CustomerID` = @customer """, // - $""" -@__customer_0='ALFKI' (Size = 5) + """ +@customer='ALFKI' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customer_0")} +WHERE `c`.`CustomerID` = @customer """, // """ @@ -663,8 +758,10 @@ public override async Task Update_Where_parameter_set_constant(bool async) """, // """ +@p='Updated' (Size = 30) + UPDATE `Customers` AS `c` -SET `c`.`ContactName` = 'Updated' +SET `c`.`ContactName` = @p WHERE 0 = 1 """); } @@ -674,11 +771,11 @@ public override async Task Update_Where_set_parameter(bool async) await base.Update_Where_set_parameter(async); AssertExecuteUpdateSql( - $""" -@__value_0='Abc' (Size = 30) + """ +@p='Abc' (Size = 30) UPDATE `Customers` AS `c` -SET `c`.`ContactName` = {AssertSqlHelper.Parameter("@__value_0")} +SET `c`.`ContactName` = @p WHERE `c`.`CustomerID` LIKE 'F%' """); } @@ -688,11 +785,11 @@ public override async Task Update_Where_set_parameter_from_closure_array(bool as await base.Update_Where_set_parameter_from_closure_array(async); AssertExecuteUpdateSql( - $""" -@__p_0='Abc' (Size = 30) + """ +@p='Abc' (Size = 30) UPDATE `Customers` AS `c` -SET `c`.`ContactName` = {AssertSqlHelper.Parameter("@__p_0")} +SET `c`.`ContactName` = @p WHERE `c`.`CustomerID` LIKE 'F%' """); } @@ -703,8 +800,10 @@ public override async Task Update_Where_set_parameter_from_inline_list(bool asyn AssertExecuteUpdateSql( """ +@p='Abc' (Size = 30) + UPDATE `Customers` AS `c` -SET `c`.`ContactName` = 'Abc' +SET `c`.`ContactName` = @p WHERE `c`.`CustomerID` LIKE 'F%' """); } @@ -714,11 +813,11 @@ public override async Task Update_Where_set_parameter_from_multilevel_property_a await base.Update_Where_set_parameter_from_multilevel_property_access(async); AssertExecuteUpdateSql( - $""" -@__container_Containee_Property_0='Abc' (Size = 30) + """ +@p='Abc' (Size = 30) UPDATE `Customers` AS `c` -SET `c`.`ContactName` = {AssertSqlHelper.Parameter("@__container_Containee_Property_0")} +SET `c`.`ContactName` = @p WHERE `c`.`CustomerID` LIKE 'F%' """); } @@ -750,13 +849,15 @@ public override async Task Update_Where_Take_set_constant(bool async) AssertExecuteUpdateSql( """ +@p0='Updated' (Size = 30) + UPDATE `Customers` AS `c0` INNER JOIN ( - SELECT TOP 4 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'F%' ) AS `c1` ON `c0`.`CustomerID` = `c1`.`CustomerID` -SET `c0`.`ContactName` = 'Updated' +SET `c0`.`ContactName` = @p0 """); } @@ -766,19 +867,21 @@ public override async Task Update_Where_Skip_Take_set_constant(bool async) AssertExecuteUpdateSql( """ +@p1='Updated' (Size = 30) + UPDATE `Customers` AS `c0` INNER JOIN ( SELECT `c3`.`CustomerID` FROM ( - SELECT TOP 4 `c2`.`CustomerID` + SELECT TOP @p0 `c2`.`CustomerID` FROM ( - SELECT TOP 6 `c`.`CustomerID` + SELECT TOP @p + @p0 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'F%' ) AS `c2` ) AS `c3` ) AS `c1` ON `c0`.`CustomerID` = `c1`.`CustomerID` -SET `c0`.`ContactName` = 'Updated' +SET `c0`.`ContactName` = @p1 """); } @@ -788,13 +891,15 @@ public override async Task Update_Where_OrderBy_set_constant(bool async) AssertExecuteUpdateSql( """ +@p='Updated' (Size = 30) + UPDATE `Customers` AS `c0` INNER JOIN ( SELECT `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'F%' ) AS `c1` ON `c0`.`CustomerID` = `c1`.`CustomerID` -SET `c0`.`ContactName` = 'Updated' +SET `c0`.`ContactName` = @p """); } @@ -825,14 +930,16 @@ public override async Task Update_Where_OrderBy_Take_set_constant(bool async) AssertExecuteUpdateSql( """ +@p0='Updated' (Size = 30) + UPDATE `Customers` AS `c0` INNER JOIN ( - SELECT TOP 4 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'F%' ORDER BY `c`.`City` ) AS `c1` ON `c0`.`CustomerID` = `c1`.`CustomerID` -SET `c0`.`ContactName` = 'Updated' +SET `c0`.`ContactName` = @p0 """); } @@ -842,13 +949,15 @@ public override async Task Update_Where_OrderBy_Skip_Take_set_constant(bool asyn AssertExecuteUpdateSql( """ +@p1='Updated' (Size = 30) + UPDATE `Customers` AS `c0` INNER JOIN ( SELECT `c3`.`CustomerID` FROM ( - SELECT TOP 4 `c2`.`CustomerID`, `c2`.`City` + SELECT TOP @p0 `c2`.`CustomerID`, `c2`.`City` FROM ( - SELECT TOP 6 `c`.`CustomerID`, `c`.`City` + SELECT TOP @p + @p0 `c`.`CustomerID`, `c`.`City` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'F%' ORDER BY `c`.`City` @@ -857,7 +966,7 @@ ORDER BY `c2`.`City` DESC ) AS `c3` ORDER BY `c3`.`City` ) AS `c1` ON `c0`.`CustomerID` = `c1`.`CustomerID` -SET `c0`.`ContactName` = 'Updated' +SET `c0`.`ContactName` = @p1 """); } @@ -867,17 +976,19 @@ public override async Task Update_Where_OrderBy_Skip_Take_Skip_Take_set_constant AssertExecuteUpdateSql( """ +@p3='Updated' (Size = 30) + UPDATE `Customers` AS `c1` INNER JOIN ( SELECT `c4`.`CustomerID` FROM ( - SELECT TOP 2 `c3`.`CustomerID`, `c3`.`City` + SELECT TOP @p `c3`.`CustomerID`, `c3`.`City` FROM ( - SELECT TOP 4 `c0`.`CustomerID`, `c0`.`City` + SELECT TOP @p + @p `c0`.`CustomerID`, `c0`.`City` FROM ( - SELECT TOP 6 `c5`.`CustomerID`, `c5`.`City` + SELECT TOP @p0 `c5`.`CustomerID`, `c5`.`City` FROM ( - SELECT TOP 8 `c`.`CustomerID`, `c`.`City` + SELECT TOP @p + @p0 `c`.`CustomerID`, `c`.`City` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'F%' ORDER BY `c`.`City` @@ -890,7 +1001,7 @@ ORDER BY `c3`.`City` DESC ) AS `c4` ORDER BY `c4`.`City` ) AS `c2` ON `c1`.`CustomerID` = `c2`.`CustomerID` -SET `c1`.`ContactName` = 'Updated' +SET `c1`.`ContactName` = @p3 """); } @@ -900,8 +1011,10 @@ public override async Task Update_Where_GroupBy_aggregate_set_constant(bool asyn AssertExecuteUpdateSql( """ +@p='Updated' (Size = 30) + UPDATE `Customers` AS `c` -SET `c`.`ContactName` = 'Updated' +SET `c`.`ContactName` = @p WHERE `c`.`CustomerID` = ( SELECT TOP 1 `o`.`CustomerID` FROM `Orders` AS `o` @@ -916,8 +1029,10 @@ public override async Task Update_Where_GroupBy_First_set_constant(bool async) AssertExecuteUpdateSql( """ +@p='Updated' (Size = 30) + UPDATE `Customers` AS `c` -SET `c`.`ContactName` = 'Updated' +SET `c`.`ContactName` = @p WHERE `c`.`CustomerID` = ( SELECT TOP 1 ( SELECT TOP 1 `o0`.`CustomerID` @@ -941,9 +1056,11 @@ public override async Task Update_Where_GroupBy_First_set_constant_3(bool async) await base.Update_Where_GroupBy_First_set_constant_3(async); AssertExecuteUpdateSql( -""" + """ +@p='Updated' (Size = 30) + UPDATE `Customers` AS `c` -SET `c`.`ContactName` = 'Updated' +SET `c`.`ContactName` = @p WHERE `c`.`CustomerID` IN ( SELECT ( SELECT TOP 1 `c0`.`CustomerID` @@ -988,10 +1105,13 @@ public override async Task Update_Where_using_navigation_2_set_constant(bool asy AssertExecuteUpdateSql( """ +@p='1' +@p='1' + UPDATE (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` -SET `o`.`Quantity` = CINT(1) +SET `o`.`Quantity` = IIF(@p IS NULL, NULL, CINT(@p)) WHERE `c`.`City` = 'Seattle' """); } @@ -1026,11 +1146,11 @@ public override async Task Update_Where_set_property_plus_parameter(bool async) await base.Update_Where_set_property_plus_parameter(async); AssertExecuteUpdateSql( - $""" -@__value_0='Abc' (Size = 255) + """ +@value='Abc' (Size = 255) UPDATE `Customers` AS `c` -SET `c`.`ContactName` = IIF(`c`.`ContactName` IS NULL, '', `c`.`ContactName`) & {AssertSqlHelper.Parameter("@__value_0")} +SET `c`.`ContactName` = IIF(`c`.`ContactName` IS NULL, '', `c`.`ContactName`) & @value WHERE `c`.`CustomerID` LIKE 'F%' """); } @@ -1053,8 +1173,10 @@ public override async Task Update_Where_set_constant_using_ef_property(bool asyn AssertExecuteUpdateSql( """ +@p='Updated' (Size = 30) + UPDATE `Customers` AS `c` -SET `c`.`ContactName` = 'Updated' +SET `c`.`ContactName` = @p WHERE `c`.`CustomerID` LIKE 'F%' """); } @@ -1078,24 +1200,18 @@ public override async Task Update_without_property_to_set_throws(bool async) AssertExecuteUpdateSql(); } - public override async Task Update_with_invalid_lambda_throws(bool async) - { - await base.Update_with_invalid_lambda_throws(async); - - AssertExecuteUpdateSql(); - } - public override async Task Update_Where_multiple_set(bool async) { await base.Update_Where_multiple_set(async); AssertExecuteUpdateSql( - $""" -@__value_0='Abc' (Size = 30) + """ +@value='Abc' (Size = 30) +@p='Seattle' (Size = 15) UPDATE `Customers` AS `c` -SET `c`.`City` = 'Seattle', - `c`.`ContactName` = {AssertSqlHelper.Parameter("@__value_0")} +SET `c`.`ContactName` = @value, + `c`.`City` = @p WHERE `c`.`CustomerID` LIKE 'F%' """); } @@ -1211,34 +1327,77 @@ public override async Task Update_with_join_set_constant(bool async) AssertExecuteUpdateSql( """ +@p='Updated' (Size = 30) + UPDATE `Customers` AS `c` INNER JOIN ( SELECT `o`.`CustomerID` FROM `Orders` AS `o` WHERE `o`.`OrderID` < 10300 ) AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` -SET `c`.`ContactName` = 'Updated' +SET `c`.`ContactName` = @p WHERE `c`.`CustomerID` LIKE 'F%' """); } - public override async Task Update_with_left_join_set_constant(bool async) + public override async Task Update_with_LeftJoin(bool async) { - await base.Update_with_left_join_set_constant(async); + await base.Update_with_LeftJoin(async); + + AssertExecuteUpdateSql( + """ +@p='Updated' (Size = 30) + +UPDATE `Customers` AS `c` +LEFT JOIN ( + SELECT `o`.`CustomerID` + FROM `Orders` AS `o` + WHERE `o`.`OrderID` < 10300 +) AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` +SET `c`.`ContactName` = @p +WHERE `c`.`CustomerID` LIKE 'F%' +"""); + } + + public override async Task Update_with_LeftJoin_via_flattened_GroupJoin(bool async) + { + await base.Update_with_LeftJoin_via_flattened_GroupJoin(async); AssertExecuteUpdateSql( """ +@p='Updated' (Size = 30) + UPDATE `Customers` AS `c` LEFT JOIN ( SELECT `o`.`CustomerID` FROM `Orders` AS `o` WHERE `o`.`OrderID` < 10300 ) AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` -SET `c`.`ContactName` = 'Updated' +SET `c`.`ContactName` = @p WHERE `c`.`CustomerID` LIKE 'F%' """); } + public override async Task Update_with_RightJoin(bool async) + { + await base.Update_with_RightJoin(async); + + AssertExecuteUpdateSql( + """ +@p='2020-01-01T00:00:00.0000000Z' (Nullable = true) (DbType = DateTime) + +UPDATE [o] +SET [o].[OrderDate] = @p +FROM [Orders] AS [o] +RIGHT JOIN ( + SELECT [c].[CustomerID] + FROM [Customers] AS [c] + WHERE [c].[CustomerID] LIKE N'F%' +) AS [c0] ON [o].[CustomerID] = [c0].[CustomerID] +WHERE [o].[OrderID] < 10300 +"""); + } + public override async Task Update_with_cross_join_set_constant(bool async) { await base.Update_with_cross_join_set_constant(async); @@ -1449,10 +1608,13 @@ public override async Task Update_with_two_inner_joins(bool async) AssertExecuteUpdateSql( """ +@p='1' +@p='1' + UPDATE (`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` -SET `o`.`Quantity` = CINT(1) +SET `o`.`Quantity` = IIF(@p IS NULL, NULL, CINT(@p)) WHERE `p`.`Discontinued` = TRUE AND `o0`.`OrderDate` > #1990-01-01# """); } diff --git a/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPCFiltersInheritanceBulkUpdatesJetTest.cs b/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPCFiltersInheritanceBulkUpdatesJetTest.cs index c3900f42..a6d19f02 100644 --- a/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPCFiltersInheritanceBulkUpdatesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPCFiltersInheritanceBulkUpdatesJetTest.cs @@ -136,8 +136,10 @@ public override async Task Update_base_property_on_derived_type(bool async) AssertExecuteUpdateSql( """ +@p='SomeOtherKiwi' (Size = 255) + UPDATE `Kiwi` AS `k` -SET `k`.`Name` = 'SomeOtherKiwi' +SET `k`.`Name` = @p WHERE `k`.`CountryId` = 1 """); } @@ -148,8 +150,10 @@ public override async Task Update_derived_property_on_derived_type(bool async) AssertExecuteUpdateSql( """ +@p='0' (Size = 1) + UPDATE `Kiwi` AS `k` -SET `k`.`FoundOn` = CBYTE(0) +SET `k`.`FoundOn` = @p WHERE `k`.`CountryId` = 1 """); } @@ -160,8 +164,10 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( """ +@p='Monovia' (Size = 255) + UPDATE `Countries` AS `c` -SET `c`.`Name` = 'Monovia' +SET `c`.`Name` = @p WHERE ( SELECT COUNT(*) FROM ( @@ -181,9 +187,12 @@ public override async Task Update_base_and_derived_types(bool async) AssertExecuteUpdateSql( """ +@p='Kiwi' (Size = 255) +@p0='0' (Size = 1) + UPDATE `Kiwi` AS `k` -SET `k`.`FoundOn` = CBYTE(0), - `k`.`Name` = 'Kiwi' +SET `k`.`Name` = @p, + `k`.`FoundOn` = @p0 WHERE `k`.`CountryId` = 1 """); } @@ -194,8 +203,10 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( """ +@p='Monovia' (Size = 255) + UPDATE `Countries` AS `c` -SET `c`.`Name` = 'Monovia' +SET `c`.`Name` = @p WHERE ( SELECT COUNT(*) FROM ( diff --git a/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesJetTest.cs b/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesJetTest.cs index ac4a77bf..54a11026 100644 --- a/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPCInheritanceBulkUpdatesJetTest.cs @@ -135,8 +135,10 @@ public override async Task Update_base_property_on_derived_type(bool async) AssertExecuteUpdateSql( """ +@p='SomeOtherKiwi' (Size = 255) + UPDATE `Kiwi` AS `k` -SET `k`.`Name` = 'SomeOtherKiwi' +SET `k`.`Name` = @p """); } @@ -146,8 +148,10 @@ public override async Task Update_derived_property_on_derived_type(bool async) AssertExecuteUpdateSql( """ +@p='0' (Size = 1) + UPDATE `Kiwi` AS `k` -SET `k`.`FoundOn` = CBYTE(0) +SET `k`.`FoundOn` = @p """); } @@ -157,8 +161,10 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( """ +@p='Monovia' (Size = 255) + UPDATE `Countries` AS `c` -SET `c`.`Name` = 'Monovia' +SET `c`.`Name` = @p WHERE ( SELECT COUNT(*) FROM ( @@ -178,9 +184,12 @@ public override async Task Update_base_and_derived_types(bool async) AssertExecuteUpdateSql( """ +@p='Kiwi' (Size = 255) +@p0='0' (Size = 1) + UPDATE `Kiwi` AS `k` -SET `k`.`FoundOn` = CBYTE(0), - `k`.`Name` = 'Kiwi' +SET `k`.`Name` = @p, + `k`.`FoundOn` = @p0 """); } @@ -190,8 +199,10 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( """ +@p='Monovia' (Size = 255) + UPDATE `Countries` AS `c` -SET `c`.`Name` = 'Monovia' +SET `c`.`Name` = @p WHERE ( SELECT COUNT(*) FROM ( @@ -208,8 +219,10 @@ public override async Task Update_with_interface_in_property_expression(bool asy AssertExecuteUpdateSql( """ +@p='0' + UPDATE `Coke` AS `c` -SET `c`.`SugarGrams` = 0 +SET `c`.`SugarGrams` = @p """); } @@ -219,8 +232,10 @@ public override async Task Update_with_interface_in_EF_Property_in_property_expr AssertExecuteUpdateSql( """ +@p='0' + UPDATE `Coke` AS `c` -SET `c`.`SugarGrams` = 0 +SET `c`.`SugarGrams` = @p """); } diff --git a/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPHInheritanceBulkUpdatesJetTest.cs b/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPHInheritanceBulkUpdatesJetTest.cs index ea7b11ed..f394d86e 100644 --- a/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPHInheritanceBulkUpdatesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPHInheritanceBulkUpdatesJetTest.cs @@ -119,9 +119,9 @@ DELETE FROM `Animals` AS `a` WHERE `a`.`Id` IN ( SELECT `a2`.`Id` FROM ( - SELECT TOP 3 `a1`.`Id`, `a1`.`Name` + SELECT TOP @p0 `a1`.`Id`, `a1`.`Name` FROM ( - SELECT TOP 3 `a0`.`Id`, `a0`.`Name` + SELECT TOP @p + @p0 `a0`.`Id`, `a0`.`Name` FROM `Animals` AS `a0` WHERE `a0`.`Name` = 'Great spotted kiwi' ORDER BY `a0`.`Name` @@ -139,8 +139,10 @@ public override async Task Update_base_type(bool async) AssertExecuteUpdateSql( """ +@p='Animal' (Size = 255) + UPDATE `Animals` AS `a` -SET `a`.`Name` = 'Animal' +SET `a`.`Name` = @p WHERE `a`.`Name` = 'Great spotted kiwi' """); } @@ -151,8 +153,10 @@ public override async Task Update_base_type_with_OfType(bool async) AssertExecuteUpdateSql( """ +@p='NewBird' (Size = 255) + UPDATE `Animals` AS `a` -SET `a`.`Name` = 'NewBird' +SET `a`.`Name` = @p WHERE `a`.`Discriminator` = 'Kiwi' """); } @@ -170,8 +174,10 @@ public override async Task Update_base_property_on_derived_type(bool async) AssertExecuteUpdateSql( """ +@p='SomeOtherKiwi' (Size = 255) + UPDATE `Animals` AS `a` -SET `a`.`Name` = 'SomeOtherKiwi' +SET `a`.`Name` = @p WHERE `a`.`Discriminator` = 'Kiwi' """); } @@ -182,8 +188,10 @@ public override async Task Update_derived_property_on_derived_type(bool async) AssertExecuteUpdateSql( """ +@p='0' (Size = 1) + UPDATE `Animals` AS `a` -SET `a`.`FoundOn` = CBYTE(0) +SET `a`.`FoundOn` = @p WHERE `a`.`Discriminator` = 'Kiwi' """); } @@ -194,8 +202,10 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( """ +@p='Monovia' (Size = 255) + UPDATE `Countries` AS `c` -SET `c`.`Name` = 'Monovia' +SET `c`.`Name` = @p WHERE ( SELECT COUNT(*) FROM `Animals` AS `a` @@ -209,9 +219,12 @@ public override async Task Update_base_and_derived_types(bool async) AssertExecuteUpdateSql( """ +@p='Kiwi' (Size = 255) +@p0='0' (Size = 1) + UPDATE `Animals` AS `a` -SET `a`.`FoundOn` = CBYTE(0), - `a`.`Name` = 'Kiwi' +SET `a`.`Name` = @p, + `a`.`FoundOn` = @p0 WHERE `a`.`Discriminator` = 'Kiwi' """); } @@ -222,8 +235,10 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( """ +@p='Monovia' (Size = 255) + UPDATE `Countries` AS `c` -SET `c`.`Name` = 'Monovia' +SET `c`.`Name` = @p WHERE ( SELECT COUNT(*) FROM `Animals` AS `a` @@ -244,8 +259,10 @@ public override async Task Update_with_interface_in_property_expression(bool asy AssertExecuteUpdateSql( """ +@p='0' + UPDATE `Drinks` AS `d` -SET `d`.`SugarGrams` = 0 +SET `d`.`SugarGrams` = @p WHERE `d`.`Discriminator` = 1 """); } @@ -256,8 +273,10 @@ public override async Task Update_with_interface_in_EF_Property_in_property_expr AssertExecuteUpdateSql( """ +@p='0' + UPDATE `Drinks` AS `d` -SET `d`.`SugarGrams` = 0 +SET `d`.`SugarGrams` = @p WHERE `d`.`Discriminator` = 1 """); } diff --git a/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesJetTest.cs b/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesJetTest.cs index 962d07bd..eab403e1 100644 --- a/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesJetTest.cs @@ -104,8 +104,10 @@ public override async Task Update_base_type(bool async) AssertExecuteUpdateSql( """ +@p='Animal' (Size = 255) + UPDATE `Animals` AS `a` -SET `a`.`Name` = 'Animal' +SET `a`.`Name` = @p WHERE `a`.`CountryId` = 1 AND `a`.`Name` = 'Great spotted kiwi' """); } @@ -116,9 +118,11 @@ public override async Task Update_base_type_with_OfType(bool async) AssertExecuteUpdateSql( """ +@p='NewBird' (Size = 255) + UPDATE `Animals` AS `a` LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -SET `a`.`Name` = 'NewBird' +SET `a`.`Name` = @p WHERE `a`.`CountryId` = 1 AND `k`.`Id` IS NOT NULL """); } @@ -136,10 +140,12 @@ public override async Task Update_base_property_on_derived_type(bool async) AssertExecuteUpdateSql( """ +@p='SomeOtherKiwi' (Size = 255) + UPDATE (`Animals` AS `a` INNER JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id`) INNER JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -SET `a`.`Name` = 'SomeOtherKiwi' +SET `a`.`Name` = @p WHERE `a`.`CountryId` = 1 """); } @@ -150,10 +156,12 @@ public override async Task Update_derived_property_on_derived_type(bool async) AssertExecuteUpdateSql( """ +@p='0' (Size = 1) + UPDATE (`Animals` AS `a` INNER JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id`) INNER JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -SET `k`.`FoundOn` = CBYTE(0) +SET `k`.`FoundOn` = @p WHERE `a`.`CountryId` = 1 """); } @@ -171,8 +179,10 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( """ +@p='Monovia' (Size = 255) + UPDATE `Countries` AS `c` -SET `c`.`Name` = 'Monovia' +SET `c`.`Name` = @p WHERE ( SELECT COUNT(*) FROM `Animals` AS `a` @@ -186,8 +196,10 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( """ +@p='Monovia' (Size = 255) + UPDATE `Countries` AS `c` -SET `c`.`Name` = 'Monovia' +SET `c`.`Name` = @p WHERE ( SELECT COUNT(*) FROM `Animals` AS `a` diff --git a/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesJetTest.cs b/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesJetTest.cs index 172ba0bc..5283325f 100644 --- a/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesJetTest.cs @@ -88,8 +88,10 @@ public override async Task Update_base_type(bool async) AssertExecuteUpdateSql( """ +@p='Animal' (Size = 255) + UPDATE `Animals` AS `a` -SET `a`.`Name` = 'Animal' +SET `a`.`Name` = @p WHERE `a`.`Name` = 'Great spotted kiwi' """); } @@ -100,9 +102,11 @@ public override async Task Update_base_type_with_OfType(bool async) AssertExecuteUpdateSql( """ +@p='NewBird' (Size = 255) + UPDATE `Animals` AS `a` LEFT JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -SET `a`.`Name` = 'NewBird' +SET `a`.`Name` = @p WHERE `k`.`Id` IS NOT NULL """); } @@ -120,10 +124,12 @@ public override async Task Update_base_property_on_derived_type(bool async) AssertExecuteUpdateSql( """ +@p='SomeOtherKiwi' (Size = 255) + UPDATE (`Animals` AS `a` INNER JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id`) INNER JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -SET `a`.`Name` = 'SomeOtherKiwi' +SET `a`.`Name` = @p """); } @@ -133,10 +139,12 @@ public override async Task Update_derived_property_on_derived_type(bool async) AssertExecuteUpdateSql( """ +@p='0' (Size = 1) + UPDATE (`Animals` AS `a` INNER JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id`) INNER JOIN `Kiwi` AS `k` ON `a`.`Id` = `k`.`Id` -SET `k`.`FoundOn` = CBYTE(0) +SET `k`.`FoundOn` = @p """); } @@ -153,8 +161,10 @@ public override async Task Update_where_using_hierarchy(bool async) AssertExecuteUpdateSql( """ +@p='Monovia' (Size = 255) + UPDATE `Countries` AS `c` -SET `c`.`Name` = 'Monovia' +SET `c`.`Name` = @p WHERE ( SELECT COUNT(*) FROM `Animals` AS `a` @@ -168,8 +178,10 @@ public override async Task Update_where_using_hierarchy_derived(bool async) AssertExecuteUpdateSql( """ +@p='Monovia' (Size = 255) + UPDATE `Countries` AS `c` -SET `c`.`Name` = 'Monovia' +SET `c`.`Name` = @p WHERE ( SELECT COUNT(*) FROM `Animals` AS `a` @@ -191,9 +203,11 @@ public override async Task Update_with_interface_in_property_expression(bool asy AssertExecuteUpdateSql( """ +@p='0' + UPDATE `Drinks` AS `d` INNER JOIN `Coke` AS `c` ON `d`.`Id` = `c`.`Id` -SET `c`.`SugarGrams` = 0 +SET `c`.`SugarGrams` = @p """); } @@ -203,9 +217,11 @@ public override async Task Update_with_interface_in_EF_Property_in_property_expr AssertExecuteUpdateSql( """ +@p='0' + UPDATE `Drinks` AS `d` INNER JOIN `Coke` AS `c` ON `d`.`Id` = `c`.`Id` -SET `c`.`SugarGrams` = 0 +SET `c`.`SugarGrams` = @p """); } diff --git a/test/EFCore.Jet.FunctionalTests/ComputedColumnTest.cs b/test/EFCore.Jet.FunctionalTests/ComputedColumnTest.cs index f711a291..c170642a 100644 --- a/test/EFCore.Jet.FunctionalTests/ComputedColumnTest.cs +++ b/test/EFCore.Jet.FunctionalTests/ComputedColumnTest.cs @@ -138,10 +138,7 @@ public void Can_use_computed_columns_with_nullable_enum() public async Task InitializeAsync() => TestStore = await JetTestStore.CreateInitializedAsync("ComputedColumnTest"); - public Task DisposeAsync() - { - TestStore.Dispose(); - return Task.CompletedTask; - } + public async Task DisposeAsync() + => await TestStore.DisposeAsync(); } } diff --git a/test/EFCore.Jet.FunctionalTests/ConnectionSpecificationTest.cs b/test/EFCore.Jet.FunctionalTests/ConnectionSpecificationTest.cs index 73863f5a..b634ac66 100644 --- a/test/EFCore.Jet.FunctionalTests/ConnectionSpecificationTest.cs +++ b/test/EFCore.Jet.FunctionalTests/ConnectionSpecificationTest.cs @@ -32,7 +32,7 @@ var serviceProvider .AddDbContext() .BuildServiceProvider(validateScopes: true); - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { using var scope = serviceProvider.CreateScope(); var context = scope.ServiceProvider.GetRequiredService(); @@ -46,9 +46,9 @@ var serviceProvider [ConditionalFact] public async Task Can_specify_no_connection_string_in_OnConfiguring_with_default_service_provider() { - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { - using var context = new NoneInOnConfiguringContext(); + await using var context = new NoneInOnConfiguringContext(); context.Database.SetConnectionString(JetNorthwindTestStoreFactory.NorthwindConnectionString); @@ -59,9 +59,9 @@ public async Task Can_specify_no_connection_string_in_OnConfiguring_with_default [ConditionalFact] public async Task Throws_if_context_used_with_no_connection_or_connection_string() { - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { - using var context = new NoneInOnConfiguringContext(); + await using var context = new NoneInOnConfiguringContext(); await Assert.ThrowsAsync(() => context.Customers.AnyAsync()); } @@ -83,7 +83,7 @@ var serviceProvider .AddDbContext() .BuildServiceProvider(validateScopes: true); - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { using var scope = serviceProvider.CreateScope(); var context = scope.ServiceProvider.GetRequiredService(); @@ -94,9 +94,9 @@ var serviceProvider [ConditionalFact] public async Task Can_specify_connection_string_in_OnConfiguring_with_default_service_provider() { - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { - using var context = new StringInOnConfiguringContext(); + await using var context = new StringInOnConfiguringContext(); Assert.True(await context.Customers.AnyAsync()); } } @@ -121,7 +121,7 @@ var serviceProvider JetConnection connection; - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { using var scope = serviceProvider.CreateScope(); var context = scope.ServiceProvider.GetRequiredService(); @@ -151,7 +151,7 @@ public async Task Can_specify_no_connection_in_OnConfiguring_with_default_servic { JetConnection connection; - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { using var context = new NoneInOnConfiguringContext(); @@ -181,7 +181,7 @@ var serviceProvider .AddScoped(p => new JetConnection(JetNorthwindTestStoreFactory.NorthwindConnectionString)) .AddDbContext().BuildServiceProvider(validateScopes: true); - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { using var scope = serviceProvider.CreateScope(); var context = scope.ServiceProvider.GetRequiredService(); @@ -192,7 +192,7 @@ var serviceProvider [ConditionalFact] public async Task Can_specify_connection_in_OnConfiguring_with_default_service_provider() { - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { using var connection = new JetConnection(JetNorthwindTestStoreFactory.NorthwindConnectionString); using var context = new ConnectionInOnConfiguringContext(connection); @@ -211,7 +211,7 @@ var serviceProvider JetConnection connection; - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { connection = serviceProvider.GetRequiredService(); @@ -228,7 +228,7 @@ public async Task Can_specify_owned_connection_in_OnConfiguring_with_default_ser { JetConnection connection; - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { connection = new JetConnection(JetNorthwindTestStoreFactory.NorthwindConnectionString); using var context = new OwnedConnectionInOnConfiguringContext(connection); @@ -249,7 +249,7 @@ var serviceProvider .AddScoped(p => connection) .AddDbContext().BuildServiceProvider(validateScopes: true); - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { using var scope = serviceProvider.CreateScope(); var context = scope.ServiceProvider.GetRequiredService(); @@ -275,7 +275,7 @@ var serviceProvider .AddScoped(p => connection) .AddDbContext().BuildServiceProvider(validateScopes: true); - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { using var scope = serviceProvider.CreateScope(); var context = scope.ServiceProvider.GetRequiredService(); @@ -302,7 +302,7 @@ var serviceProvider .AddScoped(p => connection) .AddDbContext().BuildServiceProvider(validateScopes: true); - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { using var scope = serviceProvider.CreateScope(); var context = scope.ServiceProvider.GetRequiredService(); @@ -388,7 +388,7 @@ var serviceProvider .AddDbContext() .BuildServiceProvider(validateScopes: true); - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { using var scope = serviceProvider.CreateScope(); var context = scope.ServiceProvider.GetRequiredService(); @@ -399,7 +399,7 @@ var serviceProvider [ConditionalFact] public async Task Can_depend_on_DbContextOptions_with_default_service_provider() { - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { using var connection = new JetConnection(JetNorthwindTestStoreFactory.NorthwindConnectionString); @@ -442,7 +442,7 @@ var serviceProvider .AddDbContext() .BuildServiceProvider(validateScopes: true); - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { using var scope = serviceProvider.CreateScope(); var context = scope.ServiceProvider.GetRequiredService(); @@ -453,7 +453,7 @@ var serviceProvider [ConditionalFact] public async Task Can_depend_on_non_generic_options_when_only_one_context_with_default_service_provider() { - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { using var context = new NonGenericOptionsContext(new DbContextOptions()); Assert.True(await context.Customers.AnyAsync()); @@ -493,7 +493,7 @@ var serviceProvider b => b.UseJet(connectionString).EnableServiceProviderCaching(false)) .BuildServiceProvider(validateScopes: true); - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { using var serviceScope = serviceProvider.GetRequiredService().CreateScope(); using var context = serviceScope.ServiceProvider.GetRequiredService(); @@ -545,7 +545,7 @@ public async Task Can_use_an_existing_closed_connection_test(bool openConnection .AddEntityFrameworkJet() .BuildServiceProvider(validateScopes: true); - using var store = await JetTestStore.GetNorthwindStoreAsync(); + await using var store = await JetTestStore.GetNorthwindStoreAsync(); store.CloseConnection(); var openCount = 0; diff --git a/test/EFCore.Jet.FunctionalTests/DefaultValuesTest.cs b/test/EFCore.Jet.FunctionalTests/DefaultValuesTest.cs index d5d846e3..3afbbae3 100644 --- a/test/EFCore.Jet.FunctionalTests/DefaultValuesTest.cs +++ b/test/EFCore.Jet.FunctionalTests/DefaultValuesTest.cs @@ -92,10 +92,7 @@ private class Chipper public async Task InitializeAsync() => TestStore = await JetTestStore.CreateInitializedAsync("DefaultValuesTest"); - public Task DisposeAsync() - { - TestStore.Dispose(); - return Task.CompletedTask; - } + public async Task DisposeAsync() + => await TestStore.DisposeAsync(); } } diff --git a/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj b/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj index c6d206cb..523465bb 100644 --- a/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj +++ b/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj @@ -70,6 +70,8 @@ PreserveNewest + + @@ -100,6 +102,8 @@ + + diff --git a/test/EFCore.Jet.FunctionalTests/EntitySplittingSqlServerTest.cs b/test/EFCore.Jet.FunctionalTests/EntitySplittingSqlServerTest.cs index 7dd23287..44f59db0 100644 --- a/test/EFCore.Jet.FunctionalTests/EntitySplittingSqlServerTest.cs +++ b/test/EFCore.Jet.FunctionalTests/EntitySplittingSqlServerTest.cs @@ -12,8 +12,7 @@ namespace EntityFrameworkCore.Jet.FunctionalTests; -public class EntitySplittingSqlServerTest(ITestOutputHelper testOutputHelper) - : EntitySplittingTestBase(testOutputHelper) +public class EntitySplittingJetTest(NonSharedFixture fixture, ITestOutputHelper testOutputHelper) : EntitySplittingTestBase(fixture, testOutputHelper) { public override async Task Can_roundtrip() { diff --git a/test/EFCore.Jet.FunctionalTests/FindJetTest.cs b/test/EFCore.Jet.FunctionalTests/FindJetTest.cs index 0b8c231f..c16cfa70 100644 --- a/test/EFCore.Jet.FunctionalTests/FindJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/FindJetTest.cs @@ -43,14 +43,14 @@ public override void Find_int_key_from_store() base.Find_int_key_from_store(); AssertSql( - $""" -@__p_0='77' + """ +@p='77' SELECT `i3`.`Id`, `i3`.`Foo`, `s`.`IntKeyId`, `s`.`Id`, `s`.`Prop`, `s`.`NestedOwned_Prop`, `s`.`Owned1IntKeyId`, `s`.`Owned1Id`, `s`.`Id0`, `s`.`Prop0`, `i3`.`OwnedReference_Prop`, `i3`.`OwnedReference_NestedOwned_Prop`, `i2`.`Owned1IntKeyId`, `i2`.`Id`, `i2`.`Prop` FROM (( SELECT TOP 1 `i`.`Id`, `i`.`Foo`, `i`.`OwnedReference_Prop`, `i`.`OwnedReference_NestedOwned_Prop` FROM `IntKey` AS `i` - WHERE `i`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `i`.`Id` = @p ) AS `i3` LEFT JOIN ( SELECT `i0`.`IntKeyId`, `i0`.`Id`, `i0`.`Prop`, `i0`.`NestedOwned_Prop`, `i1`.`Owned1IntKeyId`, `i1`.`Owned1Id`, `i1`.`Id` AS `Id0`, `i1`.`Prop` AS `Prop0` @@ -67,14 +67,14 @@ public override void Returns_null_for_int_key_not_in_store() base.Returns_null_for_int_key_not_in_store(); AssertSql( - $""" -@__p_0='99' + """ +@p='99' SELECT `i3`.`Id`, `i3`.`Foo`, `s`.`IntKeyId`, `s`.`Id`, `s`.`Prop`, `s`.`NestedOwned_Prop`, `s`.`Owned1IntKeyId`, `s`.`Owned1Id`, `s`.`Id0`, `s`.`Prop0`, `i3`.`OwnedReference_Prop`, `i3`.`OwnedReference_NestedOwned_Prop`, `i2`.`Owned1IntKeyId`, `i2`.`Id`, `i2`.`Prop` FROM (( SELECT TOP 1 `i`.`Id`, `i`.`Foo`, `i`.`OwnedReference_Prop`, `i`.`OwnedReference_NestedOwned_Prop` FROM `IntKey` AS `i` - WHERE `i`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `i`.`Id` = @p ) AS `i3` LEFT JOIN ( SELECT `i0`.`IntKeyId`, `i0`.`Id`, `i0`.`Prop`, `i0`.`NestedOwned_Prop`, `i1`.`Owned1IntKeyId`, `i1`.`Owned1Id`, `i1`.`Id` AS `Id0`, `i1`.`Prop` AS `Prop0` @@ -98,14 +98,14 @@ public override void Find_nullable_int_key_from_store() base.Find_int_key_from_store(); AssertSql( - $""" -@__p_0='77' + """ +@p='77' SELECT `i3`.`Id`, `i3`.`Foo`, `s`.`IntKeyId`, `s`.`Id`, `s`.`Prop`, `s`.`NestedOwned_Prop`, `s`.`Owned1IntKeyId`, `s`.`Owned1Id`, `s`.`Id0`, `s`.`Prop0`, `i3`.`OwnedReference_Prop`, `i3`.`OwnedReference_NestedOwned_Prop`, `i2`.`Owned1IntKeyId`, `i2`.`Id`, `i2`.`Prop` FROM (( SELECT TOP 1 `i`.`Id`, `i`.`Foo`, `i`.`OwnedReference_Prop`, `i`.`OwnedReference_NestedOwned_Prop` FROM `IntKey` AS `i` - WHERE `i`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `i`.`Id` = @p ) AS `i3` LEFT JOIN ( SELECT `i0`.`IntKeyId`, `i0`.`Id`, `i0`.`Prop`, `i0`.`NestedOwned_Prop`, `i1`.`Owned1IntKeyId`, `i1`.`Owned1Id`, `i1`.`Id` AS `Id0`, `i1`.`Prop` AS `Prop0` @@ -122,14 +122,14 @@ public override void Returns_null_for_nullable_int_key_not_in_store() base.Returns_null_for_int_key_not_in_store(); AssertSql( - $""" -@__p_0='99' + """ +@p='99' SELECT `i3`.`Id`, `i3`.`Foo`, `s`.`IntKeyId`, `s`.`Id`, `s`.`Prop`, `s`.`NestedOwned_Prop`, `s`.`Owned1IntKeyId`, `s`.`Owned1Id`, `s`.`Id0`, `s`.`Prop0`, `i3`.`OwnedReference_Prop`, `i3`.`OwnedReference_NestedOwned_Prop`, `i2`.`Owned1IntKeyId`, `i2`.`Id`, `i2`.`Prop` FROM (( SELECT TOP 1 `i`.`Id`, `i`.`Foo`, `i`.`OwnedReference_Prop`, `i`.`OwnedReference_NestedOwned_Prop` FROM `IntKey` AS `i` - WHERE `i`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `i`.`Id` = @p ) AS `i3` LEFT JOIN ( SELECT `i0`.`IntKeyId`, `i0`.`Id`, `i0`.`Prop`, `i0`.`NestedOwned_Prop`, `i1`.`Owned1IntKeyId`, `i1`.`Owned1Id`, `i1`.`Id` AS `Id0`, `i1`.`Prop` AS `Prop0` @@ -153,13 +153,13 @@ public override void Find_string_key_from_store() base.Find_string_key_from_store(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='Cat' (Size = 255)")} - - SELECT TOP 1 `s`.`Id`, `s`.`Foo` - FROM `StringKey` AS `s` - WHERE `s`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} - """); + """ +@p='Cat' (Size = 255) + +SELECT TOP 1 `s`.`Id`, `s`.`Foo` +FROM `StringKey` AS `s` +WHERE `s`.`Id` = @p +"""); } public override void Returns_null_for_string_key_not_in_store() @@ -167,13 +167,13 @@ public override void Returns_null_for_string_key_not_in_store() base.Returns_null_for_string_key_not_in_store(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='Fox' (Size = 255)")} - - SELECT TOP 1 `s`.`Id`, `s`.`Foo` - FROM `StringKey` AS `s` - WHERE `s`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} - """); + """ +@p='Fox' (Size = 255) + +SELECT TOP 1 `s`.`Id`, `s`.`Foo` +FROM `StringKey` AS `s` +WHERE `s`.`Id` = @p +"""); } public override void Find_composite_key_tracked() @@ -188,14 +188,14 @@ public override void Find_composite_key_from_store() base.Find_composite_key_from_store(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='77'")} - {AssertSqlHelper.Declaration("@__p_1='Dog' (Size = 255)")} - - SELECT TOP 1 `c`.`Id1`, `c`.`Id2`, `c`.`Foo` - FROM `CompositeKey` AS `c` - WHERE `c`.`Id1` = {AssertSqlHelper.Parameter("@__p_0")} AND `c`.`Id2` = {AssertSqlHelper.Parameter("@__p_1")} - """); + """ +@p='77' +@p0='Dog' (Size = 255) + +SELECT TOP 1 `c`.`Id1`, `c`.`Id2`, `c`.`Foo` +FROM `CompositeKey` AS `c` +WHERE `c`.`Id1` = @p AND `c`.`Id2` = @p0 +"""); } public override void Returns_null_for_composite_key_not_in_store() @@ -203,14 +203,14 @@ public override void Returns_null_for_composite_key_not_in_store() base.Returns_null_for_composite_key_not_in_store(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='77'")} - {AssertSqlHelper.Declaration("@__p_1='Fox' (Size = 255)")} - - SELECT TOP 1 `c`.`Id1`, `c`.`Id2`, `c`.`Foo` - FROM `CompositeKey` AS `c` - WHERE `c`.`Id1` = {AssertSqlHelper.Parameter("@__p_0")} AND `c`.`Id2` = {AssertSqlHelper.Parameter("@__p_1")} - """); + """ +@p='77' +@p0='Fox' (Size = 255) + +SELECT TOP 1 `c`.`Id1`, `c`.`Id2`, `c`.`Foo` +FROM `CompositeKey` AS `c` +WHERE `c`.`Id1` = @p AND `c`.`Id2` = @p0 +"""); } public override void Find_base_type_tracked() @@ -232,26 +232,26 @@ public override void Find_base_type_from_store() base.Find_base_type_from_store(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='77'")} - - SELECT TOP 1 `b`.`Id`, `b`.`Discriminator`, `b`.`Foo`, `b`.`Boo` - FROM `BaseType` AS `b` - WHERE `b`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} - """); + """ +@p='77' + +SELECT TOP 1 `b`.`Id`, `b`.`Discriminator`, `b`.`Foo`, `b`.`Boo` +FROM `BaseType` AS `b` +WHERE `b`.`Id` = @p +"""); } public override async Task Find_base_type_from_store_async(CancellationType cancellationType) { await base.Find_base_type_from_store_async(cancellationType); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='77'")} - - SELECT TOP 1 `b`.`Id`, `b`.`Discriminator`, `b`.`Foo`, `b`.`Boo` - FROM `BaseType` AS `b` - WHERE `b`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} - """); + """ +@p='77' + +SELECT TOP 1 `b`.`Id`, `b`.`Discriminator`, `b`.`Foo`, `b`.`Boo` +FROM `BaseType` AS `b` +WHERE `b`.`Id` = @p +"""); } public override void Returns_null_for_base_type_not_in_store() @@ -259,13 +259,13 @@ public override void Returns_null_for_base_type_not_in_store() base.Returns_null_for_base_type_not_in_store(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='99'")} - - SELECT TOP 1 `b`.`Id`, `b`.`Discriminator`, `b`.`Foo`, `b`.`Boo` - FROM `BaseType` AS `b` - WHERE `b`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} - """); + """ +@p='99' + +SELECT TOP 1 `b`.`Id`, `b`.`Discriminator`, `b`.`Foo`, `b`.`Boo` +FROM `BaseType` AS `b` +WHERE `b`.`Id` = @p +"""); } public override void Find_derived_type_tracked() @@ -280,13 +280,13 @@ public override void Find_derived_type_from_store() base.Find_derived_type_from_store(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='78'")} - - SELECT TOP 1 `b`.`Id`, `b`.`Discriminator`, `b`.`Foo`, `b`.`Boo` - FROM `BaseType` AS `b` - WHERE `b`.`Discriminator` = 'DerivedType' AND `b`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} - """); + """ +@p='78' + +SELECT TOP 1 `b`.`Id`, `b`.`Discriminator`, `b`.`Foo`, `b`.`Boo` +FROM `BaseType` AS `b` +WHERE `b`.`Discriminator` = 'DerivedType' AND `b`.`Id` = @p +"""); } public override void Returns_null_for_derived_type_not_in_store() @@ -294,13 +294,13 @@ public override void Returns_null_for_derived_type_not_in_store() base.Returns_null_for_derived_type_not_in_store(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='99'")} - - SELECT TOP 1 `b`.`Id`, `b`.`Discriminator`, `b`.`Foo`, `b`.`Boo` - FROM `BaseType` AS `b` - WHERE `b`.`Discriminator` = 'DerivedType' AND `b`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} - """); + """ +@p='99' + +SELECT TOP 1 `b`.`Id`, `b`.`Discriminator`, `b`.`Foo`, `b`.`Boo` +FROM `BaseType` AS `b` +WHERE `b`.`Discriminator` = 'DerivedType' AND `b`.`Id` = @p +"""); } public override void Find_base_type_using_derived_set_tracked() @@ -308,13 +308,13 @@ public override void Find_base_type_using_derived_set_tracked() base.Find_base_type_using_derived_set_tracked(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='88'")} - - SELECT TOP 1 `b`.`Id`, `b`.`Discriminator`, `b`.`Foo`, `b`.`Boo` - FROM `BaseType` AS `b` - WHERE `b`.`Discriminator` = 'DerivedType' AND `b`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} - """); + """ +@p='88' + +SELECT TOP 1 `b`.`Id`, `b`.`Discriminator`, `b`.`Foo`, `b`.`Boo` +FROM `BaseType` AS `b` +WHERE `b`.`Discriminator` = 'DerivedType' AND `b`.`Id` = @p +"""); } public override void Find_base_type_using_derived_set_from_store() @@ -322,13 +322,13 @@ public override void Find_base_type_using_derived_set_from_store() base.Find_base_type_using_derived_set_from_store(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='77'")} - - SELECT TOP 1 `b`.`Id`, `b`.`Discriminator`, `b`.`Foo`, `b`.`Boo` - FROM `BaseType` AS `b` - WHERE `b`.`Discriminator` = 'DerivedType' AND `b`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} - """); + """ +@p='77' + +SELECT TOP 1 `b`.`Id`, `b`.`Discriminator`, `b`.`Foo`, `b`.`Boo` +FROM `BaseType` AS `b` +WHERE `b`.`Discriminator` = 'DerivedType' AND `b`.`Id` = @p +"""); } public override void Find_derived_type_using_base_set_tracked() @@ -343,13 +343,13 @@ public override void Find_derived_using_base_set_type_from_store() base.Find_derived_using_base_set_type_from_store(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='78'")} - - SELECT TOP 1 `b`.`Id`, `b`.`Discriminator`, `b`.`Foo`, `b`.`Boo` - FROM `BaseType` AS `b` - WHERE `b`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} - """); + """ +@p='78' + +SELECT TOP 1 `b`.`Id`, `b`.`Discriminator`, `b`.`Foo`, `b`.`Boo` +FROM `BaseType` AS `b` +WHERE `b`.`Id` = @p +"""); } public override void Find_shadow_key_tracked() @@ -364,13 +364,13 @@ public override void Find_shadow_key_from_store() base.Find_shadow_key_from_store(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='77'")} - - SELECT TOP 1 `s`.`Id`, `s`.`Foo` - FROM `ShadowKey` AS `s` - WHERE `s`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} - """); + """ +@p='77' + +SELECT TOP 1 `s`.`Id`, `s`.`Foo` +FROM `ShadowKey` AS `s` +WHERE `s`.`Id` = @p +"""); } public override void Returns_null_for_shadow_key_not_in_store() @@ -378,13 +378,13 @@ public override void Returns_null_for_shadow_key_not_in_store() base.Returns_null_for_shadow_key_not_in_store(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='99'")} - - SELECT TOP 1 `s`.`Id`, `s`.`Foo` - FROM `ShadowKey` AS `s` - WHERE `s`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} - """); + """ +@p='99' + +SELECT TOP 1 `s`.`Id`, `s`.`Foo` +FROM `ShadowKey` AS `s` +WHERE `s`.`Id` = @p +"""); } private string Sql => Fixture.TestSqlLoggerFactory.Sql; diff --git a/test/EFCore.Jet.FunctionalTests/JetConfigPatternsTest.cs b/test/EFCore.Jet.FunctionalTests/JetConfigPatternsTest.cs index 236c0cf7..4259880c 100644 --- a/test/EFCore.Jet.FunctionalTests/JetConfigPatternsTest.cs +++ b/test/EFCore.Jet.FunctionalTests/JetConfigPatternsTest.cs @@ -25,9 +25,9 @@ public class ImplicitServicesAndConfig [ConditionalFact] public async Task Can_query_with_implicit_services_and_OnConfiguring() { - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { - using var context = new NorthwindContext(); + await using var context = new NorthwindContext(); Assert.Equal(91, await context.Customers.CountAsync()); } } @@ -54,7 +54,7 @@ public class ImplicitServicesExplicitConfig [ConditionalFact] public async Task Can_query_with_implicit_services_and_explicit_config() { - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { await using var context = new NorthwindContext( new DbContextOptionsBuilder() @@ -80,8 +80,8 @@ public class ExplicitServicesImplicitConfig [ConditionalFact] public async Task Can_query_with_explicit_services_and_OnConfiguring() { - using var async = await JetTestStore.GetNorthwindStoreAsync(); - using var context = new NorthwindContext( + await using var async = await JetTestStore.GetNorthwindStoreAsync(); + await using var context = new NorthwindContext( new DbContextOptionsBuilder().UseInternalServiceProvider( new ServiceCollection() .AddEntityFrameworkJet() @@ -107,9 +107,9 @@ public class ExplicitServicesAndConfig [ConditionalFact] public async Task Can_query_with_explicit_services_and_explicit_config() { - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { - using var context = new NorthwindContext( + await using var context = new NorthwindContext( new DbContextOptionsBuilder() .UseJet(JetNorthwindTestStoreFactory.NorthwindConnectionString, TestEnvironment.DataAccessProviderFactory, b => b.ApplyConfiguration()) .UseInternalServiceProvider( @@ -134,7 +134,7 @@ public class ExplicitServicesAndNoConfig [ConditionalFact] public async Task Throws_on_attempt_to_use_SQL_Server_without_providing_connection_string() { - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { Assert.Equal( CoreStrings.NoProviderConfigured, @@ -165,7 +165,7 @@ public class NoServicesAndNoConfig [ConditionalFact] public async Task Throws_on_attempt_to_use_context_with_no_store() { - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { Assert.Equal( CoreStrings.NoProviderConfigured, @@ -199,7 +199,7 @@ public async Task Throws_on_attempt_to_use_store_with_no_store_services() new EntityFrameworkServicesBuilder(serviceCollection).TryAddCoreServices(); var serviceProvider = serviceCollection.BuildServiceProvider(validateScopes: true); - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { Assert.Equal( CoreStrings.NoProviderConfigured, @@ -238,7 +238,7 @@ public async Task Can_register_context_with_DI_container_and_have_it_injected() .AddSingleton(p => new DbContextOptionsBuilder().UseInternalServiceProvider(p).Options) .BuildServiceProvider(validateScopes: true); - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { await serviceProvider.GetRequiredService().TestAsync(); } @@ -292,7 +292,7 @@ public async Task Can_register_context_and_configuration_with_DI_container_and_h .UseJet(JetNorthwindTestStoreFactory.NorthwindConnectionString, TestEnvironment.DataAccessProviderFactory, b => b.ApplyConfiguration()) .Options).BuildServiceProvider(); - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { await serviceProvider.GetRequiredService().TestAsync(); } @@ -333,9 +333,9 @@ public class ConstructorArgsToBuilder [ConditionalFact] public async Task Can_pass_context_options_to_constructor_and_use_in_builder() { - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { - using var context = new NorthwindContext( + await using var context = new NorthwindContext( new DbContextOptionsBuilder() .EnableServiceProviderCaching(false) .UseJet(JetNorthwindTestStoreFactory.NorthwindConnectionString, TestEnvironment.DataAccessProviderFactory, b => b.ApplyConfiguration()) @@ -358,9 +358,9 @@ public class ConstructorArgsToOnConfiguring [ConditionalFact] public async Task Can_pass_connection_string_to_constructor_and_use_in_OnConfiguring() { - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { - using var context = new NorthwindContext(JetNorthwindTestStoreFactory.NorthwindConnectionString); + await using var context = new NorthwindContext(JetNorthwindTestStoreFactory.NorthwindConnectionString); Assert.Equal(91, await context.Customers.CountAsync()); } } @@ -384,7 +384,7 @@ public class NestedContext [ConditionalFact] public async Task Can_use_one_context_nested_inside_another_of_the_same_type() { - using (await JetTestStore.GetNorthwindStoreAsync()) + await using (await JetTestStore.GetNorthwindStoreAsync()) { var serviceProvider = new ServiceCollection() .AddEntityFrameworkJet() diff --git a/test/EFCore.Jet.FunctionalTests/JetDatabaseCreatorTest.cs b/test/EFCore.Jet.FunctionalTests/JetDatabaseCreatorTest.cs index 348ee6ea..a0d45537 100644 --- a/test/EFCore.Jet.FunctionalTests/JetDatabaseCreatorTest.cs +++ b/test/EFCore.Jet.FunctionalTests/JetDatabaseCreatorTest.cs @@ -53,7 +53,7 @@ public Task Returns_false_when_database_with_filename_does_not_exist(bool async, private static async Task Returns_false_when_database_does_not_exist_test( bool async, bool ambientTransaction, bool useCanConnect) { - using var testDatabase = JetTestStore.Create("NonExisting"); + await using var testDatabase = JetTestStore.Create("NonExisting"); using var context = new BloggingContext(testDatabase); var creator = GetDatabaseCreator(context); @@ -98,9 +98,9 @@ public Task Returns_true_when_database_with_filename_exists(bool async, bool amb private static async Task Returns_true_when_database_exists_test(bool async, bool ambientTransaction, bool useCanConnect) { - using var testDatabase = + await using var testDatabase = await JetTestStore.CreateInitializedAsync("ExistingBloggingFile"); - using var context = new BloggingContext(testDatabase); + await using var context = new BloggingContext(testDatabase); var creator = GetDatabaseCreator(context); await context.Database.CreateExecutionStrategy().ExecuteAsync( @@ -148,7 +148,7 @@ public Task Deletes_database_with_filename(bool async, bool open, bool ambientTr private static async Task Delete_database_test(bool async, bool open, bool ambientTransaction) { - using var testDatabase = await JetTestStore.CreateInitializedAsync("EnsureDeleteBloggingFile"); + await using var testDatabase = await JetTestStore.CreateInitializedAsync("EnsureDeleteBloggingFile"); if (!open) { testDatabase.CloseConnection(); @@ -200,7 +200,7 @@ public Task Noop_when_database_with_filename_does_not_exist(bool async) private static async Task Noop_when_database_does_not_exist_test(bool async) { - using var testDatabase = JetTestStore.Create("NonExisting"); + await using var testDatabase = JetTestStore.Create("NonExisting"); using var context = new BloggingContext(testDatabase); var creator = GetDatabaseCreator(context); @@ -272,7 +272,7 @@ private static async Task Creates_physical_database_and_schema_test( (bool CreateDatabase, bool Async, bool ambientTransaction) options) { var (createDatabase, async, ambientTransaction) = options; - using var testDatabase = JetTestStore.Create("EnsureCreatedTestFile"); + await using var testDatabase = JetTestStore.Create("EnsureCreatedTestFile"); using var context = new BloggingContext(testDatabase); if (createDatabase) { @@ -358,7 +358,7 @@ public Task Noop_when_database_with_filename_exists_and_has_schema(bool async) private static async Task Noop_when_database_exists_and_has_schema_test(bool async) { - using var testDatabase = await JetTestStore.CreateInitializedAsync("InitializedBloggingFile"); + await using var testDatabase = await JetTestStore.CreateInitializedAsync("InitializedBloggingFile"); using var context = new BloggingContext(testDatabase); context.Database.EnsureCreatedResiliently(); @@ -383,7 +383,7 @@ public class JetDatabaseCreatorHasTablesTest : JetDatabaseCreatorTest [InlineData(false)] public async Task Throws_when_database_does_not_exist(bool async) { - using var testDatabase = JetTestStore.GetOrCreate("NonExisting"); + await using var testDatabase = JetTestStore.GetOrCreate("NonExisting"); var databaseCreator = GetDatabaseCreator(testDatabase); await databaseCreator.ExecutionStrategy.ExecuteAsync( databaseCreator, @@ -404,7 +404,7 @@ await databaseCreator.ExecutionStrategy.ExecuteAsync( [InlineData(false, false)] public async Task Returns_false_when_database_exists_but_has_no_tables(bool async, bool ambientTransaction) { - using var testDatabase = await JetTestStore.GetOrCreateInitializedAsync("Empty"); + await using var testDatabase = await JetTestStore.GetOrCreateInitializedAsync("Empty"); var creator = GetDatabaseCreator(testDatabase); await GetExecutionStrategy(testDatabase).ExecuteAsync( @@ -424,7 +424,7 @@ await GetExecutionStrategy(testDatabase).ExecuteAsync( [InlineData(false, false)] public async Task Returns_true_when_database_exists_and_has_any_tables(bool async, bool ambientTransaction) { - using var testDatabase = await JetTestStore.GetOrCreate("ExistingTables") + await using var testDatabase = await JetTestStore.GetOrCreate("ExistingTables") .InitializeJetAsync(null, t => new BloggingContext(t), null); var creator = GetDatabaseCreator(testDatabase); @@ -447,7 +447,7 @@ public class JetDatabaseCreatorDeleteTest : JetDatabaseCreatorTest [InlineData(false, false)] public static async Task Deletes_database(bool async, bool ambientTransaction) { - using var testDatabase = await JetTestStore.CreateInitializedAsync("DeleteBlogging"); + await using var testDatabase = await JetTestStore.CreateInitializedAsync("DeleteBlogging"); testDatabase.CloseConnection(); var creator = GetDatabaseCreator(testDatabase); @@ -474,7 +474,7 @@ public static async Task Deletes_database(bool async, bool ambientTransaction) [InlineData(false)] public async Task Throws_when_database_does_not_exist(bool async) { - using var testDatabase = JetTestStore.GetOrCreate("NonExistingBlogging"); + await using var testDatabase = JetTestStore.GetOrCreate("NonExistingBlogging"); var creator = GetDatabaseCreator(testDatabase); if (async) @@ -496,7 +496,7 @@ public class JetDatabaseCreatorCreateTablesTest : JetDatabaseCreatorTest [InlineData(false, false)] public async Task Creates_schema_in_existing_database_test(bool async, bool ambientTransaction) { - using var testDatabase = await JetTestStore.GetOrCreateInitializedAsync("ExistingBlogging" + (async ? "Async" : "")); + await using var testDatabase = await JetTestStore.GetOrCreateInitializedAsync("ExistingBlogging" + (async ? "Async" : "")); using var context = new BloggingContext(testDatabase); var creator = GetDatabaseCreator(context); @@ -546,7 +546,7 @@ public async Task Creates_schema_in_existing_database_test(bool async, bool ambi [InlineData(false)] public async Task Throws_if_database_does_not_exist(bool async) { - using var testDatabase = JetTestStore.GetOrCreate("NonExisting"); + await using var testDatabase = JetTestStore.GetOrCreate("NonExisting"); var creator = GetDatabaseCreator(testDatabase); var exception = async ? await Record.ExceptionAsync(() => creator.CreateTablesAsync()) @@ -622,7 +622,7 @@ public class JetDatabaseCreatorCreateTest : JetDatabaseCreatorTest [InlineData(false, true)] public async Task Creates_physical_database_but_not_tables(bool async, bool ambientTransaction) { - using var testDatabase = JetTestStore.GetOrCreate("CreateTest"); + await using var testDatabase = JetTestStore.GetOrCreate("CreateTest"); var creator = GetDatabaseCreator(testDatabase); creator.EnsureDeleted(); @@ -660,7 +660,7 @@ await GetExecutionStrategy(testDatabase).ExecuteAsync( [InlineData(false)] public async Task Throws_if_database_already_exists(bool async) { - using var testDatabase = await JetTestStore.GetOrCreateInitializedAsync("ExistingBlogging"); + await using var testDatabase = await JetTestStore.GetOrCreateInitializedAsync("ExistingBlogging"); var creator = GetDatabaseCreator(testDatabase); var ex = async diff --git a/test/EFCore.Jet.FunctionalTests/JetEndToEndTest.cs b/test/EFCore.Jet.FunctionalTests/JetEndToEndTest.cs index cab67d5c..15ad17b7 100644 --- a/test/EFCore.Jet.FunctionalTests/JetEndToEndTest.cs +++ b/test/EFCore.Jet.FunctionalTests/JetEndToEndTest.cs @@ -40,7 +40,7 @@ public JetEndToEndTest(JetFixture fixture) [ConditionalFact] public async Task Can_use_decimal_and_byte_as_identity_columns() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var nownNum1 = new NownNum { Id = 77.0m, TheWalrus = "Crying" }; var nownNum2 = new NownNum { Id = 78.0m, TheWalrus = "Walrus" }; @@ -227,7 +227,7 @@ private class ByteAdNum [ConditionalFact] // Issue #29931 public async Task Can_use_SqlQuery_when_context_has_DbFunction() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var options = Fixture.CreateOptions(testDatabase); using var context = new DbFunctionContext(options); var result = context.Database @@ -265,7 +265,7 @@ private class RawResult [ConditionalFact] public async Task Can_use_string_enum_or_byte_array_as_key() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var sNum1 = new SNum { TheWalrus = "I" }; var sNum2 = new SNum { TheWalrus = "Am" }; @@ -276,7 +276,7 @@ public async Task Can_use_string_enum_or_byte_array_as_key() var bNum2 = new BNum { TheWalrus = "Eggmen" }; var options = Fixture.CreateOptions(testDatabase); - using (var context = new ENumContext(options)) + await using (var context = new ENumContext(options)) { context.Database.EnsureCreatedResiliently(); @@ -285,7 +285,7 @@ public async Task Can_use_string_enum_or_byte_array_as_key() context.SaveChanges(); } - using (var context = new ENumContext(options)) + await using (var context = new ENumContext(options)) { Assert.Equal(sNum1.Id, context.SNums.Single(e => e.TheWalrus == "I").Id); Assert.Equal(sNum2.Id, context.SNums.Single(e => e.TheWalrus == "Am").Id); @@ -301,12 +301,12 @@ public async Task Can_use_string_enum_or_byte_array_as_key() [ConditionalFact] public async Task Can_remove_multiple_byte_array_as_key() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var bNum1 = new BNum { TheWalrus = "Eggman" }; var bNum2 = new BNum { TheWalrus = "Eggmen" }; var options = Fixture.CreateOptions(testDatabase); - using (var context = new ENumContext(options)) + await using (var context = new ENumContext(options)) { context.Database.EnsureCreatedResiliently(); @@ -315,7 +315,7 @@ public async Task Can_remove_multiple_byte_array_as_key() context.SaveChanges(); } - using (var context = new ENumContext(options)) + await using (var context = new ENumContext(options)) { Assert.Equal(bNum1.Id, context.BNums.Single(e => e.TheWalrus == "Eggman").Id); Assert.Equal(bNum2.Id, context.BNums.Single(e => e.TheWalrus == "Eggmen").Id); @@ -336,11 +336,11 @@ private class ENumContext(DbContextOptions options) : DbContext(options) [ConditionalFact] public async Task Can_add_table_splitting_dependent_after_principal() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var options = Fixture.CreateOptions(testDatabase); EvaluationAction evaluationAction = null; - using (var context = new ProjectContext(options)) + await using (var context = new ProjectContext(options)) { context.Database.EnsureCreatedResiliently(); @@ -354,7 +354,7 @@ public async Task Can_add_table_splitting_dependent_after_principal() context.SaveChanges(); } - using (var context = new ProjectContext(options)) + await using (var context = new ProjectContext(options)) { context.Database.EnsureCreatedResiliently(); @@ -369,7 +369,7 @@ public async Task Can_add_table_splitting_dependent_after_principal() context.SaveChanges(); } - using (var context = new ProjectContext(options)) + await using (var context = new ProjectContext(options)) { Assert.NotNull(context.ProjectActions.Single()); Assert.NotNull(context.EvaluationActions.Single()); @@ -379,7 +379,7 @@ public async Task Can_add_table_splitting_dependent_after_principal() [ConditionalFact] public async Task Throws_when_adding_table_splitting_dependent_without_principal() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var options = Fixture.CreateOptions(testDatabase); using var context = new ProjectContext(options); @@ -469,7 +469,7 @@ private class BNum [ConditionalFact] public async Task Can_add_and_remove_entities_with_keys_of_different_type() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var options = Fixture.CreateOptions(testDatabase); using (var context = new CompositeKeysDbContext(options)) @@ -521,7 +521,7 @@ private class Int64CompositeKeys [ConditionalFact] public async Task Can_insert_non_owner_principal_for_owned() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var options = Fixture.CreateOptions(testDatabase); using var context = new FileContext(options); @@ -581,7 +581,7 @@ private sealed class FileSource [ConditionalFact] public async Task Can_insert_TPT_dependents_with_identity() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var options = Fixture.CreateOptions(testDatabase); using var context = new CarContext(options); @@ -617,7 +617,7 @@ private class Ferrari : Car [ConditionalFact] public async Task Can_run_linq_query_on_entity_set() { - using var testStore = await JetTestStore.GetNorthwindStoreAsync(); + await using var testStore = await JetTestStore.GetNorthwindStoreAsync(); using var db = new NorthwindContext(Fixture.CreateOptions(testStore)); var results = db.Customers .Where(c => c.CompanyName.StartsWith("A")) @@ -639,7 +639,7 @@ public async Task Can_run_linq_query_on_entity_set() [ConditionalFact] public async Task Can_run_linq_query_on_entity_set_with_value_buffer_reader() { - using var testStore = await JetTestStore.GetNorthwindStoreAsync(); + await using var testStore = await JetTestStore.GetNorthwindStoreAsync(); using var db = new NorthwindContext(Fixture.CreateOptions(testStore)); var results = db.Customers .Where(c => c.CompanyName.StartsWith("A")) @@ -661,8 +661,8 @@ public async Task Can_run_linq_query_on_entity_set_with_value_buffer_reader() [ConditionalFact] public async Task Can_enumerate_entity_set() { - using var testStore = await JetTestStore.GetNorthwindStoreAsync(); - using var db = new NorthwindContext(Fixture.CreateOptions(testStore)); + await using var testStore = await JetTestStore.GetNorthwindStoreAsync(); + await using var db = new NorthwindContext(Fixture.CreateOptions(testStore)); var results = new List(); foreach (var item in db.Customers) { @@ -677,7 +677,7 @@ public async Task Can_enumerate_entity_set() [ConditionalFact] public async Task Can_save_changes() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var options = Fixture.CreateOptions(testDatabase); using (var db = new BloggingContext(options)) { @@ -750,7 +750,7 @@ public async Task Can_save_changes() [ConditionalFact] public async Task Can_save_changes_in_tracked_entities() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); int updatedId; int deletedId; int addedId; @@ -807,7 +807,7 @@ public async Task Can_save_changes_in_tracked_entities() [ConditionalFact] public async Task Can_track_an_entity_with_more_than_10_properties() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var options = Fixture.CreateOptions(testDatabase); using (var context = new GameDbContext(options)) { @@ -836,7 +836,7 @@ public async Task Can_track_an_entity_with_more_than_10_properties() [ConditionalFact] public async Task Can_replace_identifying_FK_entity_with_many_to_many() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var options = Fixture.CreateOptions(testDatabase); using (var context = new SomeDbContext(options)) @@ -939,7 +939,7 @@ public async Task Can_insert_entities_with_generated_PKs(int studentCount, int c new() { Title = "Literature", Credits = 4 } }; - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var options = Fixture.CreateOptions(testDatabase); var nextCourse = 0; @@ -1193,7 +1193,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) [ConditionalFact] public async Task Adding_an_item_to_a_collection_marks_it_as_modified() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var options = Fixture.CreateOptions(testDatabase); using var context = new GameDbContext(options); @@ -1218,7 +1218,7 @@ public async Task Adding_an_item_to_a_collection_marks_it_as_modified() [ConditionalFact] public async Task Can_set_reference_twice() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var options = Fixture.CreateOptions(testDatabase); using (var context = new GameDbContext(options)) @@ -1258,7 +1258,7 @@ public async Task Can_set_reference_twice() [ConditionalFact] public async Task Can_include_on_loaded_entity() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var options = Fixture.CreateOptions(testDatabase); using (var context = new GameDbContext(options)) @@ -1486,8 +1486,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) [ConditionalFact] public async Task Tracking_entities_asynchronously_returns_tracked_entities_back() { - using var testStore = await JetTestStore.GetNorthwindStoreAsync(); - using var db = new NorthwindContext(Fixture.CreateOptions(testStore)); + await using var testStore = await JetTestStore.GetNorthwindStoreAsync(); + await using var db = new NorthwindContext(Fixture.CreateOptions(testStore)); var customer = await db.Customers.OrderBy(c => c.CustomerID).FirstOrDefaultAsync(); var trackedCustomerEntry = db.ChangeTracker.Entries().Single(); @@ -1500,14 +1500,14 @@ public async Task Tracking_entities_asynchronously_returns_tracked_entities_back [ConditionalFact(Skip = "Jet does not support Schema")] // Issue #931 public async Task Can_save_and_query_with_schema() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); var options = Fixture.CreateOptions(testStore); await testStore.ExecuteNonQueryAsync("CREATE SCHEMA Apple"); await testStore.ExecuteNonQueryAsync("CREATE TABLE Apple.Jack (MyKey int)"); await testStore.ExecuteNonQueryAsync("CREATE TABLE Apple.Black (MyKey int)"); - using (var context = new SchemaContext(options)) + await using (var context = new SchemaContext(options)) { await context.AddAsync( new Jack { MyKey = 1 }); @@ -1516,7 +1516,7 @@ await context.AddAsync( context.SaveChanges(); } - using (var context = new SchemaContext(options)) + await using (var context = new SchemaContext(options)) { Assert.Equal(1, context.Jacks.Count()); Assert.Equal(1, context.Blacks.Count()); @@ -1567,7 +1567,7 @@ public Task Can_round_trip_changes_with_changed_only_notification_entities() private async Task RoundTripChanges() where TBlog : class, IBlog, new() { - using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testDatabase = await JetTestStore.CreateInitializedAsync(DatabaseName); var options = Fixture.CreateOptions(testDatabase); int blog1Id; diff --git a/test/EFCore.Jet.FunctionalTests/JetValueGenerationScenariosTestBase.cs b/test/EFCore.Jet.FunctionalTests/JetValueGenerationScenariosTestBase.cs index ff07708e..6ce57f42 100644 --- a/test/EFCore.Jet.FunctionalTests/JetValueGenerationScenariosTestBase.cs +++ b/test/EFCore.Jet.FunctionalTests/JetValueGenerationScenariosTestBase.cs @@ -44,8 +44,8 @@ public abstract class JetValueGenerationScenariosTestBase [ConditionalFact] public async Task Insert_with_Identity_column() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using (var context = new BlogContextIdentity(testStore.Name, OnModelCreating)) + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using (var context = new BlogContextIdentity(testStore.Name, OnModelCreating)) { context.Database.EnsureCreatedResiliently(); @@ -54,7 +54,7 @@ public async Task Insert_with_Identity_column() context.SaveChanges(); } - using (var context = new BlogContextIdentity(testStore.Name, OnModelCreating)) + await using (var context = new BlogContextIdentity(testStore.Name, OnModelCreating)) { var blogs = context.Blogs.OrderBy(e => e.Id).ToList(); @@ -68,8 +68,8 @@ public class BlogContextIdentity(string databaseName, Action model [ConditionalFact] public async Task Insert_with_default_value_from_sequence() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using (var context = new BlogContextDefaultValue(testStore.Name, OnModelCreating)) + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using (var context = new BlogContextDefaultValue(testStore.Name, OnModelCreating)) { context.Database.EnsureCreatedResiliently(); @@ -78,7 +78,7 @@ public async Task Insert_with_default_value_from_sequence() context.SaveChanges(); } - using (var context = new BlogContextDefaultValue(testStore.Name, OnModelCreating)) + await using (var context = new BlogContextDefaultValue(testStore.Name, OnModelCreating)) { var blogs = context.Blogs.OrderBy(e => e.Id).ToList(); @@ -86,14 +86,14 @@ public async Task Insert_with_default_value_from_sequence() Assert.Equal(1, blogs[1].Id); } - using (var context = new BlogContextDefaultValueNoMigrations(testStore.Name, OnModelCreating)) + await using (var context = new BlogContextDefaultValueNoMigrations(testStore.Name, OnModelCreating)) { context.AddRange(CreateBlog("One Unicorn"), CreateBlog("Two Unicorns")); context.SaveChanges(); } - using (var context = new BlogContextDefaultValueNoMigrations(testStore.Name, OnModelCreating)) + await using (var context = new BlogContextDefaultValueNoMigrations(testStore.Name, OnModelCreating)) { var blogs = context.Blogs.OrderBy(e => e.Id).ToList(); @@ -138,8 +138,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) [ConditionalFact] public async Task Insert_with_default_string_value_from_sequence() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using (var context = new BlogContextStringDefaultValue(testStore.Name, OnModelCreating, StringSentinel)) + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using (var context = new BlogContextStringDefaultValue(testStore.Name, OnModelCreating, StringSentinel)) { context.Database.EnsureCreatedResiliently(); @@ -150,7 +150,7 @@ public async Task Insert_with_default_string_value_from_sequence() context.SaveChanges(); } - using (var context = new BlogContextStringDefaultValue(testStore.Name, OnModelCreating, StringSentinel)) + await using (var context = new BlogContextStringDefaultValue(testStore.Name, OnModelCreating, StringSentinel)) { var blogs = context.StringyBlogs.OrderBy(e => e.Id).ToList(); @@ -191,8 +191,8 @@ public class BlogWithStringKey [ConditionalFact] public async Task Insert_with_key_default_value_from_sequence() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using (var context = new BlogContextKeyColumnWithDefaultValue(testStore.Name, OnModelCreating)) + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using (var context = new BlogContextKeyColumnWithDefaultValue(testStore.Name, OnModelCreating)) { context.Database.EnsureCreatedResiliently(); @@ -201,7 +201,7 @@ public async Task Insert_with_key_default_value_from_sequence() context.SaveChanges(); } - using (var context = new BlogContextKeyColumnWithDefaultValue(testStore.Name, OnModelCreating)) + await using (var context = new BlogContextKeyColumnWithDefaultValue(testStore.Name, OnModelCreating)) { var blogs = context.Blogs.OrderBy(e => e.Id).ToList(); @@ -232,8 +232,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) [ConditionalFact] public async Task Insert_uint_to_Identity_column_using_value_converter() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using (var context = new BlogContextUIntToIdentityUsingValueConverter(testStore.Name, OnModelCreating, UIntSentinel)) + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using (var context = new BlogContextUIntToIdentityUsingValueConverter(testStore.Name, OnModelCreating, UIntSentinel)) { context.Database.EnsureCreatedResiliently(); @@ -244,7 +244,7 @@ public async Task Insert_uint_to_Identity_column_using_value_converter() context.SaveChanges(); } - using (var context = new BlogContextUIntToIdentityUsingValueConverter(testStore.Name, OnModelCreating, UIntSentinel)) + await using (var context = new BlogContextUIntToIdentityUsingValueConverter(testStore.Name, OnModelCreating, UIntSentinel)) { var blogs = context.UnsignedBlogs.OrderBy(e => e.Id).ToList(); @@ -281,7 +281,7 @@ public class BlogWithUIntKey [ConditionalFact] public async Task Insert_int_enum_to_Identity_column() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); using (var context = new BlogContextIntEnumToIdentity(testStore.Name, OnModelCreating, IntKeySentinel)) { context.Database.EnsureCreatedResiliently(); @@ -337,8 +337,8 @@ public enum IntKey [ConditionalFact] public async Task Insert_ulong_enum_to_Identity_column() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using (var context = new BlogContextULongEnumToIdentity(testStore.Name, OnModelCreating, ULongKeySentinel)) + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using (var context = new BlogContextULongEnumToIdentity(testStore.Name, OnModelCreating, ULongKeySentinel)) { context.Database.EnsureCreatedResiliently(); @@ -349,7 +349,7 @@ public async Task Insert_ulong_enum_to_Identity_column() context.SaveChanges(); } - using (var context = new BlogContextULongEnumToIdentity(testStore.Name, OnModelCreating, ULongKeySentinel)) + await using (var context = new BlogContextULongEnumToIdentity(testStore.Name, OnModelCreating, ULongKeySentinel)) { var blogs = context.EnumBlogs.OrderBy(e => e.Id).ToList(); @@ -392,8 +392,8 @@ public enum ULongKey : ulong [ConditionalFact] public async Task Insert_string_to_Identity_column_using_value_converter() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using (var context = new BlogContextStringToIdentityUsingValueConverter(testStore.Name, OnModelCreating, StringSentinel)) + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using (var context = new BlogContextStringToIdentityUsingValueConverter(testStore.Name, OnModelCreating, StringSentinel)) { context.Database.EnsureCreatedResiliently(); @@ -404,7 +404,7 @@ public async Task Insert_string_to_Identity_column_using_value_converter() context.SaveChanges(); } - using (var context = new BlogContextStringToIdentityUsingValueConverter(testStore.Name, OnModelCreating, StringSentinel)) + await using (var context = new BlogContextStringToIdentityUsingValueConverter(testStore.Name, OnModelCreating, StringSentinel)) { var blogs = context.StringyBlogs.OrderBy(e => e.Id).ToList(); @@ -442,8 +442,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) [ConditionalFact] public async Task Insert_with_explicit_non_default_keys() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using (var context = new BlogContextNoKeyGeneration(testStore.Name, OnModelCreating)) + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using (var context = new BlogContextNoKeyGeneration(testStore.Name, OnModelCreating)) { context.Database.EnsureCreatedResiliently(); @@ -453,7 +453,7 @@ public async Task Insert_with_explicit_non_default_keys() context.SaveChanges(); } - using (var context = new BlogContextNoKeyGeneration(testStore.Name, OnModelCreating)) + await using (var context = new BlogContextNoKeyGeneration(testStore.Name, OnModelCreating)) { var blogs = context.Blogs.OrderBy(e => e.Id).ToList(); @@ -479,8 +479,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) [ConditionalFact] public async Task Insert_with_explicit_with_default_keys() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using (var context = new BlogContextNoKeyGenerationNullableKey(testStore.Name, OnModelCreating, NullableIntSentinel)) + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using (var context = new BlogContextNoKeyGenerationNullableKey(testStore.Name, OnModelCreating, NullableIntSentinel)) { context.Database.EnsureCreatedResiliently(); @@ -491,7 +491,7 @@ public async Task Insert_with_explicit_with_default_keys() context.SaveChanges(); } - using (var context = new BlogContextNoKeyGenerationNullableKey(testStore.Name, OnModelCreating, NullableIntSentinel)) + await using (var context = new BlogContextNoKeyGenerationNullableKey(testStore.Name, OnModelCreating, NullableIntSentinel)) { var blogs = context.NullableKeyBlogs.OrderBy(e => e.Id).ToList(); @@ -520,9 +520,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) [ConditionalFact] public async Task Insert_with_non_key_default_value() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using (var context = new BlogContextNonKeyDefaultValue(testStore.Name, OnModelCreating)) + await using (var context = new BlogContextNonKeyDefaultValue(testStore.Name, OnModelCreating)) { context.Database.EnsureCreatedResiliently(); @@ -553,7 +553,7 @@ public async Task Insert_with_non_key_default_value() Assert.Equal(111, blogs[1].NeedsConverter.Value); } - using (var context = new BlogContextNonKeyDefaultValue(testStore.Name, OnModelCreating)) + await using (var context = new BlogContextNonKeyDefaultValue(testStore.Name, OnModelCreating)) { var blogs = context.Blogs.OrderBy(e => e.Name).ToList(); Assert.Equal(3, blogs.Count); @@ -573,7 +573,7 @@ public async Task Insert_with_non_key_default_value() context.SaveChanges(); } - using (var context = new BlogContextNonKeyDefaultValue(testStore.Name, OnModelCreating)) + await using (var context = new BlogContextNonKeyDefaultValue(testStore.Name, OnModelCreating)) { var blogs = context.Blogs.OrderBy(e => e.Name).ToList(); Assert.Equal(3, blogs.Count); @@ -706,8 +706,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) [ConditionalFact] public async Task Insert_with_non_key_default_value_readonly() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using (var context = new BlogContextNonKeyReadOnlyDefaultValue(testStore.Name, OnModelCreating, IntSentinel, DateTimeSentinel)) + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using (var context = new BlogContextNonKeyReadOnlyDefaultValue(testStore.Name, OnModelCreating, IntSentinel, DateTimeSentinel)) { context.Database.EnsureCreatedResiliently(); @@ -783,7 +783,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) [ConditionalFact] public async Task Insert_and_update_with_computed_column() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); using (var context = new BlogContextComputedColumn(testStore.Name, OnModelCreating, IntSentinel, StringSentinel)) { context.Database.EnsureCreatedResiliently(); @@ -1029,9 +1029,9 @@ RETURN @FullName [ConditionalFact] public async Task Insert_with_client_generated_GUID_key() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); Guid afterSave; - using (var context = new BlogContextClientGuidKey(testStore.Name, OnModelCreating, GuidSentinel)) + await using (var context = new BlogContextClientGuidKey(testStore.Name, OnModelCreating, GuidSentinel)) { context.Database.EnsureCreatedResiliently(); @@ -1058,7 +1058,7 @@ public async Task Insert_with_client_generated_GUID_key() Assert.Equal(beforeSaveNotId, afterSaveNotId); } - using (var context = new BlogContextClientGuidKey(testStore.Name, OnModelCreating, GuidSentinel)) + await using (var context = new BlogContextClientGuidKey(testStore.Name, OnModelCreating, GuidSentinel)) { Assert.Equal(afterSave, context.GuidBlogs.Single().Id); } @@ -1086,8 +1086,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) [ConditionalFact] public async Task Insert_with_ValueGeneratedOnAdd_GUID_nonkey_property_throws() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using var context = new BlogContextClientGuidNonKey(testStore.Name, OnModelCreating, GuidSentinel); + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var context = new BlogContextClientGuidNonKey(testStore.Name, OnModelCreating, GuidSentinel); context.Database.EnsureCreatedResiliently(); var blog = context.Add( @@ -1126,9 +1126,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) [ConditionalFact(Skip = "Jet can't return server generated guid's when it is the key. Currently using client geerated guid's")] public async Task Insert_with_server_generated_GUID_key() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); Guid afterSave; - using (var context = new BlogContextServerGuidKey(testStore.Name, OnModelCreating, GuidSentinel)) + await using (var context = new BlogContextServerGuidKey(testStore.Name, OnModelCreating, GuidSentinel)) { context.Database.EnsureCreatedResiliently(); @@ -1186,8 +1186,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) [ConditionalFact] public async Task Insert_with_explicit_non_default_keys_by_default() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using var context = new BlogContext(testStore.Name, OnModelCreating); + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var context = new BlogContext(testStore.Name, OnModelCreating); context.Database.EnsureCreatedResiliently(); context.AddRange( @@ -1203,8 +1203,8 @@ public async Task Insert_with_explicit_non_default_keys_by_default() [ConditionalFact] public async Task Insert_with_explicit_default_keys() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using var context = new BlogContext(testStore.Name, OnModelCreating); + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var context = new BlogContext(testStore.Name, OnModelCreating); context.Database.EnsureCreatedResiliently(); context.AddRange( @@ -1223,8 +1223,8 @@ public class BlogContext(string databaseName, Action modelBuilder) [ConditionalFact] public async Task Insert_with_implicit_default_keys() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using (var context = new BlogContextSpecifyKeysUsingDefault(testStore.Name, OnModelCreating, IntSentinel)) + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using (var context = new BlogContextSpecifyKeysUsingDefault(testStore.Name, OnModelCreating, IntSentinel)) { context.Database.EnsureCreatedResiliently(); @@ -1234,7 +1234,7 @@ public async Task Insert_with_implicit_default_keys() context.SaveChanges(); } - using (var context = new BlogContextSpecifyKeysUsingDefault(testStore.Name, OnModelCreating, IntSentinel)) + await using (var context = new BlogContextSpecifyKeysUsingDefault(testStore.Name, OnModelCreating, IntSentinel)) { var blogs = context.Blogs.OrderBy(e => e.Id).ToList(); @@ -1263,8 +1263,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) [ConditionalFact] public async Task Insert_explicit_value_throws_when_readonly_sequence_before_save() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using var context = new BlogContextReadOnlySequenceKeyColumnWithDefaultValue(testStore.Name, OnModelCreating, IntSentinel); + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var context = new BlogContextReadOnlySequenceKeyColumnWithDefaultValue(testStore.Name, OnModelCreating, IntSentinel); context.Database.EnsureCreatedResiliently(); context.AddRange( @@ -1301,8 +1301,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) [ConditionalFact] public async Task Insert_explicit_value_throws_when_readonly_before_save() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using var context = new BlogContextNonKeyReadOnlyDefaultValue(testStore.Name, OnModelCreating, IntSentinel, DateTimeSentinel); + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var context = new BlogContextNonKeyReadOnlyDefaultValue(testStore.Name, OnModelCreating, IntSentinel, DateTimeSentinel); context.Database.EnsureCreatedResiliently(); context.AddRange( @@ -1329,8 +1329,8 @@ public async Task Insert_explicit_value_throws_when_readonly_before_save() [ConditionalFact] public async Task Insert_explicit_value_into_computed_column() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using var context = new BlogContextComputedColumn(testStore.Name, OnModelCreating, IntSentinel, StringSentinel); + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var context = new BlogContextComputedColumn(testStore.Name, OnModelCreating, IntSentinel, StringSentinel); context.Database.EnsureCreatedResiliently(); context.Add( @@ -1352,8 +1352,8 @@ public async Task Insert_explicit_value_into_computed_column() [ConditionalFact] public async Task Update_explicit_value_in_computed_column() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using (var context = new BlogContextComputedColumn(testStore.Name, OnModelCreating, IntSentinel, StringSentinel)) + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using (var context = new BlogContextComputedColumn(testStore.Name, OnModelCreating, IntSentinel, StringSentinel)) { context.Database.EnsureCreatedResiliently(); @@ -1369,7 +1369,7 @@ public async Task Update_explicit_value_in_computed_column() context.SaveChanges(); } - using (var context = new BlogContextComputedColumn(testStore.Name, OnModelCreating, IntSentinel, StringSentinel)) + await using (var context = new BlogContextComputedColumn(testStore.Name, OnModelCreating, IntSentinel, StringSentinel)) { var blog = context.FullNameBlogs.Single(); @@ -1387,8 +1387,8 @@ public async Task Update_explicit_value_in_computed_column() [ConditionalFact] public async Task Resolve_concurrency() { - using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); - using var context = new BlogContextConcurrencyWithRowversion(testStore.Name, OnModelCreating, IntSentinel, TimestampSentinel); + await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); + await using var context = new BlogContextConcurrencyWithRowversion(testStore.Name, OnModelCreating, IntSentinel, TimestampSentinel); context.Database.EnsureCreatedResiliently(); var blog = context.Add( @@ -1401,7 +1401,7 @@ public async Task Resolve_concurrency() context.SaveChanges(); - using var innerContext = new BlogContextConcurrencyWithRowversion(testStore.Name, OnModelCreating, IntSentinel, TimestampSentinel); + await using var innerContext = new BlogContextConcurrencyWithRowversion(testStore.Name, OnModelCreating, IntSentinel, TimestampSentinel); var updatedBlog = innerContext.ConcurrentBlogs.Single(); updatedBlog.Name = "One Pegasus"; innerContext.SaveChanges(); diff --git a/test/EFCore.Jet.FunctionalTests/JsonTypesJetTest.cs b/test/EFCore.Jet.FunctionalTests/JsonTypesJetTest.cs index f4543cd0..ddb967c3 100644 --- a/test/EFCore.Jet.FunctionalTests/JsonTypesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/JsonTypesJetTest.cs @@ -16,7 +16,7 @@ namespace EntityFrameworkCore.Jet.FunctionalTests; -public class JsonTypesJetTest : JsonTypesRelationalTestBase +public class JsonTypesJetTest(NonSharedFixture fixture) : JsonTypesRelationalTestBase(fixture) { public override async Task Can_read_write_ulong_enum_JSON_values(EnumU64 value, string json) { diff --git a/test/EFCore.Jet.FunctionalTests/LazyLoadProxyJetTest.cs b/test/EFCore.Jet.FunctionalTests/LazyLoadProxyJetTest.cs index 71776765..142e23e6 100644 --- a/test/EFCore.Jet.FunctionalTests/LazyLoadProxyJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/LazyLoadProxyJetTest.cs @@ -27,11 +27,11 @@ public override void Lazy_load_collection(EntityState state, bool useAttach, boo state == EntityState.Detached && useAttach ? "" : $""" -@__p_0='707' (Nullable = true) +@p='707' (Nullable = true) SELECT `c`.`Id`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` FROM `Child` AS `c` -WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -43,11 +43,11 @@ public override void Lazy_load_many_to_one_reference_to_principal(EntityState st state == EntityState.Detached && useAttach ? "" : $""" -@__p_0='707' +@p='707' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -59,11 +59,11 @@ public override void Lazy_load_one_to_one_reference_to_principal(EntityState sta state == EntityState.Detached && useAttach ? "" : $""" -@__p_0='707' +@p='707' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -75,11 +75,11 @@ public override void Lazy_load_one_to_one_reference_to_dependent(EntityState sta state == EntityState.Detached && useAttach ? "" : $""" -@__p_0='707' (Nullable = true) +@p='707' (Nullable = true) SELECT TOP 1 `s`.`Id`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` FROM `Single` AS `s` -WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -89,11 +89,11 @@ public override void Lazy_load_one_to_one_PK_to_PK_reference_to_principal(Entity AssertSql( $""" -@__p_0='707' +@p='707' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -103,11 +103,11 @@ public override void Lazy_load_one_to_one_PK_to_PK_reference_to_dependent(Entity AssertSql( $""" -@__p_0='707' +@p='707' SELECT TOP 1 `s`.`Id`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` FROM `SinglePkToPk` AS `s` -WHERE `s`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `s`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -131,11 +131,11 @@ public override void Lazy_load_collection_not_found(EntityState state) AssertSql( $""" -@__p_0='767' (Nullable = true) +@p='767' (Nullable = true) SELECT `c`.`Id`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` FROM `Child` AS `c` -WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -145,11 +145,11 @@ public override void Lazy_load_many_to_one_reference_to_principal_not_found(Enti AssertSql( $""" -@__p_0='787' +@p='787' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -159,11 +159,11 @@ public override void Lazy_load_one_to_one_reference_to_principal_not_found(Entit AssertSql( $""" -@__p_0='787' +@p='787' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -173,11 +173,11 @@ public override void Lazy_load_one_to_one_reference_to_dependent_not_found(Entit AssertSql( $""" -@__p_0='767' (Nullable = true) +@p='767' (Nullable = true) SELECT TOP 1 `s`.`Id`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` FROM `Single` AS `s` -WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -233,11 +233,11 @@ public override void Lazy_load_many_to_one_reference_to_principal_alternate_key( AssertSql( $""" -@__p_0='Root' (Size = 255) +@p='Root' (Size = 255) -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` FROM `Parent` AS `p` -WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -247,11 +247,11 @@ public override void Lazy_load_one_to_one_reference_to_principal_alternate_key(E AssertSql( $""" -@__p_0='Root' (Size = 255) +@p='Root' (Size = 255) -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` FROM `Parent` AS `p` -WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -261,11 +261,11 @@ public override void Lazy_load_one_to_one_reference_to_dependent_alternate_key(E AssertSql( $""" -@__p_0='Root' (Size = 255) +@p='Root' (Size = 255) SELECT TOP 1 `s`.`Id`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` FROM `SingleAk` AS `s` -WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -289,11 +289,11 @@ public override void Lazy_load_collection_shadow_fk(EntityState state) AssertSql( $""" -@__p_0='707' (Nullable = true) +@p='707' (Nullable = true) SELECT `c`.`Id`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` FROM `ChildShadowFk` AS `c` -WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -305,11 +305,11 @@ public override void Lazy_load_many_to_one_reference_to_principal_shadow_fk(Enti state == EntityState.Detached ? "" : $""" -@__p_0='707' +@p='707' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -321,11 +321,11 @@ public override void Lazy_load_one_to_one_reference_to_principal_shadow_fk(Entit state == EntityState.Detached ? "" : $""" -@__p_0='707' +@p='707' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -335,11 +335,11 @@ public override void Lazy_load_one_to_one_reference_to_dependent_shadow_fk(Entit AssertSql( $""" -@__p_0='707' (Nullable = true) +@p='707' (Nullable = true) SELECT TOP 1 `s`.`Id`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` FROM `SingleShadowFk` AS `s` -WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -363,12 +363,12 @@ public override void Lazy_load_collection_composite_key(EntityState state) AssertSql( $""" -@__p_0='Root' (Size = 255) -@__p_1='707' (Nullable = true) +@p='Root' (Size = 255) +@p0='707' (Nullable = true) SELECT `c`.`Id`, `c`.`ParentAlternateId`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` FROM `ChildCompositeKey` AS `c` -WHERE `c`.`ParentAlternateId` = {AssertSqlHelper.Parameter("@__p_0")} AND `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_1")} +WHERE `c`.`ParentAlternateId` = {AssertSqlHelper.Parameter("@p")} AND `c`.`ParentId` = {AssertSqlHelper.Parameter("@p0")} """); } @@ -378,12 +378,12 @@ public override void Lazy_load_many_to_one_reference_to_principal_composite_key( AssertSql( $""" -@__p_0='Root' (Size = 255) -@__p_1='707' +@p='Root' (Size = 255) +@p0='707' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` FROM `Parent` AS `p` -WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@__p_0")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@__p_1")} +WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@p0")} """); } @@ -393,12 +393,12 @@ public override void Lazy_load_one_to_one_reference_to_principal_composite_key(E AssertSql( $""" -@__p_0='Root' (Size = 255) -@__p_1='707' +@p='Root' (Size = 255) +@p0='707' -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` FROM `Parent` AS `p` -WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@__p_0")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@__p_1")} +WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@p0")} """); } @@ -408,12 +408,12 @@ public override void Lazy_load_one_to_one_reference_to_dependent_composite_key(E AssertSql( $""" -@__p_0='Root' (Size = 255) -@__p_1='707' (Nullable = true) +@p='Root' (Size = 255) +@p0='707' (Nullable = true) SELECT TOP 1 `s`.`Id`, `s`.`ParentAlternateId`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` FROM `SingleCompositeKey` AS `s` -WHERE `s`.`ParentAlternateId` = {AssertSqlHelper.Parameter("@__p_0")} AND `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_1")} +WHERE `s`.`ParentAlternateId` = {AssertSqlHelper.Parameter("@p")} AND `s`.`ParentId` = {AssertSqlHelper.Parameter("@p0")} """); } @@ -439,11 +439,11 @@ public override async Task Load_collection(EntityState state, bool async) { AssertSql( $""" -@__p_0='707' (Nullable = true) +@p='707' (Nullable = true) SELECT `c`.`Id`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` FROM `Child` AS `c` -WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } } @@ -455,15 +455,15 @@ public override void Top_level_projection_track_entities_before_passing_to_clien AssertSql( $""" -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating1`, `p`.`Culture_Species1`, `p`.`Culture_Subspecies1`, `p`.`Culture_Validation1`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating1`, `p`.`Milk_Species1`, `p`.`Milk_Subspecies1`, `p`.`Milk_Validation1`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation` FROM `Parent` AS `p` ORDER BY `p`.`Id` -@__p_0='707' (Nullable = true) +@p='707' (Nullable = true) SELECT TOP 1 `s`.`Id`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` FROM `Single` AS `s` -WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -473,12 +473,12 @@ public override async Task Entity_equality_with_proxy_parameter(bool async) AssertSql( $""" -@__entity_equality_called_0_Id='707' (Nullable = true) +@entity_equality_called_Id='707' (Nullable = true) SELECT `c`.`Id`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` FROM `Child` AS `c` LEFT JOIN `Parent` AS `p` ON `c`.`ParentId` = `p`.`Id` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__entity_equality_called_0_Id")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@entity_equality_called_Id")} """); } diff --git a/test/EFCore.Jet.FunctionalTests/LoadJetTest.cs b/test/EFCore.Jet.FunctionalTests/LoadJetTest.cs index d6148ff2..b40b8eba 100644 --- a/test/EFCore.Jet.FunctionalTests/LoadJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/LoadJetTest.cs @@ -27,11 +27,11 @@ public override async Task Lazy_load_collection(EntityState state, QueryTracking state == EntityState.Detached && queryTrackingBehavior == QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} +{AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `Child` AS `c` -WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -43,11 +43,11 @@ public override async Task Lazy_load_many_to_one_reference_to_principal(EntitySt state == EntityState.Detached && queryTrackingBehavior == QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707'")} +{AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -59,11 +59,11 @@ public override async Task Lazy_load_one_to_one_reference_to_principal(EntitySta state == EntityState.Detached && queryTrackingBehavior == QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707'")} +{AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -75,11 +75,11 @@ public override async Task Lazy_load_one_to_one_reference_to_dependent(EntitySta state == EntityState.Detached && queryTrackingBehavior == QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} +{AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT TOP 1 `s`.`Id`, `s`.`ParentId` FROM `Single` AS `s` -WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -91,11 +91,11 @@ public override void Lazy_load_one_to_one_PK_to_PK_reference_to_principal(Entity state == EntityState.Detached && queryTrackingBehavior == QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707'")} +{AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -107,11 +107,11 @@ public override void Lazy_load_one_to_one_PK_to_PK_reference_to_dependent(Entity state == EntityState.Detached && queryTrackingBehavior == QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707'")} +{AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 1 `s`.`Id` FROM `SinglePkToPk` AS `s` -WHERE `s`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `s`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -137,11 +137,11 @@ public override async Task Lazy_load_collection_not_found(EntityState state, Que state == EntityState.Detached ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='767' (Nullable = true)")} +{AssertSqlHelper.Declaration("@p='767' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `Child` AS `c` -WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -153,11 +153,11 @@ public override async Task Lazy_load_many_to_one_reference_to_principal_not_foun state == EntityState.Detached ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='787'")} +{AssertSqlHelper.Declaration("@p='787'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -169,11 +169,11 @@ public override async Task Lazy_load_one_to_one_reference_to_principal_not_found state == EntityState.Detached ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='787'")} +{AssertSqlHelper.Declaration("@p='787'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -185,11 +185,11 @@ public override async Task Lazy_load_one_to_one_reference_to_dependent_not_found state == EntityState.Detached ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='767' (Nullable = true)")} +{AssertSqlHelper.Declaration("@p='767' (Nullable = true)")} SELECT TOP 1 `s`.`Id`, `s`.`ParentId` FROM `Single` AS `s` -WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -244,11 +244,11 @@ public override void Lazy_load_many_to_one_reference_to_principal_alternate_key( state == EntityState.Detached && queryTrackingBehavior == QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} +{AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -260,11 +260,11 @@ public override void Lazy_load_one_to_one_reference_to_principal_alternate_key(E state == EntityState.Detached && queryTrackingBehavior == QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} +{AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -276,11 +276,11 @@ public override void Lazy_load_one_to_one_reference_to_dependent_alternate_key(E state == EntityState.Detached && queryTrackingBehavior == QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} +{AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} SELECT TOP 1 `s`.`Id`, `s`.`ParentId` FROM `SingleAk` AS `s` -WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -306,11 +306,11 @@ public override void Lazy_load_collection_shadow_fk(EntityState state, QueryTrac state == EntityState.Detached && queryTrackingBehavior == QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} +{AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `ChildShadowFk` AS `c` -WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -322,11 +322,11 @@ public override void Lazy_load_many_to_one_reference_to_principal_shadow_fk(Enti state == EntityState.Detached || queryTrackingBehavior != QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707'")} +{AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -338,11 +338,11 @@ public override void Lazy_load_one_to_one_reference_to_principal_shadow_fk(Entit state == EntityState.Detached || queryTrackingBehavior != QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707'")} +{AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -354,11 +354,11 @@ public override void Lazy_load_one_to_one_reference_to_dependent_shadow_fk(Entit state == EntityState.Detached && queryTrackingBehavior == QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} +{AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT TOP 1 `s`.`Id`, `s`.`ParentId` FROM `SingleShadowFk` AS `s` -WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -384,12 +384,12 @@ public override void Lazy_load_collection_composite_key(EntityState state, Query state == EntityState.Detached && queryTrackingBehavior == QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} -{AssertSqlHelper.Declaration("@__p_1='707' (Nullable = true)")} +{AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} +{AssertSqlHelper.Declaration("@p0='707' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentAlternateId`, `c`.`ParentId` FROM `ChildCompositeKey` AS `c` -WHERE `c`.`ParentAlternateId` = {AssertSqlHelper.Parameter("@__p_0")} AND `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_1")} +WHERE `c`.`ParentAlternateId` = {AssertSqlHelper.Parameter("@p")} AND `c`.`ParentId` = {AssertSqlHelper.Parameter("@p0")} """); } @@ -401,12 +401,12 @@ public override void Lazy_load_many_to_one_reference_to_principal_composite_key( state == EntityState.Detached && queryTrackingBehavior == QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} -{AssertSqlHelper.Declaration("@__p_1='707'")} +{AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} +{AssertSqlHelper.Declaration("@p0='707'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@__p_0")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@__p_1")} +WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@p0")} """); } @@ -418,12 +418,12 @@ public override void Lazy_load_one_to_one_reference_to_principal_composite_key(E state == EntityState.Detached && queryTrackingBehavior == QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} -{AssertSqlHelper.Declaration("@__p_1='707'")} +{AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} +{AssertSqlHelper.Declaration("@p0='707'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@__p_0")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@__p_1")} +WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@p0")} """); } @@ -435,12 +435,12 @@ public override void Lazy_load_one_to_one_reference_to_dependent_composite_key(E state == EntityState.Detached && queryTrackingBehavior == QueryTrackingBehavior.TrackAll ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} -{AssertSqlHelper.Declaration("@__p_1='707' (Nullable = true)")} +{AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} +{AssertSqlHelper.Declaration("@p0='707' (Nullable = true)")} SELECT TOP 1 `s`.`Id`, `s`.`ParentAlternateId`, `s`.`ParentId` FROM `SingleCompositeKey` AS `s` -WHERE `s`.`ParentAlternateId` = {AssertSqlHelper.Parameter("@__p_0")} AND `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_1")} +WHERE `s`.`ParentAlternateId` = {AssertSqlHelper.Parameter("@p")} AND `s`.`ParentId` = {AssertSqlHelper.Parameter("@p0")} """); } @@ -464,11 +464,11 @@ public override async Task Load_collection(EntityState state, QueryTrackingBehav AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `Child` AS `c` - WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -478,11 +478,11 @@ public override async Task Load_many_to_one_reference_to_principal(EntityState s AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707'")} + {AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -492,11 +492,11 @@ public override async Task Load_one_to_one_reference_to_principal(EntityState st AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707'")} + {AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -506,11 +506,11 @@ public override async Task Load_one_to_one_reference_to_dependent(EntityState st AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT TOP 1 `s`.`Id`, `s`.`ParentId` FROM `Single` AS `s` - WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -520,11 +520,11 @@ public override async Task Load_one_to_one_PK_to_PK_reference_to_principal(Entit AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707'")} + {AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -534,11 +534,11 @@ public override async Task Load_one_to_one_PK_to_PK_reference_to_dependent(Entit AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707'")} + {AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 1 `s`.`Id` FROM `SinglePkToPk` AS `s` - WHERE `s`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `s`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -548,11 +548,11 @@ public override async Task Load_collection_using_Query(EntityState state, bool a AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `Child` AS `c` - WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -562,11 +562,11 @@ public override async Task Load_many_to_one_reference_to_principal_using_Query(E AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707'")} + {AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 2 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -576,11 +576,11 @@ public override async Task Load_one_to_one_reference_to_principal_using_Query(En AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707'")} + {AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 2 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -592,11 +592,11 @@ public override async Task Load_one_to_one_reference_to_dependent_using_Query(En state == EntityState.Detached ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} +{AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT TOP 2 `s`.`Id`, `s`.`ParentId` FROM `Single` AS `s` -WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -606,11 +606,11 @@ public override async Task Load_one_to_one_PK_to_PK_reference_to_principal_using AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707'")} + {AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 2 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -622,11 +622,11 @@ public override async Task Load_one_to_one_PK_to_PK_reference_to_dependent_using state == EntityState.Detached ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707'")} +{AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 2 `s`.`Id` FROM `SinglePkToPk` AS `s` -WHERE `s`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `s`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -674,11 +674,11 @@ public override async Task Load_collection_not_found(EntityState state, bool asy AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='767' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='767' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `Child` AS `c` - WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -688,11 +688,11 @@ public override async Task Load_many_to_one_reference_to_principal_not_found(Ent AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='787'")} + {AssertSqlHelper.Declaration("@p='787'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -702,11 +702,11 @@ public override async Task Load_one_to_one_reference_to_principal_not_found(Enti AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='787'")} + {AssertSqlHelper.Declaration("@p='787'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -716,11 +716,11 @@ public override async Task Load_one_to_one_reference_to_dependent_not_found(Enti AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='767' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='767' (Nullable = true)")} SELECT TOP 1 `s`.`Id`, `s`.`ParentId` FROM `Single` AS `s` - WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -730,11 +730,11 @@ public override async Task Load_collection_using_Query_not_found(EntityState sta AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='767' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='767' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `Child` AS `c` - WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -744,11 +744,11 @@ public override async Task Load_many_to_one_reference_to_principal_using_Query_n AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='787'")} + {AssertSqlHelper.Declaration("@p='787'")} SELECT TOP 2 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -758,11 +758,11 @@ public override async Task Load_one_to_one_reference_to_principal_using_Query_no AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='787'")} + {AssertSqlHelper.Declaration("@p='787'")} SELECT TOP 2 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -772,11 +772,11 @@ public override async Task Load_one_to_one_reference_to_dependent_using_Query_no AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='767' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='767' (Nullable = true)")} SELECT TOP 2 `s`.`Id`, `s`.`ParentId` FROM `Single` AS `s` - WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -831,11 +831,11 @@ public override async Task Load_collection_using_Query_already_loaded( AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `Child` AS `c` - WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -847,11 +847,11 @@ public override async Task Load_many_to_one_reference_to_principal_using_Query_a state == EntityState.Deleted ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707'")} +{AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 2 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -863,11 +863,11 @@ public override async Task Load_one_to_one_reference_to_principal_using_Query_al state == EntityState.Deleted ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707'")} +{AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 2 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -878,11 +878,11 @@ public override async Task Load_one_to_one_reference_to_dependent_using_Query_al AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT TOP 2 `s`.`Id`, `s`.`ParentId` FROM `Single` AS `s` - WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -892,11 +892,11 @@ public override async Task Load_one_to_one_PK_to_PK_reference_to_principal_using AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707'")} + {AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 2 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -906,11 +906,11 @@ public override async Task Load_one_to_one_PK_to_PK_reference_to_dependent_using AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707'")} + {AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 2 `s`.`Id` FROM `SinglePkToPk` AS `s` - WHERE `s`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `s`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -920,11 +920,11 @@ public override async Task Load_collection_untyped(EntityState state, bool async AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `Child` AS `c` - WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -934,11 +934,11 @@ public override async Task Load_many_to_one_reference_to_principal_untyped(Entit AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707'")} + {AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -948,11 +948,11 @@ public override async Task Load_one_to_one_reference_to_principal_untyped(Entity AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707'")} + {AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -962,11 +962,11 @@ public override async Task Load_one_to_one_reference_to_dependent_untyped(Entity AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT TOP 1 `s`.`Id`, `s`.`ParentId` FROM `Single` AS `s` - WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -976,11 +976,11 @@ public override async Task Load_collection_using_Query_untyped(EntityState state AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `Child` AS `c` - WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -990,11 +990,11 @@ public override async Task Load_many_to_one_reference_to_principal_using_Query_u AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707'")} + {AssertSqlHelper.Declaration("@p='707'")} SELECT `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1004,11 +1004,11 @@ public override async Task Load_one_to_one_reference_to_principal_using_Query_un AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707'")} + {AssertSqlHelper.Declaration("@p='707'")} SELECT `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1020,11 +1020,11 @@ public override async Task Load_one_to_one_reference_to_dependent_using_Query_un state == EntityState.Detached ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} +{AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT `s`.`Id`, `s`.`ParentId` FROM `Single` AS `s` -WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1034,11 +1034,11 @@ public override async Task Load_collection_not_found_untyped(EntityState state, AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='767' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='767' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `Child` AS `c` - WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1048,11 +1048,11 @@ public override async Task Load_many_to_one_reference_to_principal_not_found_unt AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='787'")} + {AssertSqlHelper.Declaration("@p='787'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1062,11 +1062,11 @@ public override async Task Load_one_to_one_reference_to_principal_not_found_unty AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='787'")} + {AssertSqlHelper.Declaration("@p='787'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1076,11 +1076,11 @@ public override async Task Load_one_to_one_reference_to_dependent_not_found_unty AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='767' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='767' (Nullable = true)")} SELECT TOP 1 `s`.`Id`, `s`.`ParentId` FROM `Single` AS `s` - WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1090,11 +1090,11 @@ public override async Task Load_collection_using_Query_not_found_untyped(EntityS AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='767' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='767' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `Child` AS `c` - WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1104,11 +1104,11 @@ public override async Task Load_many_to_one_reference_to_principal_using_Query_n AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='787'")} + {AssertSqlHelper.Declaration("@p='787'")} SELECT `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1118,11 +1118,11 @@ public override async Task Load_one_to_one_reference_to_principal_using_Query_no AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='787'")} + {AssertSqlHelper.Declaration("@p='787'")} SELECT `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1132,11 +1132,11 @@ public override async Task Load_one_to_one_reference_to_dependent_using_Query_no AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='767' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='767' (Nullable = true)")} SELECT `s`.`Id`, `s`.`ParentId` FROM `Single` AS `s` - WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1176,11 +1176,11 @@ public override async Task Load_collection_using_Query_already_loaded_untyped( AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `Child` AS `c` - WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1192,11 +1192,11 @@ public override async Task Load_many_to_one_reference_to_principal_using_Query_a state == EntityState.Deleted ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707'")} +{AssertSqlHelper.Declaration("@p='707'")} SELECT `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1208,11 +1208,11 @@ public override async Task Load_one_to_one_reference_to_principal_using_Query_al state == EntityState.Deleted ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707'")} +{AssertSqlHelper.Declaration("@p='707'")} SELECT `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1223,11 +1223,11 @@ public override async Task Load_one_to_one_reference_to_dependent_using_Query_al AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT `s`.`Id`, `s`.`ParentId` FROM `Single` AS `s` - WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1237,11 +1237,11 @@ public override async Task Load_collection_alternate_key(EntityState state, bool AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} + {AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `ChildAk` AS `c` - WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1251,11 +1251,11 @@ public override async Task Load_many_to_one_reference_to_principal_alternate_key AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} + {AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1265,11 +1265,11 @@ public override async Task Load_one_to_one_reference_to_principal_alternate_key( AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} + {AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1279,11 +1279,11 @@ public override async Task Load_one_to_one_reference_to_dependent_alternate_key( AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} + {AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} SELECT TOP 1 `s`.`Id`, `s`.`ParentId` FROM `SingleAk` AS `s` - WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1293,11 +1293,11 @@ public override async Task Load_collection_using_Query_alternate_key(EntityState AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} + {AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `ChildAk` AS `c` - WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1307,11 +1307,11 @@ public override async Task Load_many_to_one_reference_to_principal_using_Query_a AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} + {AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} SELECT TOP 2 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1321,11 +1321,11 @@ public override async Task Load_one_to_one_reference_to_principal_using_Query_al AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} + {AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} SELECT TOP 2 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1337,11 +1337,11 @@ public override async Task Load_one_to_one_reference_to_dependent_using_Query_al state == EntityState.Detached ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} +{AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} SELECT TOP 2 `s`.`Id`, `s`.`ParentId` FROM `SingleAk` AS `s` -WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1389,11 +1389,11 @@ public override async Task Load_collection_shadow_fk(EntityState state, bool asy AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `ChildShadowFk` AS `c` - WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1405,11 +1405,11 @@ public override async Task Load_many_to_one_reference_to_principal_shadow_fk(Ent state == EntityState.Detached ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707'")} +{AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1421,11 +1421,11 @@ public override async Task Load_one_to_one_reference_to_principal_shadow_fk(Enti state == EntityState.Detached ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707'")} +{AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1435,11 +1435,11 @@ public override async Task Load_one_to_one_reference_to_dependent_shadow_fk(Enti AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT TOP 1 `s`.`Id`, `s`.`ParentId` FROM `SingleShadowFk` AS `s` - WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1449,11 +1449,11 @@ public override async Task Load_collection_using_Query_shadow_fk(EntityState sta AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentId` FROM `ChildShadowFk` AS `c` - WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `c`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1465,11 +1465,11 @@ public override async Task Load_many_to_one_reference_to_principal_using_Query_s state == EntityState.Detached ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707'")} +{AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 2 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1481,11 +1481,11 @@ public override async Task Load_one_to_one_reference_to_principal_using_Query_sh state == EntityState.Detached ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707'")} +{AssertSqlHelper.Declaration("@p='707'")} SELECT TOP 2 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` -WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `p`.`Id` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1497,11 +1497,11 @@ public override async Task Load_one_to_one_reference_to_dependent_using_Query_sh state == EntityState.Detached ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='707' (Nullable = true)")} +{AssertSqlHelper.Declaration("@p='707' (Nullable = true)")} SELECT TOP 2 `s`.`Id`, `s`.`ParentId` FROM `SingleShadowFk` AS `s` -WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `s`.`ParentId` = {AssertSqlHelper.Parameter("@p")} """); } @@ -1553,12 +1553,12 @@ public override async Task Load_collection_composite_key(EntityState state, bool AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} - {AssertSqlHelper.Declaration("@__p_1='707' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} + {AssertSqlHelper.Declaration("@p0='707' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentAlternateId`, `c`.`ParentId` FROM `ChildCompositeKey` AS `c` - WHERE `c`.`ParentAlternateId` = {AssertSqlHelper.Parameter("@__p_0")} AND `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_1")} + WHERE `c`.`ParentAlternateId` = {AssertSqlHelper.Parameter("@p")} AND `c`.`ParentId` = {AssertSqlHelper.Parameter("@p0")} """); } @@ -1568,12 +1568,12 @@ public override async Task Load_many_to_one_reference_to_principal_composite_key AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} - {AssertSqlHelper.Declaration("@__p_1='707'")} + {AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} + {AssertSqlHelper.Declaration("@p0='707'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@__p_0")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@__p_1")} + WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@p0")} """); } @@ -1583,12 +1583,12 @@ public override async Task Load_one_to_one_reference_to_principal_composite_key( AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} - {AssertSqlHelper.Declaration("@__p_1='707'")} + {AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} + {AssertSqlHelper.Declaration("@p0='707'")} SELECT TOP 1 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@__p_0")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@__p_1")} + WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@p0")} """); } @@ -1598,12 +1598,12 @@ public override async Task Load_one_to_one_reference_to_dependent_composite_key( AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} - {AssertSqlHelper.Declaration("@__p_1='707' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} + {AssertSqlHelper.Declaration("@p0='707' (Nullable = true)")} SELECT TOP 1 `s`.`Id`, `s`.`ParentAlternateId`, `s`.`ParentId` FROM `SingleCompositeKey` AS `s` - WHERE `s`.`ParentAlternateId` = {AssertSqlHelper.Parameter("@__p_0")} AND `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_1")} + WHERE `s`.`ParentAlternateId` = {AssertSqlHelper.Parameter("@p")} AND `s`.`ParentId` = {AssertSqlHelper.Parameter("@p0")} """); } @@ -1613,12 +1613,12 @@ public override async Task Load_collection_using_Query_composite_key(EntityState AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} - {AssertSqlHelper.Declaration("@__p_1='707' (Nullable = true)")} + {AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} + {AssertSqlHelper.Declaration("@p0='707' (Nullable = true)")} SELECT `c`.`Id`, `c`.`ParentAlternateId`, `c`.`ParentId` FROM `ChildCompositeKey` AS `c` - WHERE `c`.`ParentAlternateId` = {AssertSqlHelper.Parameter("@__p_0")} AND `c`.`ParentId` = {AssertSqlHelper.Parameter("@__p_1")} + WHERE `c`.`ParentAlternateId` = {AssertSqlHelper.Parameter("@p")} AND `c`.`ParentId` = {AssertSqlHelper.Parameter("@p0")} """); } @@ -1628,12 +1628,12 @@ public override async Task Load_many_to_one_reference_to_principal_using_Query_c AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} - {AssertSqlHelper.Declaration("@__p_1='707'")} + {AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} + {AssertSqlHelper.Declaration("@p0='707'")} SELECT TOP 2 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@__p_0")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@__p_1")} + WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@p0")} """); } @@ -1643,12 +1643,12 @@ public override async Task Load_one_to_one_reference_to_principal_using_Query_co AssertSql( $""" - {AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} - {AssertSqlHelper.Declaration("@__p_1='707'")} + {AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} + {AssertSqlHelper.Declaration("@p0='707'")} SELECT TOP 2 `p`.`Id`, `p`.`AlternateId` FROM `Parent` AS `p` - WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@__p_0")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@__p_1")} + WHERE `p`.`AlternateId` = {AssertSqlHelper.Parameter("@p")} AND `p`.`Id` = {AssertSqlHelper.Parameter("@p0")} """); } @@ -1660,12 +1660,12 @@ public override async Task Load_one_to_one_reference_to_dependent_using_Query_co state == EntityState.Detached ? "" : $""" -{AssertSqlHelper.Declaration("@__p_0='Root' (Size = 255)")} -{AssertSqlHelper.Declaration("@__p_1='707' (Nullable = true)")} +{AssertSqlHelper.Declaration("@p='Root' (Size = 255)")} +{AssertSqlHelper.Declaration("@p0='707' (Nullable = true)")} SELECT TOP 2 `s`.`Id`, `s`.`ParentAlternateId`, `s`.`ParentId` FROM `SingleCompositeKey` AS `s` -WHERE `s`.`ParentAlternateId` = {AssertSqlHelper.Parameter("@__p_0")} AND `s`.`ParentId` = {AssertSqlHelper.Parameter("@__p_1")} +WHERE `s`.`ParentAlternateId` = {AssertSqlHelper.Parameter("@p")} AND `s`.`ParentId` = {AssertSqlHelper.Parameter("@p0")} """); } diff --git a/test/EFCore.Jet.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs b/test/EFCore.Jet.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs index be17cc64..bf8d5c59 100644 --- a/test/EFCore.Jet.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs +++ b/test/EFCore.Jet.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs @@ -31,9 +31,9 @@ public override async Task Load_collection(EntityState state, QueryTrackingBehav await base.Load_collection(state, queryTrackingBehavior, async); AssertSql( - $""" -@__p_0='3' -@__p_0='3' + """ +@p='3' +@p='3' SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId`, `s0`.`TwoId`, `s0`.`Id`, `s0`.`Name` FROM (`EntityOnes` AS `e` @@ -46,9 +46,9 @@ LEFT JOIN ( SELECT `j0`.`OneId`, `j0`.`TwoId`, `e1`.`Id`, `e1`.`Name` FROM `JoinOneToTwo` AS `j0` INNER JOIN `EntityOnes` AS `e1` ON `j0`.`OneId` = `e1`.`Id` - WHERE `e1`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `e1`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` -WHERE `e`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `e`.`Id` = @p ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id`, `s0`.`OneId`, `s0`.`TwoId` """); } @@ -58,9 +58,9 @@ public override async Task Load_collection_using_Query_with_Include_for_inverse( await base.Load_collection_using_Query_with_Include_for_inverse(async); AssertSql( - $""" -@__p_0='3' -@__p_0='3' + """ +@p='3' +@p='3' SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s0`.`Id`, `s0`.`Name` FROM (`EntityOnes` AS `e` @@ -73,9 +73,9 @@ LEFT JOIN ( SELECT `e2`.`OneSkipSharedId`, `e2`.`TwoSkipSharedId`, `e3`.`Id`, `e3`.`Name` FROM `EntityOneEntityTwo` AS `e2` INNER JOIN `EntityOnes` AS `e3` ON `e2`.`OneSkipSharedId` = `e3`.`Id` - WHERE `e3`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `e3`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`TwoSkipSharedId` -WHERE `e`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `e`.`Id` = @p ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s`.`Id`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId` """); } @@ -85,9 +85,9 @@ public override async Task Load_collection_using_Query_with_Include_for_same_col await base.Load_collection_using_Query_with_Include_for_same_collection(async); AssertSql( - $""" -@__p_0='3' -@__p_0='3' + """ +@p='3' +@p='3' SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s1`.`OneSkipSharedId`, `s1`.`TwoSkipSharedId`, `s1`.`Id`, `s1`.`Name`, `s1`.`OneSkipSharedId0`, `s1`.`TwoSkipSharedId0`, `s1`.`Id0`, `s1`.`CollectionInverseId`, `s1`.`Name0`, `s1`.`ReferenceInverseId` FROM (`EntityOnes` AS `e` @@ -105,9 +105,9 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e4` INNER JOIN `EntityTwos` AS `e5` ON `e4`.`TwoSkipSharedId` = `e5`.`Id` ) AS `s0` ON `e3`.`Id` = `s0`.`OneSkipSharedId` - WHERE `e3`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `e3`.`Id` = @p ) AS `s1` ON `s`.`Id` = `s1`.`TwoSkipSharedId` -WHERE `e`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `e`.`Id` = @p ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s`.`Id`, `s1`.`OneSkipSharedId`, `s1`.`TwoSkipSharedId`, `s1`.`Id`, `s1`.`OneSkipSharedId0`, `s1`.`TwoSkipSharedId0` """); } @@ -117,9 +117,9 @@ public override async Task Load_collection_using_Query_with_Include(bool async) await base.Load_collection_using_Query_with_Include(async); AssertSql( - $""" -@__p_0='3' -@__p_0='3' + """ +@p='3' +@p='3' SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s0`.`Id`, `s0`.`Name`, `s1`.`ThreeId`, `s1`.`TwoId`, `s1`.`Id`, `s1`.`CollectionInverseId`, `s1`.`Name`, `s1`.`ReferenceInverseId` FROM ((`EntityOnes` AS `e` @@ -132,14 +132,14 @@ LEFT JOIN ( SELECT `e2`.`OneSkipSharedId`, `e2`.`TwoSkipSharedId`, `e3`.`Id`, `e3`.`Name` FROM `EntityOneEntityTwo` AS `e2` INNER JOIN `EntityOnes` AS `e3` ON `e2`.`OneSkipSharedId` = `e3`.`Id` - WHERE `e3`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `e3`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`TwoSkipSharedId`) LEFT JOIN ( SELECT `j`.`ThreeId`, `j`.`TwoId`, `e4`.`Id`, `e4`.`CollectionInverseId`, `e4`.`Name`, `e4`.`ReferenceInverseId` FROM `JoinTwoToThree` AS `j` INNER JOIN `EntityThrees` AS `e4` ON `j`.`ThreeId` = `e4`.`Id` ) AS `s1` ON `s`.`Id` = `s1`.`TwoId` -WHERE `e`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `e`.`Id` = @p ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s`.`Id`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s0`.`Id`, `s1`.`ThreeId`, `s1`.`TwoId` """); } @@ -149,9 +149,9 @@ public override async Task Load_collection_using_Query_with_filtered_Include(boo await base.Load_collection_using_Query_with_filtered_Include(async); AssertSql( - $""" -@__p_0='3' -@__p_0='3' + """ +@p='3' +@p='3' SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s0`.`Id`, `s0`.`Name`, `s1`.`ThreeId`, `s1`.`TwoId`, `s1`.`Id`, `s1`.`CollectionInverseId`, `s1`.`Name`, `s1`.`ReferenceInverseId` FROM ((`EntityOnes` AS `e` @@ -164,7 +164,7 @@ LEFT JOIN ( SELECT `e2`.`OneSkipSharedId`, `e2`.`TwoSkipSharedId`, `e3`.`Id`, `e3`.`Name` FROM `EntityOneEntityTwo` AS `e2` INNER JOIN `EntityOnes` AS `e3` ON `e2`.`OneSkipSharedId` = `e3`.`Id` - WHERE `e3`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `e3`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`TwoSkipSharedId`) LEFT JOIN ( SELECT `j`.`ThreeId`, `j`.`TwoId`, `e4`.`Id`, `e4`.`CollectionInverseId`, `e4`.`Name`, `e4`.`ReferenceInverseId` @@ -172,7 +172,7 @@ LEFT JOIN ( INNER JOIN `EntityThrees` AS `e4` ON `j`.`ThreeId` = `e4`.`Id` WHERE `e4`.`Id` IN (13, 11) ) AS `s1` ON `s`.`Id` = `s1`.`TwoId` -WHERE `e`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `e`.`Id` = @p ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s`.`Id`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s0`.`Id`, `s1`.`ThreeId`, `s1`.`TwoId` """); } @@ -210,9 +210,9 @@ public override async Task Load_collection_using_Query_with_join(bool async) await base.Load_collection_using_Query_with_join(async); AssertSql( - $""" -@__p_0='3' -@__p_0='3' + """ +@p='3' +@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` FROM ((`EntityOnes` AS `e` @@ -234,9 +234,9 @@ LEFT JOIN ( SELECT `e5`.`OneSkipSharedId`, `e5`.`TwoSkipSharedId`, `e6`.`Id`, `e6`.`Name` FROM `EntityOneEntityTwo` AS `e5` INNER JOIN `EntityOnes` AS `e6` ON `e5`.`OneSkipSharedId` = `e6`.`Id` - WHERE `e6`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `e6`.`Id` = @p ) AS `s2` ON `s`.`Id` = `s2`.`TwoSkipSharedId` -WHERE (`e`.`Id` = {AssertSqlHelper.Parameter("@__p_0")}) AND (`s`.`Id` IS NOT NULL AND `s1`.`Id0` IS NOT NULL) +WHERE (`e`.`Id` = @p) AND (`s`.`Id` IS NOT NULL AND `s1`.`Id0` IS NOT NULL) ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s`.`Id`, `s1`.`Id`, `s1`.`OneSkipSharedId`, `s1`.`TwoSkipSharedId`, `s1`.`Id0`, `s2`.`OneSkipSharedId`, `s2`.`TwoSkipSharedId` """); } diff --git a/test/EFCore.Jet.FunctionalTests/ManyToManyLoadSqlServerTest.cs b/test/EFCore.Jet.FunctionalTests/ManyToManyLoadSqlServerTest.cs index d7b88f98..a4392c50 100644 --- a/test/EFCore.Jet.FunctionalTests/ManyToManyLoadSqlServerTest.cs +++ b/test/EFCore.Jet.FunctionalTests/ManyToManyLoadSqlServerTest.cs @@ -30,8 +30,8 @@ public override async Task Load_collection(EntityState state, QueryTrackingBehav AssertSql( state == EntityState.Detached ? $""" -@__p_0='3' -@__p_0='3' +@p='3' +@p='3' SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`ExtraId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`Id`, `s0`.`Name`, `s0`.`OneId`, `s0`.`TwoId` FROM (`EntityOnes` AS `e` @@ -44,14 +44,14 @@ LEFT JOIN ( SELECT `e1`.`Id`, `e1`.`Name`, `j0`.`OneId`, `j0`.`TwoId` FROM `JoinOneToTwo` AS `j0` INNER JOIN `EntityOnes` AS `e1` ON `j0`.`OneId` = `e1`.`Id` - WHERE `e1`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `e1`.`Id` = {AssertSqlHelper.Parameter("@p")} ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` -WHERE `e`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `e`.`Id` = {AssertSqlHelper.Parameter("@p")} ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id`, `s0`.`OneId`, `s0`.`TwoId` """ : $""" -@__p_0='3' -@__p_0='3' +@p='3' +@p='3' SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`ExtraId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s0`.`OneId`, `s0`.`TwoId`, `s0`.`JoinOneToTwoExtraId`, `s0`.`Id`, `s0`.`Name` FROM (`EntityOnes` AS `e` @@ -64,9 +64,9 @@ LEFT JOIN ( SELECT `j0`.`OneId`, `j0`.`TwoId`, `j0`.`JoinOneToTwoExtraId`, `e1`.`Id`, `e1`.`Name` FROM `JoinOneToTwo` AS `j0` INNER JOIN `EntityOnes` AS `e1` ON `j0`.`OneId` = `e1`.`Id` - WHERE `e1`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `e1`.`Id` = {AssertSqlHelper.Parameter("@p")} ) AS `s0` ON `s`.`Id` = `s0`.`TwoId` -WHERE `e`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `e`.`Id` = {AssertSqlHelper.Parameter("@p")} ORDER BY `e`.`Id`, `s`.`OneId`, `s`.`TwoId`, `s`.`Id`, `s0`.`OneId`, `s0`.`TwoId` """); } @@ -76,9 +76,9 @@ public override async Task Load_collection_using_Query_with_Include_for_inverse( await base.Load_collection_using_Query_with_Include_for_inverse(async); AssertSql( - $""" -@__p_0='3' -@__p_0='3' + """ +@p='3' +@p='3' SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`ExtraId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s0`.`Id`, `s0`.`Name` FROM (`EntityOnes` AS `e` @@ -91,9 +91,9 @@ LEFT JOIN ( SELECT `e2`.`OneSkipSharedId`, `e2`.`TwoSkipSharedId`, `e3`.`Id`, `e3`.`Name` FROM `EntityOneEntityTwo` AS `e2` INNER JOIN `EntityOnes` AS `e3` ON `e2`.`OneSkipSharedId` = `e3`.`Id` - WHERE `e3`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `e3`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`TwoSkipSharedId` -WHERE `e`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `e`.`Id` = @p ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s`.`Id`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId` """); } @@ -103,9 +103,9 @@ public override async Task Load_collection_using_Query_with_Include_for_same_col await base.Load_collection_using_Query_with_Include_for_same_collection(async); AssertSql( - $""" -@__p_0='3' -@__p_0='3' + """ +@p='3' +@p='3' SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`ExtraId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s1`.`OneSkipSharedId`, `s1`.`TwoSkipSharedId`, `s1`.`Id`, `s1`.`Name`, `s1`.`OneSkipSharedId0`, `s1`.`TwoSkipSharedId0`, `s1`.`Id0`, `s1`.`CollectionInverseId`, `s1`.`ExtraId`, `s1`.`Name0`, `s1`.`ReferenceInverseId` FROM (`EntityOnes` AS `e` @@ -123,9 +123,9 @@ LEFT JOIN ( FROM `EntityOneEntityTwo` AS `e4` INNER JOIN `EntityTwos` AS `e5` ON `e4`.`TwoSkipSharedId` = `e5`.`Id` ) AS `s0` ON `e3`.`Id` = `s0`.`OneSkipSharedId` - WHERE `e3`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `e3`.`Id` = @p ) AS `s1` ON `s`.`Id` = `s1`.`TwoSkipSharedId` -WHERE `e`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `e`.`Id` = @p ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s`.`Id`, `s1`.`OneSkipSharedId`, `s1`.`TwoSkipSharedId`, `s1`.`Id`, `s1`.`OneSkipSharedId0`, `s1`.`TwoSkipSharedId0` """); } @@ -135,9 +135,9 @@ public override async Task Load_collection_using_Query_with_Include(bool async) await base.Load_collection_using_Query_with_Include(async); AssertSql( - $""" -@__p_0='3' -@__p_0='3' + """ +@p='3' +@p='3' SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`ExtraId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s0`.`Id`, `s0`.`Name`, `s1`.`ThreeId`, `s1`.`TwoId`, `s1`.`Id`, `s1`.`CollectionInverseId`, `s1`.`Name`, `s1`.`ReferenceInverseId` FROM ((`EntityOnes` AS `e` @@ -150,14 +150,14 @@ LEFT JOIN ( SELECT `e2`.`OneSkipSharedId`, `e2`.`TwoSkipSharedId`, `e3`.`Id`, `e3`.`Name` FROM `EntityOneEntityTwo` AS `e2` INNER JOIN `EntityOnes` AS `e3` ON `e2`.`OneSkipSharedId` = `e3`.`Id` - WHERE `e3`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `e3`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`TwoSkipSharedId`) LEFT JOIN ( SELECT `j`.`ThreeId`, `j`.`TwoId`, `e4`.`Id`, `e4`.`CollectionInverseId`, `e4`.`Name`, `e4`.`ReferenceInverseId` FROM `JoinTwoToThree` AS `j` INNER JOIN `EntityThrees` AS `e4` ON `j`.`ThreeId` = `e4`.`Id` ) AS `s1` ON `s`.`Id` = `s1`.`TwoId` -WHERE `e`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `e`.`Id` = @p ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s`.`Id`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s0`.`Id`, `s1`.`ThreeId`, `s1`.`TwoId` """); } @@ -167,9 +167,9 @@ public override async Task Load_collection_using_Query_with_filtered_Include(boo await base.Load_collection_using_Query_with_filtered_Include(async); AssertSql( - $""" -@__p_0='3' -@__p_0='3' + """ +@p='3' +@p='3' SELECT `s`.`Id`, `s`.`CollectionInverseId`, `s`.`ExtraId`, `s`.`Name`, `s`.`ReferenceInverseId`, `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s0`.`Id`, `s0`.`Name`, `s1`.`ThreeId`, `s1`.`TwoId`, `s1`.`Id`, `s1`.`CollectionInverseId`, `s1`.`Name`, `s1`.`ReferenceInverseId` FROM ((`EntityOnes` AS `e` @@ -182,7 +182,7 @@ LEFT JOIN ( SELECT `e2`.`OneSkipSharedId`, `e2`.`TwoSkipSharedId`, `e3`.`Id`, `e3`.`Name` FROM `EntityOneEntityTwo` AS `e2` INNER JOIN `EntityOnes` AS `e3` ON `e2`.`OneSkipSharedId` = `e3`.`Id` - WHERE `e3`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `e3`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`TwoSkipSharedId`) LEFT JOIN ( SELECT `j`.`ThreeId`, `j`.`TwoId`, `e4`.`Id`, `e4`.`CollectionInverseId`, `e4`.`Name`, `e4`.`ReferenceInverseId` @@ -190,7 +190,7 @@ LEFT JOIN ( INNER JOIN `EntityThrees` AS `e4` ON `j`.`ThreeId` = `e4`.`Id` WHERE `e4`.`Id` IN (13, 11) ) AS `s1` ON `s`.`Id` = `s1`.`TwoId` -WHERE `e`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `e`.`Id` = @p ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s`.`Id`, `s0`.`OneSkipSharedId`, `s0`.`TwoSkipSharedId`, `s0`.`Id`, `s1`.`ThreeId`, `s1`.`TwoId` """); } @@ -228,9 +228,9 @@ public override async Task Load_collection_using_Query_with_join(bool async) await base.Load_collection_using_Query_with_join(async); AssertSql( - $""" -@__p_0='3' -@__p_0='3' + """ +@p='3' +@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` FROM ((`EntityOnes` AS `e` @@ -252,9 +252,9 @@ LEFT JOIN ( SELECT `e5`.`OneSkipSharedId`, `e5`.`TwoSkipSharedId`, `e6`.`Id`, `e6`.`Name` FROM `EntityOneEntityTwo` AS `e5` INNER JOIN `EntityOnes` AS `e6` ON `e5`.`OneSkipSharedId` = `e6`.`Id` - WHERE `e6`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} + WHERE `e6`.`Id` = @p ) AS `s2` ON `s`.`Id` = `s2`.`TwoSkipSharedId` -WHERE (`e`.`Id` = {AssertSqlHelper.Parameter("@__p_0")}) AND (`s`.`Id` IS NOT NULL AND `s1`.`Id0` IS NOT NULL) +WHERE (`e`.`Id` = @p) AND (`s`.`Id` IS NOT NULL AND `s1`.`Id0` IS NOT NULL) ORDER BY `e`.`Id`, `s`.`OneSkipSharedId`, `s`.`TwoSkipSharedId`, `s`.`Id`, `s1`.`Id`, `s1`.`OneSkipSharedId`, `s1`.`TwoSkipSharedId`, `s1`.`Id0`, `s2`.`OneSkipSharedId`, `s2`.`TwoSkipSharedId` """); } diff --git a/test/EFCore.Jet.FunctionalTests/MaterializationInterceptionJetTest.cs b/test/EFCore.Jet.FunctionalTests/MaterializationInterceptionJetTest.cs index c3a5edcc..033eab75 100644 --- a/test/EFCore.Jet.FunctionalTests/MaterializationInterceptionJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/MaterializationInterceptionJetTest.cs @@ -15,7 +15,8 @@ namespace EntityFrameworkCore.Jet.FunctionalTests; -public class MaterializationInterceptionJetTest : MaterializationInterceptionTestBase +public class MaterializationInterceptionJetTest(NonSharedFixture fixture) : + MaterializationInterceptionTestBase(fixture) { public class JetLibraryContext(DbContextOptions options) : LibraryContext(options) { diff --git a/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsJetTest.cs index d78adf04..84b799f9 100644 --- a/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsJetTest.cs @@ -1362,27 +1362,7 @@ public override async Task Create_index_unique() AssertSql( """ -DECLARE @var0 sysname; -SELECT @var0 = [d].[name] -FROM [sys].[default_constraints] [d] -INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id] -WHERE ([d].[parent_object_id] = OBJECT_ID(N'[People]') AND [c].[name] = N'LastName'); -IF @var0 IS NOT NULL EXEC(N'ALTER TABLE [People] DROP CONSTRAINT [' + @var0 + '];'); -ALTER TABLE [People] ALTER COLUMN [LastName] nvarchar(450) NULL; -""", - // - """ -DECLARE @var1 sysname; -SELECT @var1 = [d].[name] -FROM [sys].[default_constraints] [d] -INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id] -WHERE ([d].[parent_object_id] = OBJECT_ID(N'[People]') AND [c].[name] = N'FirstName'); -IF @var1 IS NOT NULL EXEC(N'ALTER TABLE [People] DROP CONSTRAINT [' + @var1 + '];'); -ALTER TABLE [People] ALTER COLUMN [FirstName] nvarchar(450) NULL; -""", - // - """ -CREATE UNIQUE INDEX [IX_People_FirstName_LastName] ON [People] ([FirstName], [LastName]) WHERE [FirstName] IS NOT NULL AND [LastName] IS NOT NULL; +CREATE UNIQUE INDEX `IX_People_FirstName_LastName` ON `People` (`FirstName`, `LastName`) WITH IGNORE NULL; """); } @@ -1412,11 +1392,11 @@ public override async Task Alter_index_make_unique() AssertSql( """ -DROP INDEX [IX_People_X] ON [People]; +DROP INDEX `IX_People_X` ON `People`; """, // """ -CREATE UNIQUE INDEX [IX_People_X] ON [People] ([X]); +CREATE UNIQUE INDEX `IX_People_X` ON `People` (`X`); """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocAdvancedMappingsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocAdvancedMappingsQueryJetTest.cs index aff523eb..0ac69936 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocAdvancedMappingsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocAdvancedMappingsQueryJetTest.cs @@ -1,16 +1,17 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; namespace EntityFrameworkCore.Jet.FunctionalTests.Query; #nullable disable -public class AdHocAdvancedMappingsQueryJetTest : AdHocAdvancedMappingsQueryRelationalTestBase +public class AdHocAdvancedMappingsQueryJetTest(NonSharedFixture fixture) : AdHocAdvancedMappingsQueryRelationalTestBase(fixture) { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; @@ -90,11 +91,11 @@ public override async Task Expression_tree_constructed_via_interface_works() """, // """ -@__id_0='1' +@id='1' SELECT `p`.`Id`, `p`.`RemovableEntityId` FROM `Parents` AS `p` -WHERE `p`.`Id` = @__id_0 +WHERE `p`.`Id` = @id """); } @@ -104,14 +105,14 @@ public override async Task Double_convert_interface_created_expression_tree() AssertSql( """ -@__action_0='1' +@action='1' SELECT COUNT(*) FROM `Offers` AS `o` WHERE EXISTS ( SELECT 1 FROM `OfferActions` AS `o0` - WHERE `o`.`Id` = `o0`.`OfferId` AND `o0`.`Action` = @__action_0) + WHERE `o`.`Id` = `o0`.`OfferId` AND `o0`.`Action` = @action) """); } @@ -121,11 +122,11 @@ public override async Task Casts_are_removed_from_expression_tree_when_redundant AssertSql( """ -@__id_0='1' +@id='1' SELECT TOP 1 `m`.`Id`, `m`.`Name`, `m`.`NavigationEntityId` FROM `MockEntities` AS `m` -WHERE `m`.`Id` = @__id_0 +WHERE `m`.`Id` = @id """, // """ @@ -151,11 +152,11 @@ public override async Task Query_generates_correct_datetime2_parameter_definitio AssertSql( """ -@__parameter_0='2021-11-12T13:14:15.0000000' (DbType = DateTime) +@parameter='2021-11-12T13:14:15.0000000' (DbType = DateTime) SELECT TOP 1 `e`.`DateTime` FROM `Entities` AS `e` -WHERE `e`.`DateTime` = CDATE(@__parameter_0) +WHERE `e`.`DateTime` = CDATE(@parameter) """); } @@ -165,11 +166,11 @@ public override async Task Query_generates_correct_datetimeoffset_parameter_defi AssertSql( """ -@__parameter_0='2021-11-12T03:14:15.0000000Z' (DbType = DateTime) +@parameter='2021-11-12T03:14:15.0000000Z' (DbType = DateTime) SELECT TOP 1 `e`.`DateTimeOffset` FROM `Entities` AS `e` -WHERE `e`.`DateTimeOffset` = @__parameter_0 +WHERE `e`.`DateTimeOffset` = @parameter """); } @@ -179,11 +180,11 @@ public override async Task Query_generates_correct_timespan_parameter_definition AssertSql( """ -@__parameter_0='12:34:56.7890123' +@parameter='12:34:56.7890123' SELECT TOP 1 `e`.`TimeSpan` FROM `Entities` AS `e` -WHERE `e`.`TimeSpan` = @__parameter_0 +WHERE `e`.`TimeSpan` = @parameter """); } @@ -273,6 +274,7 @@ ORDER BY `o`.`Id` SELECT TOP 1 `o`.`Id` FROM `Offers` AS `o` WHERE `o`.`Id` = 1 + ORDER BY `o`.`Id` ) AS `o0` INNER JOIN ( SELECT `v`.`Id`, `v`.`NestedId`, `v`.`OfferId`, `v`.`payment_brutto`, `v`.`payment_netto`, `n`.`Id` AS `Id0`, `n`.`payment_brutto` AS `payment_brutto0`, `n`.`payment_netto` AS `payment_netto0` @@ -291,7 +293,7 @@ public override async Task Projecting_one_of_two_similar_complex_types_picks_the """ SELECT `a`.`Id`, `s`.`Info_Created0` AS `Created` FROM ( - SELECT TOP 10 `c`.`Id`, `b`.`AId`, `b`.`Info_Created` AS `Info_Created0` + SELECT TOP @p `c`.`Id`, `b`.`AId`, `b`.`Info_Created` AS `Info_Created0` FROM `Cs` AS `c` INNER JOIN `Bs` AS `b` ON `c`.`BId` = `b`.`Id` WHERE `b`.`AId` = 1 diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocComplexTypeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocComplexTypeQueryJetTest.cs index 20cb62c3..c7458c90 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocComplexTypeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocComplexTypeQueryJetTest.cs @@ -1,14 +1,15 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; namespace EntityFrameworkCore.Jet.FunctionalTests.Query; -public class AdHocComplexTypeQueryJetTest : AdHocComplexTypeQueryTestBase +public class AdHocComplexTypeQueryJetTest(NonSharedFixture fixture) : AdHocComplexTypeQueryTestBase(fixture) { public override async Task Complex_type_equals_parameter_with_nested_types_with_property_of_same_name() { @@ -16,13 +17,13 @@ public override async Task Complex_type_equals_parameter_with_nested_types_with_ AssertSql( """ -@__entity_equality_container_0_Id='1' (Nullable = true) -@__entity_equality_container_0_Containee1_Id='2' (Nullable = true) -@__entity_equality_container_0_Containee2_Id='3' (Nullable = true) +@entity_equality_container_Id='1' (Nullable = true) +@entity_equality_container_Containee1_Id='2' (Nullable = true) +@entity_equality_container_Containee2_Id='3' (Nullable = true) SELECT TOP 2 `e`.`Id`, `e`.`ComplexContainer_Id`, `e`.`ComplexContainer_Containee1_Id`, `e`.`ComplexContainer_Containee2_Id` FROM `EntityType` AS `e` -WHERE `e`.`ComplexContainer_Id` = @__entity_equality_container_0_Id AND `e`.`ComplexContainer_Containee1_Id` = @__entity_equality_container_0_Containee1_Id AND `e`.`ComplexContainer_Containee2_Id` = @__entity_equality_container_0_Containee2_Id +WHERE `e`.`ComplexContainer_Id` = @entity_equality_container_Id AND `e`.`ComplexContainer_Containee1_Id` = @entity_equality_container_Containee1_Id AND `e`.`ComplexContainer_Containee2_Id` = @entity_equality_container_Containee2_Id """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocJsonQueryJetTestBase.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocJsonQueryJetTestBase.cs index ceb0a379..568aed8e 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocJsonQueryJetTestBase.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocJsonQueryJetTestBase.cs @@ -24,37 +24,6 @@ protected override void ConfigureWarnings(WarningsConfigurationBuilder builder) builder.Log(CoreEventId.StringEnumValueInJson); } - protected override async Task Seed29219(DbContext ctx) - { - var entity1 = new MyEntity29219 - { - Id = 1, - Reference = new MyJsonEntity29219 { NonNullableScalar = 10, NullableScalar = 11 }, - Collection = - [ - new MyJsonEntity29219 { NonNullableScalar = 100, NullableScalar = 101 }, - new MyJsonEntity29219 { NonNullableScalar = 200, NullableScalar = 201 }, - new MyJsonEntity29219 { NonNullableScalar = 300, NullableScalar = null } - ] - }; - - var entity2 = new MyEntity29219 - { - Id = 2, - Reference = new MyJsonEntity29219 { NonNullableScalar = 20, NullableScalar = null }, - Collection = [new MyJsonEntity29219 { NonNullableScalar = 1001, NullableScalar = null }] - }; - - ctx.AddRange(entity1, entity2); - await ctx.SaveChangesAsync(); - - await ctx.Database.ExecuteSqlAsync( - $$""" -INSERT INTO [Entities] ([Id], [Reference], [Collection]) -VALUES(3, '{ "NonNullableScalar" : 30 }', '[{ "NonNullableScalar" : 10001 }]') -"""); - } - protected override async Task Seed30028(DbContext ctx) { // complete diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocManyToManyQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocManyToManyQueryJetTest.cs index b73fc21d..44e60d1b 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocManyToManyQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocManyToManyQueryJetTest.cs @@ -3,16 +3,17 @@ // ReSharper disable InconsistentNaming -using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; namespace EntityFrameworkCore.Jet.FunctionalTests.Query; #nullable disable -public class AdHocManyToManyQueryJetTest : AdHocManyToManyQueryRelationalTestBase +public class AdHocManyToManyQueryJetTest(NonSharedFixture fixture) : AdHocManyToManyQueryRelationalTestBase(fixture) { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; @@ -48,16 +49,16 @@ public override async Task Many_to_many_load_works_when_join_entity_has_custom_k AssertSql( """ -@__p_0='1' +@p='1' SELECT TOP 1 `m`.`Id` FROM `ManyM_DB` AS `m` -WHERE `m`.`Id` = @__p_0 +WHERE `m`.`Id` = @p """, // """ -@__p_0='1' -@__p_0='1' +@p='1' +@p='1' SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` FROM (`ManyM_DB` AS `m` @@ -70,23 +71,23 @@ LEFT JOIN ( SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` FROM `ManyMN_DB` AS `m2` INNER JOIN `ManyM_DB` AS `m3` ON `m2`.`ManyM_Id` = `m3`.`Id` - WHERE `m3`.`Id` = @__p_0 + WHERE `m3`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`ManyN_Id` -WHERE `m`.`Id` = @__p_0 +WHERE `m`.`Id` = @p ORDER BY `m`.`Id`, `s`.`Id0`, `s`.`Id`, `s0`.`Id` """, // """ -@__p_0='1' +@p='1' SELECT TOP 1 `m`.`Id` FROM `ManyN_DB` AS `m` -WHERE `m`.`Id` = @__p_0 +WHERE `m`.`Id` = @p """, // """ -@__p_0='1' -@__p_0='1' +@p='1' +@p='1' SELECT `s`.`Id`, `m`.`Id`, `s`.`Id0`, `s0`.`Id`, `s0`.`ManyM_Id`, `s0`.`ManyN_Id`, `s0`.`Id0` FROM (`ManyN_DB` AS `m` @@ -99,9 +100,9 @@ LEFT JOIN ( SELECT `m2`.`Id`, `m2`.`ManyM_Id`, `m2`.`ManyN_Id`, `m3`.`Id` AS `Id0` FROM `ManyMN_DB` AS `m2` INNER JOIN `ManyN_DB` AS `m3` ON `m2`.`ManyN_Id` = `m3`.`Id` - WHERE `m3`.`Id` = @__p_0 + WHERE `m3`.`Id` = @p ) AS `s0` ON `s`.`Id` = `s0`.`ManyM_Id` -WHERE `m`.`Id` = @__p_0 +WHERE `m`.`Id` = @p ORDER BY `m`.`Id`, `s`.`Id0`, `s`.`Id`, `s0`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs index 3e5cc138..1409a528 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs @@ -12,6 +12,7 @@ using System.Linq; using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using EntityFrameworkCore.Jet.Infrastructure; using EntityFrameworkCore.Jet.Infrastructure.Internal; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; @@ -25,10 +26,16 @@ namespace EntityFrameworkCore.Jet.FunctionalTests.Query; #nullable disable -public class AdHocMiscellaneousQueryJetTest : AdHocMiscellaneousQueryRelationalTestBase +public class AdHocMiscellaneousQueryJetTest(NonSharedFixture fixture) : AdHocMiscellaneousQueryRelationalTestBase(fixture) { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; + protected override DbContextOptionsBuilder SetTranslateParameterizedCollectionsToConstants(DbContextOptionsBuilder optionsBuilder) + { + new JetDbContextOptionsBuilder(optionsBuilder).TranslateParameterizedCollectionsToConstants(); + + return optionsBuilder; + } protected override Task Seed2951(Context2951 context) => context.Database.ExecuteSqlRawAsync( @@ -44,7 +51,7 @@ public virtual async Task Include_group_join_is_per_query_context() { var contextFactory = await InitializeAsync( seed: c => c.SeedAsync(), - createTestStore: async () => await JetTestStore.CreateInitializedAsync(StoreName, multipleActiveResultSets: true)); + createTestStore: () => JetTestStore.Create(StoreName)); Parallel.For( 0, 10, i => @@ -79,7 +86,7 @@ public virtual async Task Include_group_join_is_per_query_context_async() { var contextFactory = await InitializeAsync( seed: c => c.SeedAsync(), - createTestStore: async () => await JetTestStore.CreateInitializedAsync(StoreName, multipleActiveResultSets: true)); + createTestStore: () => JetTestStore.Create(StoreName)); await Parallel.ForAsync( 0, 10, async (i, ct) => @@ -186,19 +193,19 @@ public virtual async Task Select_nested_projection() """, // """ -@__id_0='1' +@id='1' SELECT TOP 2 `c`.`Id`, `c`.`Name` FROM `Customers` AS `c` -WHERE `c`.`Id` = @__id_0 +WHERE `c`.`Id` = @id """, // """ -@__id_0='2' +@id='2' SELECT TOP 2 `c`.`Id`, `c`.`Name` FROM `Customers` AS `c` -WHERE `c`.`Id` = @__id_0 +WHERE `c`.`Id` = @id """); } @@ -991,58 +998,58 @@ public override async Task Variable_from_closure_is_parametrized() AssertSql( """ -@__id_0='1' +@id='1' SELECT `e`.`Id`, `e`.`Name` FROM `Entities` AS `e` -WHERE `e`.`Id` = @__id_0 +WHERE `e`.`Id` = @id """, // """ -@__id_0='2' +@id='2' SELECT `e`.`Id`, `e`.`Name` FROM `Entities` AS `e` -WHERE `e`.`Id` = @__id_0 +WHERE `e`.`Id` = @id """, // """ -@__id_0='1' +@id='1' SELECT `e`.`Id`, `e`.`Name` FROM `Entities` AS `e` -WHERE `e`.`Id` = @__id_0 +WHERE `e`.`Id` = @id """, // """ -@__id_0='2' +@id='2' SELECT `e`.`Id`, `e`.`Name` FROM `Entities` AS `e` -WHERE `e`.`Id` = @__id_0 +WHERE `e`.`Id` = @id """, // """ -@__id_0='1' +@id='1' SELECT `e`.`Id`, `e`.`Name` FROM `Entities` AS `e` WHERE `e`.`Id` IN ( SELECT `e0`.`Id` FROM `Entities` AS `e0` - WHERE `e0`.`Id` = @__id_0 + WHERE `e0`.`Id` = @id ) """, // """ -@__id_0='2' +@id='2' SELECT `e`.`Id`, `e`.`Name` FROM `Entities` AS `e` WHERE `e`.`Id` IN ( SELECT `e0`.`Id` FROM `Entities` AS `e0` - WHERE `e0`.`Id` = @__id_0 + WHERE `e0`.`Id` = @id ) """); } @@ -1053,11 +1060,11 @@ public override async Task Relational_command_cache_creates_new_entry_when_param AssertSql( """ -@__name_0='A' (Size = 255) +@name='A' (Size = 255) SELECT `e`.`Id`, `e`.`Name` FROM `Entities` AS `e` -WHERE `e`.`Name` = @__name_0 +WHERE `e`.`Name` = @name """, // """ @@ -1192,16 +1199,16 @@ public override async Task Union_and_insert_works_correctly_together() AssertSql( """ -@__id1_0='1' -@__id2_1='2' +@id1='1' +@id2='2' SELECT `t`.`Id` FROM `Tables1` AS `t` -WHERE `t`.`Id` = @__id1_0 +WHERE `t`.`Id` = @id1 UNION SELECT `t0`.`Id` FROM `Tables2` AS `t0` -WHERE `t0`.`Id` = @__id2_1 +WHERE `t0`.`Id` = @id2 """, // """ @@ -1243,32 +1250,32 @@ public override async Task Repeated_parameters_in_generated_query_sql() AssertSql( """ -@__k_0='1' +@k='1' SELECT TOP 1 `a`.`Id`, `a`.`Name` FROM `Autos` AS `a` -WHERE `a`.`Id` = @__k_0 +WHERE `a`.`Id` = @k """, // """ -@__p_0='2' +@p='2' SELECT TOP 1 `a`.`Id`, `a`.`Name` FROM `Autos` AS `a` -WHERE `a`.`Id` = @__p_0 +WHERE `a`.`Id` = @p """, // """ -@__entity_equality_a_0_Id='1' (Nullable = true) -@__entity_equality_b_1_Id='2' (Nullable = true) -@__entity_equality_b_1_Id='2' (Nullable = true) -@__entity_equality_a_0_Id='1' (Nullable = true) +@entity_equality_a_Id='1' (Nullable = true) +@entity_equality_b_Id='2' (Nullable = true) +@entity_equality_b_Id='2' (Nullable = true) +@entity_equality_a_Id='1' (Nullable = true) SELECT `e`.`Id`, `e`.`AnotherAutoId`, `e`.`AutoId` FROM (`EqualAutos` AS `e` LEFT JOIN `Autos` AS `a` ON `e`.`AutoId` = `a`.`Id`) LEFT JOIN `Autos` AS `a0` ON `e`.`AnotherAutoId` = `a0`.`Id` -WHERE (`a`.`Id` = @__entity_equality_a_0_Id AND `a0`.`Id` = @__entity_equality_b_1_Id) OR (`a`.`Id` = @__entity_equality_b_1_Id AND `a0`.`Id` = @__entity_equality_a_0_Id) +WHERE (`a`.`Id` = @entity_equality_a_Id AND `a0`.`Id` = @entity_equality_b_Id) OR (`a`.`Id` = @entity_equality_b_Id AND `a0`.`Id` = @entity_equality_a_Id) """); } @@ -1404,29 +1411,17 @@ LEFT JOIN ( """); } - public override async Task Left_join_with_missing_key_values_on_both_sides(bool async) - { - await base.Left_join_with_missing_key_values_on_both_sides(async); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`CustomerName`, IIF(`p`.`PostcodeID` IS NULL, '', `p`.`TownName`) AS `TownName`, IIF(`p`.`PostcodeID` IS NULL, '', `p`.`PostcodeValue`) AS `PostcodeValue` -FROM `Customers` AS `c` -LEFT JOIN `Postcodes` AS `p` ON `c`.`PostcodeID` = `p`.`PostcodeID` -"""); - } - public override async Task Comparing_enum_casted_to_byte_with_int_parameter(bool async) { await base.Comparing_enum_casted_to_byte_with_int_parameter(async); AssertSql( """ -@__bitterTaste_0='1' +@bitterTaste='1' SELECT `i`.`IceCreamId`, `i`.`Name`, `i`.`Taste` FROM `IceCreams` AS `i` -WHERE `i`.`Taste` = @__bitterTaste_0 +WHERE `i`.`Taste` = @bitterTaste """); } @@ -1507,7 +1502,7 @@ public override async Task Unwrap_convert_node_over_projection_when_translating_ AssertSql( """ -@__currentUserId_0='1' +@currentUserId='1' SELECT IIF(`u`.`Id` IN ( SELECT `u0`.`Id` @@ -1516,7 +1511,7 @@ SELECT IIF(`u`.`Id` IN ( WHERE `m`.`GroupId` IN ( SELECT `m0`.`GroupId` FROM `Memberships` AS `m0` - WHERE `m0`.`UserId` = @__currentUserId_0 + WHERE `m0`.`UserId` = @currentUserId ) ), TRUE, FALSE) AS `HasAccess` FROM `Users` AS `u` @@ -1529,7 +1524,7 @@ public override async Task Unwrap_convert_node_over_projection_when_translating_ AssertSql( """ -@__currentUserId_0='1' +@currentUserId='1' SELECT IIF(`u`.`Id` IN ( SELECT `u0`.`Id` @@ -1540,7 +1535,7 @@ SELECT IIF(`u`.`Id` IN ( SELECT `g0`.`Id` FROM `Memberships` AS `m0` INNER JOIN `Groups` AS `g0` ON `m0`.`GroupId` = `g0`.`Id` - WHERE `m0`.`UserId` = @__currentUserId_0 + WHERE `m0`.`UserId` = @currentUserId ) ), TRUE, FALSE) AS `HasAccess` FROM `Users` AS `u` @@ -1553,7 +1548,7 @@ public override async Task Unwrap_convert_node_over_projection_when_translating_ AssertSql( """ -@__currentUserId_0='1' +@currentUserId='1' SELECT IIF(EXISTS ( SELECT 1 @@ -1562,7 +1557,7 @@ SELECT 1 WHERE `m`.`GroupId` IN ( SELECT `m0`.`GroupId` FROM `Memberships` AS `m0` - WHERE `m0`.`UserId` = @__currentUserId_0 + WHERE `m0`.`UserId` = @currentUserId ) AND `u0`.`Id` = `u`.`Id`), TRUE, FALSE) AS `HasAccess` FROM `Users` AS `u` """); @@ -1574,18 +1569,18 @@ public override async Task GroupBy_aggregate_on_right_side_of_join(bool async) AssertSql( """ -@__orderId_0='123456' -@__orderId_0='123456' +@orderId='123456' +@orderId='123456' SELECT `o`.`Id`, `o`.`CancellationDate`, `o`.`OrderId`, `o`.`ShippingDate` FROM `OrderItems` AS `o` INNER JOIN ( SELECT `o0`.`OrderId` AS `Key` FROM `OrderItems` AS `o0` - WHERE `o0`.`OrderId` = @__orderId_0 + WHERE `o0`.`OrderId` = @orderId GROUP BY `o0`.`OrderId` ) AS `o1` ON `o`.`OrderId` = `o1`.`Key` -WHERE `o`.`OrderId` = @__orderId_0 +WHERE `o`.`OrderId` = @orderId ORDER BY `o`.`OrderId` """); } @@ -1596,18 +1591,18 @@ public override async Task Enum_with_value_converter_matching_take_value(bool as AssertSql( """ -@__orderItemType_1='MyType1' (Nullable = false) (Size = 255) -@__orderItemType_1='MyType1' (Nullable = false) (Size = 255) +@orderItemType='MyType1' (Nullable = false) (Size = 255) +@orderItemType='MyType1' (Nullable = false) (Size = 255) SELECT `o1`.`Id`, IIF(( SELECT TOP 1 `o3`.`Price` FROM `OrderItems` AS `o3` - WHERE `o1`.`Id` = `o3`.`OrderId` AND `o3`.`Type` = @__orderItemType_1) IS NULL, 0.0, ( + WHERE `o1`.`Id` = `o3`.`OrderId` AND `o3`.`Type` = @orderItemType) IS NULL, 0.0, ( SELECT TOP 1 `o3`.`Price` FROM `OrderItems` AS `o3` - WHERE `o1`.`Id` = `o3`.`OrderId` AND `o3`.`Type` = @__orderItemType_1)) AS `SpecialSum` + WHERE `o1`.`Id` = `o3`.`OrderId` AND `o3`.`Type` = @orderItemType)) AS `SpecialSum` FROM ( - SELECT TOP 1 `o`.`Id` + SELECT TOP @p `o`.`Id` FROM `Orders` AS `o` WHERE EXISTS ( SELECT 1 @@ -1755,20 +1750,20 @@ public override async Task StoreType_for_UDF_used(bool async) await base.StoreType_for_UDF_used(async); AssertSql( - """ -@__date_0='2012-12-12T00:00:00.0000000' (DbType = DateTime) + """ +@date='2012-12-12T00:00:00.0000000' (DbType = DateTime) SELECT `m`.`Id`, `m`.`SomeDate` FROM `MyEntities` AS `m` -WHERE `m`.`SomeDate` = CDATE(@__date_0) +WHERE `m`.`SomeDate` = CDATE(@date) """, - // - """ -@__date_0='2012-12-12T00:00:00.0000000' (DbType = DateTime) + // + """ +@date='2012-12-12T00:00:00.0000000' (DbType = DateTime) SELECT `m`.`Id`, `m`.`SomeDate` FROM `MyEntities` AS `m` -WHERE `dbo`.`ModifyDate`(`m`.`SomeDate`) = CDATE(@__date_0) +WHERE `dbo`.`ModifyDate`(`m`.`SomeDate`) = CDATE(@date) """); } @@ -1777,8 +1772,8 @@ public override async Task Pushdown_does_not_add_grouping_key_to_projection_when await base.Pushdown_does_not_add_grouping_key_to_projection_when_distinct_is_applied(async); AssertSql( - """ -SELECT TOP 123456 `t`.`JSON` + """ +SELECT TOP @p `t`.`JSON` FROM `TableDatas` AS `t` INNER JOIN ( SELECT DISTINCT `i`.`Parcel` @@ -1805,4 +1800,72 @@ public override async Task Filter_on_nested_DTO_with_interface_gets_simplified_c WHERE IIF(`c0`.`Id` IS NOT NULL, `c1`.`CountryName`, NULL) = 'COUNTRY' """); } + + public override async Task Check_inlined_constants_redacting(bool async, bool enableSensitiveDataLogging) + { + await base.Check_inlined_constants_redacting(async, enableSensitiveDataLogging); + + if (!enableSensitiveDataLogging) + { + AssertSql( + """ +SELECT `t`.`Id`, `t`.`Name` +FROM `TestEntities` AS `t` +WHERE `t`.`Id` IN (?, ?, ?) +""", + // + """ +SELECT `t`.`Id`, `t`.`Name` +FROM `TestEntities` AS `t` +WHERE EXISTS ( + SELECT 1 + FROM (SELECT ? AS `Value` + FROM (SELECT COUNT(*) FROM `#Dual`) AS `i_0` + UNION + SELECT ? AS `Value` + FROM (SELECT COUNT(*) FROM `#Dual`) AS `i_1` + UNION + SELECT ? AS `Value` + FROM (SELECT COUNT(*) FROM `#Dual`) AS `i_2`) AS `i` + WHERE `i`.`Value` = `t`.`Id`) +""", + // + """ +SELECT `t`.`Id`, `t`.`Name` +FROM `TestEntities` AS `t` +WHERE ? = `t`.`Id` +"""); + } + else + { + AssertSql( + """ +SELECT `t`.`Id`, `t`.`Name` +FROM `TestEntities` AS `t` +WHERE `t`.`Id` IN (1, 2, 3) +""", + // + """ +SELECT `t`.`Id`, `t`.`Name` +FROM `TestEntities` AS `t` +WHERE EXISTS ( + SELECT 1 + FROM (SELECT 1 AS `Value` + FROM (SELECT COUNT(*) FROM `#Dual`) AS `i_0` + UNION + SELECT 2 AS `Value` + FROM (SELECT COUNT(*) FROM `#Dual`) AS `i_1` + UNION + SELECT 3 AS `Value` + FROM (SELECT COUNT(*) FROM `#Dual`) AS `i_2`) AS `i` + WHERE `i`.`Value` = `t`.`Id`) +""", + // + """ +SELECT `t`.`Id`, `t`.`Name` +FROM `TestEntities` AS `t` +WHERE 1 = `t`.`Id` +"""); + } + } } diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocNavigationsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocNavigationsQueryJetTest.cs index e80e67d3..ac87d2ec 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocNavigationsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocNavigationsQueryJetTest.cs @@ -14,7 +14,7 @@ namespace EntityFrameworkCore.Jet.FunctionalTests.Query; #nullable disable -public class AdHocNavigationsQueryJetTest : AdHocNavigationsQueryRelationalTestBase +public class AdHocNavigationsQueryJetTest(NonSharedFixture fixture) : AdHocNavigationsQueryRelationalTestBase(fixture) { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocPrecompiledQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocPrecompiledQueryJetTest.cs index 3a700515..3147ff2b 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocPrecompiledQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocPrecompiledQueryJetTest.cs @@ -13,8 +13,8 @@ namespace EntityFrameworkCore.Jet.FunctionalTests.Query; -public class AdHocPrecompiledQueryJetTest(ITestOutputHelper testOutputHelper) - : AdHocPrecompiledQueryRelationalTestBase(testOutputHelper) +public class AdHocPrecompiledQueryJetTest(NonSharedFixture fixture, ITestOutputHelper testOutputHelper) + : AdHocPrecompiledQueryRelationalTestBase(fixture, testOutputHelper) { protected override bool AlwaysPrintGeneratedSources => false; diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocQueryFiltersQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocQueryFiltersQueryJetTest.cs index 08a0273b..098a0c13 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocQueryFiltersQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocQueryFiltersQueryJetTest.cs @@ -14,7 +14,7 @@ namespace EntityFrameworkCore.Jet.FunctionalTests.Query; #nullable disable -public class AdHocQueryFiltersQueryJetTest : AdHocQueryFiltersQueryRelationalTestBase +public class AdHocQueryFiltersQueryJetTest(NonSharedFixture fixture) : AdHocQueryFiltersQueryRelationalTestBase(fixture) { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; @@ -148,27 +148,27 @@ public override async Task MultiContext_query_filter_test() AssertSql( """ -@__ef_filter__Tenant_0='0' +@ef_filter__Tenant='0' SELECT `b`.`Id`, `b`.`SomeValue` FROM `Blogs` AS `b` -WHERE `b`.`SomeValue` = @__ef_filter__Tenant_0 +WHERE `b`.`SomeValue` = @ef_filter__Tenant """, // """ -@__ef_filter__Tenant_0='1' +@ef_filter__Tenant='1' SELECT `b`.`Id`, `b`.`SomeValue` FROM `Blogs` AS `b` -WHERE `b`.`SomeValue` = @__ef_filter__Tenant_0 +WHERE `b`.`SomeValue` = @ef_filter__Tenant """, // """ -@__ef_filter__Tenant_0='2' +@ef_filter__Tenant='2' SELECT COUNT(*) FROM `Blogs` AS `b` -WHERE `b`.`SomeValue` = @__ef_filter__Tenant_0 +WHERE `b`.`SomeValue` = @ef_filter__Tenant """); } @@ -234,19 +234,19 @@ public override async Task Invoke_inside_query_filter_gets_correctly_evaluated_d AssertSql( """ -@__ef_filter__p_0='1' +@ef_filter__p='1' SELECT `e`.`Id`, `e`.`Name`, `e`.`TenantId` FROM `Entities` AS `e` -WHERE (`e`.`Name` <> 'Foo' OR `e`.`Name` IS NULL) AND `e`.`TenantId` = @__ef_filter__p_0 +WHERE (`e`.`Name` <> 'Foo' OR `e`.`Name` IS NULL) AND `e`.`TenantId` = @ef_filter__p """, // """ -@__ef_filter__p_0='2' +@ef_filter__p='2' SELECT `e`.`Id`, `e`.`Name`, `e`.`TenantId` FROM `Entities` AS `e` -WHERE (`e`.`Name` <> 'Foo' OR `e`.`Name` IS NULL) AND `e`.`TenantId` = @__ef_filter__p_0 +WHERE (`e`.`Name` <> 'Foo' OR `e`.`Name` IS NULL) AND `e`.`TenantId` = @ef_filter__p """); } @@ -263,28 +263,6 @@ public override async Task Query_filter_with_null_constant() """); } - public override async Task GroupJoin_SelectMany_gets_flattened() - { - await base.GroupJoin_SelectMany_gets_flattened(); - - AssertSql( - """ -SELECT `c`.`CustomerId`, `c`.`CustomerMembershipId` -FROM `CustomerFilters` AS `c` -WHERE ( - SELECT COUNT(*) - FROM `Customers` AS `c0` - LEFT JOIN `CustomerMemberships` AS `c1` ON `c0`.`Id` = `c1`.`CustomerId` - WHERE `c1`.`Id` IS NOT NULL AND `c0`.`Id` = `c`.`CustomerId`) > 0 -""", - // - """ -SELECT `c`.`Id`, `c`.`Name`, `c0`.`Id` AS `CustomerMembershipId`, IIF(`c0`.`Id` IS NOT NULL, `c0`.`Name`, '') AS `CustomerMembershipName` -FROM `Customers` AS `c` -LEFT JOIN `CustomerMemberships` AS `c0` ON `c`.`Id` = `c0`.`CustomerId` -"""); - } - public override async Task Group_by_multiple_aggregate_joining_different_tables(bool async) { await base.Group_by_multiple_aggregate_joining_different_tables(async); diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocQuerySplittingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocQuerySplittingQueryJetTest.cs index cd4e5d97..759d0e0d 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocQuerySplittingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocQuerySplittingQueryJetTest.cs @@ -17,7 +17,7 @@ namespace EntityFrameworkCore.Jet.FunctionalTests.Query; #nullable disable -public class AdHocQuerySplittingQueryJetTest : AdHocQuerySplittingQueryTestBase +public class AdHocQuerySplittingQueryJetTest(NonSharedFixture fixture) : AdHocQuerySplittingQueryTestBase(fixture) { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; @@ -51,8 +51,12 @@ protected override DbContextOptionsBuilder ClearQuerySplittingBehavior(DbContext return optionsBuilder; } - protected override async Task CreateTestStore25225() - => await JetTestStore.CreateInitializedAsync(StoreName, multipleActiveResultSets: true); + protected override TestStore CreateTestStore25225() + { + var testStore = JetTestStore.Create(StoreName); + testStore.UseConnectionString = true; + return testStore; + } public override async Task Can_configure_SingleQuery_at_context_level() { @@ -281,7 +285,7 @@ public virtual async Task Using_AsSplitQuery_without_multiple_active_result_sets { var contextFactory = await InitializeAsync( seed: c => c.SeedAsync(), - createTestStore: async () => await JetTestStore.CreateInitializedAsync(StoreName, multipleActiveResultSets: false)); + createTestStore: () => JetTestStore.Create(StoreName)); using var context = contextFactory.CreateContext(); context.Parents.Include(p => p.Children1).Include(p => p.Children2).AsSplitQuery().ToList(); diff --git a/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsCollectionsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsCollectionsQueryJetTest.cs index 409db966..88735ccc 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsCollectionsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsCollectionsQueryJetTest.cs @@ -208,9 +208,9 @@ public override async Task Complex_multi_include_with_order_by_and_paging(bool a """ 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`, `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`.`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 ((( - SELECT TOP 10 `l4`.`Id`, `l4`.`Date`, `l4`.`Name`, `l4`.`OneToMany_Optional_Self_Inverse1Id`, `l4`.`OneToMany_Required_Self_Inverse1Id`, `l4`.`OneToOne_Optional_Self1Id` + SELECT TOP @p0 `l4`.`Id`, `l4`.`Date`, `l4`.`Name`, `l4`.`OneToMany_Optional_Self_Inverse1Id`, `l4`.`OneToMany_Required_Self_Inverse1Id`, `l4`.`OneToOne_Optional_Self1Id` FROM ( - SELECT TOP 10 `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id` + SELECT TOP @p + @p0 `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id` FROM `LevelOne` AS `l` ORDER BY `l`.`Name` ) AS `l4` @@ -231,9 +231,9 @@ public override async Task Complex_multi_include_with_order_by_and_paging_joins_ """ 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` FROM (((( - SELECT TOP 10 `l5`.`Id`, `l5`.`Date`, `l5`.`Name`, `l5`.`OneToMany_Optional_Self_Inverse1Id`, `l5`.`OneToMany_Required_Self_Inverse1Id`, `l5`.`OneToOne_Optional_Self1Id` + SELECT TOP @p0 `l5`.`Id`, `l5`.`Date`, `l5`.`Name`, `l5`.`OneToMany_Optional_Self_Inverse1Id`, `l5`.`OneToMany_Required_Self_Inverse1Id`, `l5`.`OneToOne_Optional_Self1Id` FROM ( - SELECT TOP 10 `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id` + SELECT TOP @p + @p0 `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id` FROM `LevelOne` AS `l` ORDER BY `l`.`Name` ) AS `l5` @@ -255,9 +255,9 @@ public override async Task Complex_multi_include_with_order_by_and_paging_joins_ """ 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`, `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`.`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 ((( - SELECT TOP 10 `l4`.`Id`, `l4`.`Date`, `l4`.`Name`, `l4`.`OneToMany_Optional_Self_Inverse1Id`, `l4`.`OneToMany_Required_Self_Inverse1Id`, `l4`.`OneToOne_Optional_Self1Id` + SELECT TOP @p0 `l4`.`Id`, `l4`.`Date`, `l4`.`Name`, `l4`.`OneToMany_Optional_Self_Inverse1Id`, `l4`.`OneToMany_Required_Self_Inverse1Id`, `l4`.`OneToOne_Optional_Self1Id` FROM ( - SELECT TOP 10 `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id` + SELECT TOP @p + @p0 `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id` FROM `LevelOne` AS `l` ORDER BY `l`.`Name` ) AS `l4` diff --git a/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQueryJetTest.cs index 44b71262..922c4631 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQueryJetTest.cs @@ -2001,9 +2001,9 @@ public override async Task Complex_multi_include_with_order_by_and_paging(bool a """ 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` FROM ( - SELECT TOP 10 `l2`.`Id`, `l2`.`Date`, `l2`.`Name`, `l2`.`OneToMany_Optional_Self_Inverse1Id`, `l2`.`OneToMany_Required_Self_Inverse1Id`, `l2`.`OneToOne_Optional_Self1Id` + SELECT TOP @p0 `l2`.`Id`, `l2`.`Date`, `l2`.`Name`, `l2`.`OneToMany_Optional_Self_Inverse1Id`, `l2`.`OneToMany_Required_Self_Inverse1Id`, `l2`.`OneToOne_Optional_Self1Id` FROM ( - SELECT TOP 10 `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id` + SELECT TOP @p + @p0 `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id` FROM `LevelOne` AS `l` ORDER BY `l`.`Name` ) AS `l2` @@ -2016,9 +2016,9 @@ ORDER BY `l2`.`Name` DESC """ 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` FROM (( - SELECT TOP 10 `l4`.`Id`, `l4`.`Name` + SELECT TOP @p0 `l4`.`Id`, `l4`.`Name` FROM ( - SELECT TOP 10 `l`.`Id`, `l`.`Name` + SELECT TOP @p + @p0 `l`.`Id`, `l`.`Name` FROM `LevelOne` AS `l` ORDER BY `l`.`Name` ) AS `l4` @@ -2033,9 +2033,9 @@ ORDER BY `l4`.`Name` DESC """ 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` FROM (( - SELECT TOP 10 `l4`.`Id`, `l4`.`Name` + SELECT TOP @p0 `l4`.`Id`, `l4`.`Name` FROM ( - SELECT TOP 10 `l`.`Id`, `l`.`Name` + SELECT TOP @p + @p0 `l`.`Id`, `l`.`Name` FROM `LevelOne` AS `l` ORDER BY `l`.`Name` ) AS `l4` @@ -2056,9 +2056,9 @@ public override async Task Complex_multi_include_with_order_by_and_paging_joins_ """ 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`, `l2`.`Date`, `l2`.`Level1_Optional_Id`, `l2`.`Level1_Required_Id`, `l2`.`Name`, `l2`.`OneToMany_Optional_Inverse2Id`, `l2`.`OneToMany_Optional_Self_Inverse2Id`, `l2`.`OneToMany_Required_Inverse2Id`, `l2`.`OneToMany_Required_Self_Inverse2Id`, `l2`.`OneToOne_Optional_PK_Inverse2Id`, `l2`.`OneToOne_Optional_Self2Id` FROM (( - SELECT TOP 10 `l3`.`Id`, `l3`.`Date`, `l3`.`Name`, `l3`.`OneToMany_Optional_Self_Inverse1Id`, `l3`.`OneToMany_Required_Self_Inverse1Id`, `l3`.`OneToOne_Optional_Self1Id` + SELECT TOP @p0 `l3`.`Id`, `l3`.`Date`, `l3`.`Name`, `l3`.`OneToMany_Optional_Self_Inverse1Id`, `l3`.`OneToMany_Required_Self_Inverse1Id`, `l3`.`OneToOne_Optional_Self1Id` FROM ( - SELECT TOP 10 `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id` + SELECT TOP @p + @p0 `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id` FROM `LevelOne` AS `l` ORDER BY `l`.`Name` ) AS `l3` @@ -2072,9 +2072,9 @@ ORDER BY `l3`.`Name` DESC """ 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` FROM ((( - SELECT TOP 10 `l5`.`Id`, `l5`.`Name` + SELECT TOP @p0 `l5`.`Id`, `l5`.`Name` FROM ( - SELECT TOP 10 `l`.`Id`, `l`.`Name` + SELECT TOP @p + @p0 `l`.`Id`, `l`.`Name` FROM `LevelOne` AS `l` ORDER BY `l`.`Name` ) AS `l5` @@ -2090,9 +2090,9 @@ ORDER BY `l5`.`Name` DESC """ 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` FROM ((( - SELECT TOP 10 `l5`.`Id`, `l5`.`Name` + SELECT TOP @p0 `l5`.`Id`, `l5`.`Name` FROM ( - SELECT TOP 10 `l`.`Id`, `l`.`Name` + SELECT TOP @p + @p0 `l`.`Id`, `l`.`Name` FROM `LevelOne` AS `l` ORDER BY `l`.`Name` ) AS `l5` @@ -2114,9 +2114,9 @@ public override async Task Complex_multi_include_with_order_by_and_paging_joins_ """ 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`, `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 (( - SELECT TOP 10 `l3`.`Id`, `l3`.`Date`, `l3`.`Name`, `l3`.`OneToMany_Optional_Self_Inverse1Id`, `l3`.`OneToMany_Required_Self_Inverse1Id`, `l3`.`OneToOne_Optional_Self1Id` + SELECT TOP @p0 `l3`.`Id`, `l3`.`Date`, `l3`.`Name`, `l3`.`OneToMany_Optional_Self_Inverse1Id`, `l3`.`OneToMany_Required_Self_Inverse1Id`, `l3`.`OneToOne_Optional_Self1Id` FROM ( - SELECT TOP 10 `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id` + SELECT TOP @p + @p0 `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id` FROM `LevelOne` AS `l` ORDER BY `l`.`Name` ) AS `l3` @@ -2130,9 +2130,9 @@ ORDER BY `l3`.`Name` DESC """ 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` FROM ((( - SELECT TOP 10 `l4`.`Id`, `l4`.`Name` + SELECT TOP @p0 `l4`.`Id`, `l4`.`Name` FROM ( - SELECT TOP 10 `l`.`Id`, `l`.`Name` + SELECT TOP @p + @p0 `l`.`Id`, `l`.`Name` FROM `LevelOne` AS `l` ORDER BY `l`.`Name` ) AS `l4` @@ -3466,6 +3466,7 @@ ORDER BY `l`.`Id` SELECT TOP 1 `l`.`Id` FROM `LevelOne` AS `l` WHERE `l`.`Id` = 1 + ORDER BY `l`.`Id` ) AS `l3` INNER JOIN `LevelTwo` AS `l2` ON `l3`.`Id` = `l2`.`OneToMany_Optional_Inverse2Id` ORDER BY `l3`.`Id` diff --git a/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsQueryJetTest.cs index 14aab6be..b5834481 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsQueryJetTest.cs @@ -78,7 +78,7 @@ where l1.Id < 3 SELECT ( SELECT TOP 1 `l1`.`Name` FROM ( - SELECT DISTINCT TOP 1 `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` + SELECT TOP 1 `l0`.`Id`, `l0`.`Name` FROM `LevelThree` AS `l0` ) AS `l1` ORDER BY `l1`.`Id`) @@ -1384,14 +1384,14 @@ public override async Task Where_navigation_property_to_collection(bool isAsync) await base.Where_navigation_property_to_collection(isAsync); AssertSql( -""" + """ SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id` -WHERE ( - SELECT COUNT(*) +WHERE EXISTS ( + SELECT 1 FROM `LevelThree` AS `l1` - WHERE `l0`.`Id` IS NOT NULL AND `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id`) > 0 + WHERE `l0`.`Id` IS NOT NULL AND `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id`) """); } @@ -1400,15 +1400,15 @@ public override async Task Where_navigation_property_to_collection2(bool isAsync await base.Where_navigation_property_to_collection2(isAsync); AssertSql( - $""" - SELECT `l`.`Id`, `l`.`Level2_Optional_Id`, `l`.`Level2_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse3Id`, `l`.`OneToMany_Optional_Self_Inverse3Id`, `l`.`OneToMany_Required_Inverse3Id`, `l`.`OneToMany_Required_Self_Inverse3Id`, `l`.`OneToOne_Optional_PK_Inverse3Id`, `l`.`OneToOne_Optional_Self3Id` - FROM `LevelThree` AS `l` - INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` - WHERE ( - SELECT COUNT(*) - FROM `LevelThree` AS `l1` - WHERE `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id`) > 0 - """); + """ +SELECT `l`.`Id`, `l`.`Level2_Optional_Id`, `l`.`Level2_Required_Id`, `l`.`Name`, `l`.`OneToMany_Optional_Inverse3Id`, `l`.`OneToMany_Optional_Self_Inverse3Id`, `l`.`OneToMany_Required_Inverse3Id`, `l`.`OneToMany_Required_Self_Inverse3Id`, `l`.`OneToOne_Optional_PK_Inverse3Id`, `l`.`OneToOne_Optional_Self3Id` +FROM `LevelThree` AS `l` +INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` +WHERE EXISTS ( + SELECT 1 + FROM `LevelThree` AS `l1` + WHERE `l0`.`Id` = `l1`.`OneToMany_Optional_Inverse3Id`) +"""); } public override async Task Where_navigation_property_to_collection_of_original_entity_type(bool isAsync) @@ -1574,7 +1574,7 @@ public override async Task Order_by_key_of_projected_navigation_doesnt_get_optim """ SELECT `l1`.`Name` FROM ( - SELECT TOP 10 `l0`.`Id` AS `Id0`, `l0`.`Level1_Required_Id` + SELECT TOP @p `l0`.`Id` AS `Id0`, `l0`.`Level1_Required_Id` FROM `LevelThree` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` ORDER BY `l0`.`Id` @@ -1590,12 +1590,12 @@ public override async Task Order_by_key_of_anonymous_type_projected_navigation_d await base.Order_by_key_of_anonymous_type_projected_navigation_doesnt_get_optimized_into_FK_access_subquery(isAsync); AssertSql( - $""" - SELECT TOP 10 `l0`.`Name` - FROM `LevelThree` AS `l` - INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` - ORDER BY `l0`.`Id` - """); + """ +SELECT TOP @p `l0`.`Name` +FROM `LevelThree` AS `l` +INNER JOIN `LevelTwo` AS `l0` ON `l`.`Level2_Required_Id` = `l0`.`Id` +ORDER BY `l0`.`Id` +"""); } public override async Task Optional_navigation_take_optional_navigation(bool isAsync) @@ -1606,7 +1606,7 @@ public override async Task Optional_navigation_take_optional_navigation(bool isA """ SELECT `l1`.`Name` FROM ( - SELECT TOP 10 `l0`.`Id` AS `Id0` + SELECT TOP @p `l0`.`Id` AS `Id0` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` ORDER BY `l0`.`Id` @@ -1621,13 +1621,13 @@ public override async Task Projection_select_correct_table_from_subquery_when_ma await base.Projection_select_correct_table_from_subquery_when_materialization_is_not_required(isAsync); AssertSql( - $""" - SELECT TOP 3 `l`.`Name` - FROM `LevelTwo` AS `l` - INNER JOIN `LevelOne` AS `l0` ON `l`.`Level1_Required_Id` = `l0`.`Id` - WHERE `l0`.`Name` = 'L1 03' - ORDER BY `l`.`Id` - """); + """ +SELECT TOP @p `l`.`Name` +FROM `LevelTwo` AS `l` +INNER JOIN `LevelOne` AS `l0` ON `l`.`Level1_Required_Id` = `l0`.`Id` +WHERE `l0`.`Name` = 'L1 03' +ORDER BY `l`.`Id` +"""); } public override async Task Projection_select_correct_table_with_anonymous_projection_in_subquery(bool isAsync) @@ -1636,7 +1636,7 @@ public override async Task Projection_select_correct_table_with_anonymous_projec AssertSql( """ -SELECT TOP 3 `l`.`Name` +SELECT TOP @p `l`.`Name` FROM (`LevelTwo` AS `l` INNER JOIN `LevelOne` AS `l0` ON `l`.`Level1_Required_Id` = `l0`.`Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` @@ -1652,7 +1652,7 @@ public override async Task Projection_select_correct_table_in_subquery_when_mate AssertSql( """ -SELECT TOP 3 `l0`.`Name` +SELECT TOP @p `l0`.`Name` FROM (`LevelTwo` AS `l` INNER JOIN `LevelOne` AS `l0` ON `l`.`Level1_Required_Id` = `l0`.`Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Required_Id` @@ -1666,13 +1666,13 @@ public override async Task Where_predicate_on_optional_reference_navigation(bool await base.Where_predicate_on_optional_reference_navigation(isAsync); AssertSql( - $""" - SELECT TOP 3 `l`.`Name` - FROM `LevelOne` AS `l` - LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id` - WHERE `l0`.`Name` = 'L2 03' - ORDER BY `l`.`Id` - """); + """ +SELECT TOP @p `l`.`Name` +FROM `LevelOne` AS `l` +LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id` +WHERE `l0`.`Name` = 'L2 03' +ORDER BY `l`.`Id` +"""); } public override async Task SelectMany_with_string_based_Include1(bool isAsync) @@ -2286,7 +2286,7 @@ public override async Task GroupJoin_on_a_subquery_containing_another_GroupJoin_ """ SELECT `l1`.`Name` FROM ( - SELECT TOP 2 `l`.`Id` + 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` @@ -2311,7 +2311,7 @@ public override async Task GroupJoin_on_a_subquery_containing_another_GroupJoin_ """ SELECT `l1`.`Name` FROM ( - SELECT TOP 2 `l`.`Id`, `l0`.`Level1_Optional_Id` + SELECT TOP @p `l`.`Id`, `l0`.`Level1_Optional_Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` ORDER BY `l`.`Id` @@ -2330,7 +2330,7 @@ public override async Task GroupJoin_on_a_subquery_containing_another_GroupJoin_ """ SELECT `l1`.`Name` FROM ( - SELECT TOP 2 `l`.`Id`, `l0`.`Level1_Optional_Id` + SELECT TOP @p `l`.`Id`, `l0`.`Level1_Optional_Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` ORDER BY `l`.`Id` @@ -2346,11 +2346,11 @@ public override async Task GroupJoin_on_left_side_being_a_subquery(bool isAsync) AssertSql( """ - SELECT TOP 2 `l`.`Id`, `l0`.`Name` AS `Brand` - FROM `LevelOne` AS `l` - LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` - ORDER BY `l0`.`Name`, `l`.`Id` - """); +SELECT TOP @p `l`.`Id`, `l0`.`Name` AS `Brand` +FROM `LevelOne` AS `l` +LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` +ORDER BY `l0`.`Name`, `l`.`Id` +"""); } public override async Task GroupJoin_on_right_side_being_a_subquery(bool isAsync) @@ -2362,7 +2362,7 @@ public override async Task GroupJoin_on_right_side_being_a_subquery(bool isAsync SELECT `l`.`Id`, `s`.`Name` FROM `LevelTwo` AS `l` LEFT JOIN ( - SELECT TOP 2 `l0`.`Id`, `l0`.`Name` + SELECT TOP @p `l0`.`Id`, `l0`.`Name` FROM `LevelOne` AS `l0` LEFT JOIN `LevelTwo` AS `l1` ON `l0`.`Id` = `l1`.`Level1_Optional_Id` ORDER BY `l1`.`Name` @@ -2511,8 +2511,8 @@ public override async Task Optional_navigation_in_subquery_with_unrelated_projec await base.Optional_navigation_in_subquery_with_unrelated_projection(isAsync); AssertSql( -""" -SELECT TOP 15 `l`.`Id` + """ +SELECT TOP @p `l`.`Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` WHERE `l0`.`Name` <> 'Foo' OR `l0`.`Name` IS NULL @@ -2525,8 +2525,8 @@ public override async Task Explicit_GroupJoin_in_subquery_with_unrelated_project await base.Explicit_GroupJoin_in_subquery_with_unrelated_projection(isAsync); AssertSql( -""" -SELECT TOP 15 `l`.`Id` + """ +SELECT TOP @p `l`.`Id` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` WHERE `l0`.`Name` <> 'Foo' OR `l0`.`Name` IS NULL @@ -2569,7 +2569,7 @@ public override async Task Explicit_GroupJoin_in_subquery_with_unrelated_project AssertSql( """ -SELECT TOP 20 `s`.`Id` +SELECT TOP @p `s`.`Id` FROM ( SELECT DISTINCT `l`.`Id` FROM `LevelOne` AS `l` @@ -2622,9 +2622,9 @@ public override async Task Where_on_multilevel_reference_in_subquery_with_outer_ """ SELECT `s0`.`Name` FROM ( - SELECT TOP 10 `s`.`Name`, `s`.`Level2_Required_Id` + SELECT TOP @p0 `s`.`Name`, `s`.`Level2_Required_Id` FROM ( - SELECT TOP 10 `l`.`Name`, `l`.`Level2_Required_Id` + SELECT TOP @p + @p0 `l`.`Name`, `l`.`Level2_Required_Id` FROM (`LevelThree` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`OneToMany_Required_Inverse3Id` = `l0`.`Id`) LEFT JOIN `LevelOne` AS `l1` ON `l0`.`Level1_Required_Id` = `l1`.`Id` @@ -2669,7 +2669,7 @@ public override async Task Nested_group_join_with_take(bool isAsync) """ SELECT `l1`.`Name` FROM ( - SELECT TOP 2 `l`.`Id`, `l0`.`Id` AS `Id0` + SELECT TOP @p `l`.`Id`, `l0`.`Id` AS `Id0` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id` ORDER BY `l`.`Id` @@ -2876,7 +2876,7 @@ public override async Task Member_doesnt_get_pushed_down_into_subquery_with_resu FROM ( SELECT TOP 1 `l2`.`Name`, `l2`.`Id` FROM ( - SELECT TOP 2 `l1`.`Name`, `l1`.`Id` + SELECT TOP 1 + 1 `l1`.`Name`, `l1`.`Id` FROM ( SELECT DISTINCT `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelThree` AS `l0` @@ -2902,7 +2902,7 @@ public override async Task Subquery_with_Distinct_Skip_FirstOrDefault_without_Or FROM ( SELECT TOP 1 `l2`.`Name` FROM ( - SELECT TOP 2 `l1`.`Name` + SELECT TOP 1 + 1 `l1`.`Name` FROM ( SELECT DISTINCT `l0`.`Id`, `l0`.`Level2_Optional_Id`, `l0`.`Level2_Required_Id`, `l0`.`Name`, `l0`.`OneToMany_Optional_Inverse3Id`, `l0`.`OneToMany_Optional_Self_Inverse3Id`, `l0`.`OneToMany_Required_Inverse3Id`, `l0`.`OneToMany_Required_Self_Inverse3Id`, `l0`.`OneToOne_Optional_PK_Inverse3Id`, `l0`.`OneToOne_Optional_Self3Id` FROM `LevelThree` AS `l0` @@ -3355,7 +3355,7 @@ public override async Task Include18_1_1(bool isAsync) """ SELECT `s`.`Id`, `s`.`Date`, `s`.`Name`, `s`.`OneToMany_Optional_Self_Inverse1Id`, `s`.`OneToMany_Required_Self_Inverse1Id`, `s`.`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 ( - SELECT TOP 10 `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 TOP @p `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Name` AS `Name0` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id` ORDER BY `l0`.`Name` @@ -3391,7 +3391,7 @@ public override async Task Include18_3(bool isAsync) """ SELECT `s`.`Id`, `s`.`Date`, `s`.`Name`, `s`.`OneToMany_Optional_Self_Inverse1Id`, `s`.`OneToMany_Required_Self_Inverse1Id`, `s`.`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 ( - SELECT TOP 10 `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 TOP @p `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Name` AS `Name0` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id` ORDER BY `l0`.`Name` @@ -3410,7 +3410,7 @@ public override async Task Include18_3_1(bool isAsync) """ SELECT `s`.`Id`, `s`.`Date`, `s`.`Name`, `s`.`OneToMany_Optional_Self_Inverse1Id`, `s`.`OneToMany_Required_Self_Inverse1Id`, `s`.`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 ( - SELECT TOP 10 `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 TOP @p `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Name` AS `Name0` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id` ORDER BY `l0`.`Name` @@ -3429,7 +3429,7 @@ public override async Task Include18_3_2(bool isAsync) """ SELECT `s`.`Id`, `s`.`Date`, `s`.`Name`, `s`.`OneToMany_Optional_Self_Inverse1Id`, `s`.`OneToMany_Required_Self_Inverse1Id`, `s`.`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 ( - SELECT TOP 10 `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 TOP @p `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`, `l0`.`Name` AS `Name0` FROM `LevelOne` AS `l` LEFT JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Required_Id` ORDER BY `l0`.`Name` @@ -3480,7 +3480,7 @@ public override async Task Include18(bool isAsync) """ SELECT `l1`.`Id`, `l1`.`Date`, `l1`.`Name`, `l1`.`OneToMany_Optional_Self_Inverse1Id`, `l1`.`OneToMany_Required_Self_Inverse1Id`, `l1`.`OneToOne_Optional_Self1Id`, `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`, `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 (( - SELECT TOP 10 `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id` + SELECT TOP @p `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id` FROM `LevelOne` AS `l` ORDER BY `l`.`Id` ) AS `l1` @@ -4194,7 +4194,7 @@ public override async Task Projecting_columns_with_same_name_from_different_enti """ SELECT `s`.`Id1` AS `Foo`, `s`.`Id2` AS `Bar`, `s`.`Id3` AS `Baz` FROM ( - SELECT DISTINCT TOP 10 `l`.`Id` AS `Id1`, `l0`.`Id` AS `Id2`, `l1`.`Id` AS `Id3`, `l`.`Name` AS `Name1`, `l0`.`Name` AS `Name2` + SELECT DISTINCT TOP @p `l`.`Id` AS `Id1`, `l0`.`Id` AS `Id2`, `l1`.`Id` AS `Id3`, `l`.`Name` AS `Name1`, `l0`.`Name` AS `Name2` FROM (`LevelOne` AS `l` INNER JOIN `LevelTwo` AS `l0` ON `l`.`Id` = `l0`.`Level1_Optional_Id`) LEFT JOIN `LevelThree` AS `l1` ON `l0`.`Id` = `l1`.`Level2_Optional_Id` @@ -4571,15 +4571,15 @@ public override async Task GroupJoin_SelectMany_DefaultIfEmpty_with_predicate_us await base.GroupJoin_SelectMany_DefaultIfEmpty_with_predicate_using_closure(async); AssertSql( - $""" -@__prm_0='10' + """ +@prm='10' SELECT `l`.`Id` AS `Id1`, `l1`.`Id` AS `Id2` FROM `LevelOne` AS `l` LEFT JOIN ( SELECT `l0`.`Id`, `l0`.`Level1_Optional_Id` FROM `LevelTwo` AS `l0` - WHERE `l0`.`Id` <> {AssertSqlHelper.Parameter("@__prm_0")} + WHERE `l0`.`Id` <> @prm ) AS `l1` ON `l`.`Id` = `l1`.`Level1_Optional_Id` """); } @@ -4589,15 +4589,15 @@ public override async Task GroupJoin_SelectMany_with_predicate_using_closure(boo await base.GroupJoin_SelectMany_with_predicate_using_closure(async); AssertSql( - $""" -@__prm_0='10' + """ +@prm='10' SELECT `l`.`Id` AS `Id1`, `l1`.`Id` AS `Id2` FROM `LevelOne` AS `l` INNER JOIN ( SELECT `l0`.`Id`, `l0`.`Level1_Optional_Id` FROM `LevelTwo` AS `l0` - WHERE `l0`.`Id` <> {AssertSqlHelper.Parameter("@__prm_0")} + WHERE `l0`.`Id` <> @prm ) AS `l1` ON `l`.`Id` = `l1`.`Level1_Optional_Id` """); } @@ -4607,21 +4607,21 @@ public override async Task GroupJoin_SelectMany_DefaultIfEmpty_with_predicate_us await base.GroupJoin_SelectMany_DefaultIfEmpty_with_predicate_using_closure_nested(async); AssertSql( - $""" -@__prm1_0='10' -@__prm2_1='20' + """ +@prm1='10' +@prm2='20' SELECT `l`.`Id` AS `Id1`, `l1`.`Id` AS `Id2`, `l3`.`Id` AS `Id3` FROM (`LevelOne` AS `l` LEFT JOIN ( SELECT `l0`.`Id`, `l0`.`Level1_Optional_Id` FROM `LevelTwo` AS `l0` - WHERE `l0`.`Id` <> {AssertSqlHelper.Parameter("@__prm1_0")} + WHERE `l0`.`Id` <> @prm1 ) AS `l1` ON `l`.`Id` = `l1`.`Level1_Optional_Id`) LEFT JOIN ( SELECT `l2`.`Id`, `l2`.`Level2_Optional_Id` FROM `LevelThree` AS `l2` - WHERE `l2`.`Id` <> {AssertSqlHelper.Parameter("@__prm2_1")} + WHERE `l2`.`Id` <> @prm2 ) AS `l3` ON `l1`.`Id` = `l3`.`Level2_Optional_Id` """); } @@ -4631,21 +4631,21 @@ public override async Task GroupJoin_SelectMany_with_predicate_using_closure_nes await base.GroupJoin_SelectMany_with_predicate_using_closure_nested(async); AssertSql( - $""" -@__prm1_0='10' -@__prm2_1='20' + """ +@prm1='10' +@prm2='20' SELECT `l`.`Id` AS `Id1`, `l1`.`Id` AS `Id2`, `l3`.`Id` AS `Id3` FROM (`LevelOne` AS `l` INNER JOIN ( SELECT `l0`.`Id`, `l0`.`Level1_Optional_Id` FROM `LevelTwo` AS `l0` - WHERE `l0`.`Id` <> {AssertSqlHelper.Parameter("@__prm1_0")} + WHERE `l0`.`Id` <> @prm1 ) AS `l1` ON `l`.`Id` = `l1`.`Level1_Optional_Id`) LEFT JOIN ( SELECT `l2`.`Id`, `l2`.`Level2_Optional_Id` FROM `LevelThree` AS `l2` - WHERE `l2`.`Id` <> {AssertSqlHelper.Parameter("@__prm2_1")} + WHERE `l2`.`Id` <> @prm2 ) AS `l3` ON `l1`.`Id` = `l3`.`Level2_Optional_Id` WHERE `l1`.`Id` IS NOT NULL AND `l3`.`Level2_Optional_Id` IS NOT NULL """); @@ -4656,21 +4656,21 @@ public override async Task GroupJoin_SelectMany_DefaultIfEmpty_with_predicate_us await base.GroupJoin_SelectMany_DefaultIfEmpty_with_predicate_using_closure_nested_same_param(async); AssertSql( - $""" -@__prm_0='10' -@__prm_0='10' + """ +@prm='10' +@prm='10' SELECT `l`.`Id` AS `Id1`, `l1`.`Id` AS `Id2`, `l3`.`Id` AS `Id3` FROM (`LevelOne` AS `l` LEFT JOIN ( SELECT `l0`.`Id`, `l0`.`Level1_Optional_Id` FROM `LevelTwo` AS `l0` - WHERE `l0`.`Id` <> {AssertSqlHelper.Parameter("@__prm_0")} + WHERE `l0`.`Id` <> @prm ) AS `l1` ON `l`.`Id` = `l1`.`Level1_Optional_Id`) LEFT JOIN ( SELECT `l2`.`Id`, `l2`.`Level2_Optional_Id` FROM `LevelThree` AS `l2` - WHERE `l2`.`Id` <> {AssertSqlHelper.Parameter("@__prm_0")} + WHERE `l2`.`Id` <> @prm ) AS `l3` ON `l1`.`Id` = `l3`.`Level2_Optional_Id` """); } @@ -4680,21 +4680,21 @@ public override async Task GroupJoin_SelectMany_with_predicate_using_closure_nes await base.GroupJoin_SelectMany_with_predicate_using_closure_nested_same_param(async); AssertSql( - $""" -@__prm_0='10' -@__prm_0='10' + """ +@prm='10' +@prm='10' SELECT `l`.`Id` AS `Id1`, `l1`.`Id` AS `Id2`, `l3`.`Id` AS `Id3` FROM (`LevelOne` AS `l` INNER JOIN ( SELECT `l0`.`Id`, `l0`.`Level1_Optional_Id` FROM `LevelTwo` AS `l0` - WHERE `l0`.`Id` <> {AssertSqlHelper.Parameter("@__prm_0")} + WHERE `l0`.`Id` <> @prm ) AS `l1` ON `l`.`Id` = `l1`.`Level1_Optional_Id`) LEFT JOIN ( SELECT `l2`.`Id`, `l2`.`Level2_Optional_Id` FROM `LevelThree` AS `l2` - WHERE `l2`.`Id` <> {AssertSqlHelper.Parameter("@__prm_0")} + WHERE `l2`.`Id` <> @prm ) AS `l3` ON `l1`.`Id` = `l3`.`Level2_Optional_Id` WHERE `l1`.`Id` IS NOT NULL AND `l3`.`Level2_Optional_Id` IS NOT NULL """); @@ -4768,7 +4768,7 @@ public override async Task Max_in_multi_level_nested_subquery(bool async) """ SELECT `l4`.`Id`, `s`.`Id`, `s`.`Id0`, `s`.`Id1`, `s`.`Result` FROM ( - SELECT TOP 2 `l`.`Id` + SELECT TOP @p `l`.`Id` FROM `LevelOne` AS `l` ORDER BY `l`.`Id` ) AS `l4` diff --git a/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs index 5976bca6..d38769eb 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs @@ -240,16 +240,16 @@ public override async Task Complex_type_equals_parameter(bool async) await base.Complex_type_equals_parameter(async); AssertSql( - $""" -@__entity_equality_address_0_AddressLine1='804 S. Lakeshore Road' (Size = 255) -@__entity_equality_address_0_Tags='["foo","bar"]' (Size = 255) -@__entity_equality_address_0_ZipCode='38654' (Nullable = true) -@__entity_equality_address_0_Country_Code='US' (Size = 255) -@__entity_equality_address_0_Country_FullName='United States' (Size = 255) + """ +@entity_equality_address_AddressLine1='804 S. Lakeshore Road' (Size = 255) +@entity_equality_address_Tags='["foo","bar"]' (Size = 255) +@entity_equality_address_ZipCode='38654' (Nullable = true) +@entity_equality_address_Country_Code='US' (Size = 255) +@entity_equality_address_Country_FullName='United States' (Size = 255) SELECT `c`.`Id`, `c`.`Name`, `c`.`BillingAddress_AddressLine1`, `c`.`BillingAddress_AddressLine2`, `c`.`BillingAddress_Tags`, `c`.`BillingAddress_ZipCode`, `c`.`BillingAddress_Country_Code`, `c`.`BillingAddress_Country_FullName`, `c`.`ShippingAddress_AddressLine1`, `c`.`ShippingAddress_AddressLine2`, `c`.`ShippingAddress_Tags`, `c`.`ShippingAddress_ZipCode`, `c`.`ShippingAddress_Country_Code`, `c`.`ShippingAddress_Country_FullName` FROM `Customer` AS `c` -WHERE `c`.`ShippingAddress_AddressLine1` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_AddressLine1")} AND `c`.`ShippingAddress_AddressLine2` IS NULL AND `c`.`ShippingAddress_Tags` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_Tags")} AND `c`.`ShippingAddress_ZipCode` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_ZipCode")} AND `c`.`ShippingAddress_Country_Code` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_Country_Code")} AND `c`.`ShippingAddress_Country_FullName` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_Country_FullName")} +WHERE `c`.`ShippingAddress_AddressLine1` = @entity_equality_address_AddressLine1 AND `c`.`ShippingAddress_AddressLine2` IS NULL AND `c`.`ShippingAddress_Tags` = @entity_equality_address_Tags AND `c`.`ShippingAddress_ZipCode` = @entity_equality_address_ZipCode AND `c`.`ShippingAddress_Country_Code` = @entity_equality_address_Country_Code AND `c`.`ShippingAddress_Country_FullName` = @entity_equality_address_Country_FullName """); } @@ -272,19 +272,19 @@ public override async Task Contains_over_complex_type(bool async) await base.Contains_over_complex_type(async); AssertSql( - $""" -@__entity_equality_address_0_AddressLine1='804 S. Lakeshore Road' (Size = 255) -@__entity_equality_address_0_Tags='["foo","bar"]' (Size = 255) -@__entity_equality_address_0_ZipCode='38654' (Nullable = true) -@__entity_equality_address_0_Country_Code='US' (Size = 255) -@__entity_equality_address_0_Country_FullName='United States' (Size = 255) + """ +@entity_equality_address_AddressLine1='804 S. Lakeshore Road' (Size = 255) +@entity_equality_address_Tags='["foo","bar"]' (Size = 255) +@entity_equality_address_ZipCode='38654' (Nullable = true) +@entity_equality_address_Country_Code='US' (Size = 255) +@entity_equality_address_Country_FullName='United States' (Size = 255) SELECT `c`.`Id`, `c`.`Name`, `c`.`BillingAddress_AddressLine1`, `c`.`BillingAddress_AddressLine2`, `c`.`BillingAddress_Tags`, `c`.`BillingAddress_ZipCode`, `c`.`BillingAddress_Country_Code`, `c`.`BillingAddress_Country_FullName`, `c`.`ShippingAddress_AddressLine1`, `c`.`ShippingAddress_AddressLine2`, `c`.`ShippingAddress_Tags`, `c`.`ShippingAddress_ZipCode`, `c`.`ShippingAddress_Country_Code`, `c`.`ShippingAddress_Country_FullName` FROM `Customer` AS `c` WHERE EXISTS ( SELECT 1 FROM `Customer` AS `c0` - WHERE `c0`.`ShippingAddress_AddressLine1` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_AddressLine1")} AND `c0`.`ShippingAddress_AddressLine2` IS NULL AND `c0`.`ShippingAddress_Tags` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_Tags")} AND `c0`.`ShippingAddress_ZipCode` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_ZipCode")} AND `c0`.`ShippingAddress_Country_Code` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_Country_Code")} AND `c0`.`ShippingAddress_Country_FullName` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_Country_FullName")}) + WHERE `c0`.`ShippingAddress_AddressLine1` = @entity_equality_address_AddressLine1 AND `c0`.`ShippingAddress_AddressLine2` IS NULL AND `c0`.`ShippingAddress_Tags` = @entity_equality_address_Tags AND `c0`.`ShippingAddress_ZipCode` = @entity_equality_address_ZipCode AND `c0`.`ShippingAddress_Country_Code` = @entity_equality_address_Country_Code AND `c0`.`ShippingAddress_Country_FullName` = @entity_equality_address_Country_FullName) """); } @@ -607,15 +607,15 @@ public override async Task Struct_complex_type_equals_parameter(bool async) await base.Struct_complex_type_equals_parameter(async); AssertSql( - $""" -@__entity_equality_address_0_AddressLine1='804 S. Lakeshore Road' (Size = 255) -@__entity_equality_address_0_ZipCode='38654' (Nullable = true) -@__entity_equality_address_0_Country_Code='US' (Size = 255) -@__entity_equality_address_0_Country_FullName='United States' (Size = 255) + """ +@entity_equality_address_AddressLine1='804 S. Lakeshore Road' (Size = 255) +@entity_equality_address_ZipCode='38654' (Nullable = true) +@entity_equality_address_Country_Code='US' (Size = 255) +@entity_equality_address_Country_FullName='United States' (Size = 255) SELECT `v`.`Id`, `v`.`Name`, `v`.`BillingAddress_AddressLine1`, `v`.`BillingAddress_AddressLine2`, `v`.`BillingAddress_ZipCode`, `v`.`BillingAddress_Country_Code`, `v`.`BillingAddress_Country_FullName`, `v`.`ShippingAddress_AddressLine1`, `v`.`ShippingAddress_AddressLine2`, `v`.`ShippingAddress_ZipCode`, `v`.`ShippingAddress_Country_Code`, `v`.`ShippingAddress_Country_FullName` FROM `ValuedCustomer` AS `v` -WHERE `v`.`ShippingAddress_AddressLine1` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_AddressLine1")} AND `v`.`ShippingAddress_AddressLine2` IS NULL AND `v`.`ShippingAddress_ZipCode` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_ZipCode")} AND `v`.`ShippingAddress_Country_Code` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_Country_Code")} AND `v`.`ShippingAddress_Country_FullName` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_Country_FullName")} +WHERE `v`.`ShippingAddress_AddressLine1` = @entity_equality_address_AddressLine1 AND `v`.`ShippingAddress_AddressLine2` IS NULL AND `v`.`ShippingAddress_ZipCode` = @entity_equality_address_ZipCode AND `v`.`ShippingAddress_Country_Code` = @entity_equality_address_Country_Code AND `v`.`ShippingAddress_Country_FullName` = @entity_equality_address_Country_FullName """); } @@ -631,18 +631,18 @@ public override async Task Contains_over_struct_complex_type(bool async) await base.Contains_over_struct_complex_type(async); AssertSql( - $""" -@__entity_equality_address_0_AddressLine1='804 S. Lakeshore Road' (Size = 255) -@__entity_equality_address_0_ZipCode='38654' (Nullable = true) -@__entity_equality_address_0_Country_Code='US' (Size = 255) -@__entity_equality_address_0_Country_FullName='United States' (Size = 255) + """ +@entity_equality_address_AddressLine1='804 S. Lakeshore Road' (Size = 255) +@entity_equality_address_ZipCode='38654' (Nullable = true) +@entity_equality_address_Country_Code='US' (Size = 255) +@entity_equality_address_Country_FullName='United States' (Size = 255) SELECT `v`.`Id`, `v`.`Name`, `v`.`BillingAddress_AddressLine1`, `v`.`BillingAddress_AddressLine2`, `v`.`BillingAddress_ZipCode`, `v`.`BillingAddress_Country_Code`, `v`.`BillingAddress_Country_FullName`, `v`.`ShippingAddress_AddressLine1`, `v`.`ShippingAddress_AddressLine2`, `v`.`ShippingAddress_ZipCode`, `v`.`ShippingAddress_Country_Code`, `v`.`ShippingAddress_Country_FullName` FROM `ValuedCustomer` AS `v` WHERE EXISTS ( SELECT 1 FROM `ValuedCustomer` AS `v0` - WHERE `v0`.`ShippingAddress_AddressLine1` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_AddressLine1")} AND `v0`.`ShippingAddress_AddressLine2` IS NULL AND `v0`.`ShippingAddress_ZipCode` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_ZipCode")} AND `v0`.`ShippingAddress_Country_Code` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_Country_Code")} AND `v0`.`ShippingAddress_Country_FullName` = {AssertSqlHelper.Parameter("@__entity_equality_address_0_Country_FullName")}) + WHERE `v0`.`ShippingAddress_AddressLine1` = @entity_equality_address_AddressLine1 AND `v0`.`ShippingAddress_AddressLine2` IS NULL AND `v0`.`ShippingAddress_ZipCode` = @entity_equality_address_ZipCode AND `v0`.`ShippingAddress_Country_Code` = @entity_equality_address_Country_Code AND `v0`.`ShippingAddress_Country_FullName` = @entity_equality_address_Country_FullName) """); } @@ -907,7 +907,7 @@ public override async Task Project_same_entity_with_nested_complex_type_twice_wi FROM ( SELECT DISTINCT `s`.`Id`, `s`.`Name`, `s`.`BillingAddress_AddressLine1`, `s`.`BillingAddress_AddressLine2`, `s`.`BillingAddress_Tags`, `s`.`BillingAddress_ZipCode`, `s`.`BillingAddress_Country_Code`, `s`.`BillingAddress_Country_FullName`, `s`.`ShippingAddress_AddressLine1`, `s`.`ShippingAddress_AddressLine2`, `s`.`ShippingAddress_Tags`, `s`.`ShippingAddress_ZipCode`, `s`.`ShippingAddress_Country_Code`, `s`.`ShippingAddress_Country_FullName`, `s`.`Id0`, `s`.`Name0`, `s`.`BillingAddress_AddressLine10`, `s`.`BillingAddress_AddressLine20`, `s`.`BillingAddress_Tags0`, `s`.`BillingAddress_ZipCode0`, `s`.`BillingAddress_Country_Code0`, `s`.`BillingAddress_Country_FullName0`, `s`.`ShippingAddress_AddressLine10`, `s`.`ShippingAddress_AddressLine20`, `s`.`ShippingAddress_Tags0`, `s`.`ShippingAddress_ZipCode0`, `s`.`ShippingAddress_Country_Code0`, `s`.`ShippingAddress_Country_FullName0` FROM ( - SELECT TOP 50 `c`.`Id`, `c`.`Name`, `c`.`BillingAddress_AddressLine1`, `c`.`BillingAddress_AddressLine2`, `c`.`BillingAddress_Tags`, `c`.`BillingAddress_ZipCode`, `c`.`BillingAddress_Country_Code`, `c`.`BillingAddress_Country_FullName`, `c`.`ShippingAddress_AddressLine1`, `c`.`ShippingAddress_AddressLine2`, `c`.`ShippingAddress_Tags`, `c`.`ShippingAddress_ZipCode`, `c`.`ShippingAddress_Country_Code`, `c`.`ShippingAddress_Country_FullName`, `c0`.`Id` AS `Id0`, `c0`.`Name` AS `Name0`, `c0`.`BillingAddress_AddressLine1` AS `BillingAddress_AddressLine10`, `c0`.`BillingAddress_AddressLine2` AS `BillingAddress_AddressLine20`, `c0`.`BillingAddress_Tags` AS `BillingAddress_Tags0`, `c0`.`BillingAddress_ZipCode` AS `BillingAddress_ZipCode0`, `c0`.`BillingAddress_Country_Code` AS `BillingAddress_Country_Code0`, `c0`.`BillingAddress_Country_FullName` AS `BillingAddress_Country_FullName0`, `c0`.`ShippingAddress_AddressLine1` AS `ShippingAddress_AddressLine10`, `c0`.`ShippingAddress_AddressLine2` AS `ShippingAddress_AddressLine20`, `c0`.`ShippingAddress_Tags` AS `ShippingAddress_Tags0`, `c0`.`ShippingAddress_ZipCode` AS `ShippingAddress_ZipCode0`, `c0`.`ShippingAddress_Country_Code` AS `ShippingAddress_Country_Code0`, `c0`.`ShippingAddress_Country_FullName` AS `ShippingAddress_Country_FullName0` + SELECT TOP @p `c`.`Id`, `c`.`Name`, `c`.`BillingAddress_AddressLine1`, `c`.`BillingAddress_AddressLine2`, `c`.`BillingAddress_Tags`, `c`.`BillingAddress_ZipCode`, `c`.`BillingAddress_Country_Code`, `c`.`BillingAddress_Country_FullName`, `c`.`ShippingAddress_AddressLine1`, `c`.`ShippingAddress_AddressLine2`, `c`.`ShippingAddress_Tags`, `c`.`ShippingAddress_ZipCode`, `c`.`ShippingAddress_Country_Code`, `c`.`ShippingAddress_Country_FullName`, `c0`.`Id` AS `Id0`, `c0`.`Name` AS `Name0`, `c0`.`BillingAddress_AddressLine1` AS `BillingAddress_AddressLine10`, `c0`.`BillingAddress_AddressLine2` AS `BillingAddress_AddressLine20`, `c0`.`BillingAddress_Tags` AS `BillingAddress_Tags0`, `c0`.`BillingAddress_ZipCode` AS `BillingAddress_ZipCode0`, `c0`.`BillingAddress_Country_Code` AS `BillingAddress_Country_Code0`, `c0`.`BillingAddress_Country_FullName` AS `BillingAddress_Country_FullName0`, `c0`.`ShippingAddress_AddressLine1` AS `ShippingAddress_AddressLine10`, `c0`.`ShippingAddress_AddressLine2` AS `ShippingAddress_AddressLine20`, `c0`.`ShippingAddress_Tags` AS `ShippingAddress_Tags0`, `c0`.`ShippingAddress_ZipCode` AS `ShippingAddress_ZipCode0`, `c0`.`ShippingAddress_Country_Code` AS `ShippingAddress_Country_Code0`, `c0`.`ShippingAddress_Country_FullName` AS `ShippingAddress_Country_FullName0` FROM `Customer` AS `c`, `Customer` AS `c0` ORDER BY `c`.`Id`, `c0`.`Id` @@ -926,7 +926,7 @@ public override async Task Project_same_nested_complex_type_twice_with_double_pu FROM ( SELECT DISTINCT `s`.`BillingAddress_AddressLine1`, `s`.`BillingAddress_AddressLine2`, `s`.`BillingAddress_Tags`, `s`.`BillingAddress_ZipCode`, `s`.`BillingAddress_Country_Code`, `s`.`BillingAddress_Country_FullName`, `s`.`BillingAddress_AddressLine10`, `s`.`BillingAddress_AddressLine20`, `s`.`BillingAddress_Tags0`, `s`.`BillingAddress_ZipCode0`, `s`.`BillingAddress_Country_Code0`, `s`.`BillingAddress_Country_FullName0` FROM ( - SELECT TOP 50 `c`.`BillingAddress_AddressLine1`, `c`.`BillingAddress_AddressLine2`, `c`.`BillingAddress_Tags`, `c`.`BillingAddress_ZipCode`, `c`.`BillingAddress_Country_Code`, `c`.`BillingAddress_Country_FullName`, `c0`.`BillingAddress_AddressLine1` AS `BillingAddress_AddressLine10`, `c0`.`BillingAddress_AddressLine2` AS `BillingAddress_AddressLine20`, `c0`.`BillingAddress_Tags` AS `BillingAddress_Tags0`, `c0`.`BillingAddress_ZipCode` AS `BillingAddress_ZipCode0`, `c0`.`BillingAddress_Country_Code` AS `BillingAddress_Country_Code0`, `c0`.`BillingAddress_Country_FullName` AS `BillingAddress_Country_FullName0` + SELECT TOP @p `c`.`BillingAddress_AddressLine1`, `c`.`BillingAddress_AddressLine2`, `c`.`BillingAddress_Tags`, `c`.`BillingAddress_ZipCode`, `c`.`BillingAddress_Country_Code`, `c`.`BillingAddress_Country_FullName`, `c0`.`BillingAddress_AddressLine1` AS `BillingAddress_AddressLine10`, `c0`.`BillingAddress_AddressLine2` AS `BillingAddress_AddressLine20`, `c0`.`BillingAddress_Tags` AS `BillingAddress_Tags0`, `c0`.`BillingAddress_ZipCode` AS `BillingAddress_ZipCode0`, `c0`.`BillingAddress_Country_Code` AS `BillingAddress_Country_Code0`, `c0`.`BillingAddress_Country_FullName` AS `BillingAddress_Country_FullName0` FROM `Customer` AS `c`, `Customer` AS `c0` ORDER BY `c`.`Id`, `c0`.`Id` @@ -975,7 +975,7 @@ public override async Task Project_same_entity_with_struct_nested_complex_type_t FROM ( SELECT DISTINCT `s`.`Id`, `s`.`Name`, `s`.`BillingAddress_AddressLine1`, `s`.`BillingAddress_AddressLine2`, `s`.`BillingAddress_ZipCode`, `s`.`BillingAddress_Country_Code`, `s`.`BillingAddress_Country_FullName`, `s`.`ShippingAddress_AddressLine1`, `s`.`ShippingAddress_AddressLine2`, `s`.`ShippingAddress_ZipCode`, `s`.`ShippingAddress_Country_Code`, `s`.`ShippingAddress_Country_FullName`, `s`.`Id0`, `s`.`Name0`, `s`.`BillingAddress_AddressLine10`, `s`.`BillingAddress_AddressLine20`, `s`.`BillingAddress_ZipCode0`, `s`.`BillingAddress_Country_Code0`, `s`.`BillingAddress_Country_FullName0`, `s`.`ShippingAddress_AddressLine10`, `s`.`ShippingAddress_AddressLine20`, `s`.`ShippingAddress_ZipCode0`, `s`.`ShippingAddress_Country_Code0`, `s`.`ShippingAddress_Country_FullName0` FROM ( - SELECT TOP 50 `v`.`Id`, `v`.`Name`, `v`.`BillingAddress_AddressLine1`, `v`.`BillingAddress_AddressLine2`, `v`.`BillingAddress_ZipCode`, `v`.`BillingAddress_Country_Code`, `v`.`BillingAddress_Country_FullName`, `v`.`ShippingAddress_AddressLine1`, `v`.`ShippingAddress_AddressLine2`, `v`.`ShippingAddress_ZipCode`, `v`.`ShippingAddress_Country_Code`, `v`.`ShippingAddress_Country_FullName`, `v0`.`Id` AS `Id0`, `v0`.`Name` AS `Name0`, `v0`.`BillingAddress_AddressLine1` AS `BillingAddress_AddressLine10`, `v0`.`BillingAddress_AddressLine2` AS `BillingAddress_AddressLine20`, `v0`.`BillingAddress_ZipCode` AS `BillingAddress_ZipCode0`, `v0`.`BillingAddress_Country_Code` AS `BillingAddress_Country_Code0`, `v0`.`BillingAddress_Country_FullName` AS `BillingAddress_Country_FullName0`, `v0`.`ShippingAddress_AddressLine1` AS `ShippingAddress_AddressLine10`, `v0`.`ShippingAddress_AddressLine2` AS `ShippingAddress_AddressLine20`, `v0`.`ShippingAddress_ZipCode` AS `ShippingAddress_ZipCode0`, `v0`.`ShippingAddress_Country_Code` AS `ShippingAddress_Country_Code0`, `v0`.`ShippingAddress_Country_FullName` AS `ShippingAddress_Country_FullName0` + SELECT TOP @p `v`.`Id`, `v`.`Name`, `v`.`BillingAddress_AddressLine1`, `v`.`BillingAddress_AddressLine2`, `v`.`BillingAddress_ZipCode`, `v`.`BillingAddress_Country_Code`, `v`.`BillingAddress_Country_FullName`, `v`.`ShippingAddress_AddressLine1`, `v`.`ShippingAddress_AddressLine2`, `v`.`ShippingAddress_ZipCode`, `v`.`ShippingAddress_Country_Code`, `v`.`ShippingAddress_Country_FullName`, `v0`.`Id` AS `Id0`, `v0`.`Name` AS `Name0`, `v0`.`BillingAddress_AddressLine1` AS `BillingAddress_AddressLine10`, `v0`.`BillingAddress_AddressLine2` AS `BillingAddress_AddressLine20`, `v0`.`BillingAddress_ZipCode` AS `BillingAddress_ZipCode0`, `v0`.`BillingAddress_Country_Code` AS `BillingAddress_Country_Code0`, `v0`.`BillingAddress_Country_FullName` AS `BillingAddress_Country_FullName0`, `v0`.`ShippingAddress_AddressLine1` AS `ShippingAddress_AddressLine10`, `v0`.`ShippingAddress_AddressLine2` AS `ShippingAddress_AddressLine20`, `v0`.`ShippingAddress_ZipCode` AS `ShippingAddress_ZipCode0`, `v0`.`ShippingAddress_Country_Code` AS `ShippingAddress_Country_Code0`, `v0`.`ShippingAddress_Country_FullName` AS `ShippingAddress_Country_FullName0` FROM `ValuedCustomer` AS `v`, `ValuedCustomer` AS `v0` ORDER BY `v`.`Id`, `v0`.`Id` @@ -994,7 +994,7 @@ public override async Task Project_same_struct_nested_complex_type_twice_with_do FROM ( SELECT DISTINCT `s`.`BillingAddress_AddressLine1`, `s`.`BillingAddress_AddressLine2`, `s`.`BillingAddress_ZipCode`, `s`.`BillingAddress_Country_Code`, `s`.`BillingAddress_Country_FullName`, `s`.`BillingAddress_AddressLine10`, `s`.`BillingAddress_AddressLine20`, `s`.`BillingAddress_ZipCode0`, `s`.`BillingAddress_Country_Code0`, `s`.`BillingAddress_Country_FullName0` FROM ( - SELECT TOP 50 `v`.`BillingAddress_AddressLine1`, `v`.`BillingAddress_AddressLine2`, `v`.`BillingAddress_ZipCode`, `v`.`BillingAddress_Country_Code`, `v`.`BillingAddress_Country_FullName`, `v0`.`BillingAddress_AddressLine1` AS `BillingAddress_AddressLine10`, `v0`.`BillingAddress_AddressLine2` AS `BillingAddress_AddressLine20`, `v0`.`BillingAddress_ZipCode` AS `BillingAddress_ZipCode0`, `v0`.`BillingAddress_Country_Code` AS `BillingAddress_Country_Code0`, `v0`.`BillingAddress_Country_FullName` AS `BillingAddress_Country_FullName0` + SELECT TOP @p `v`.`BillingAddress_AddressLine1`, `v`.`BillingAddress_AddressLine2`, `v`.`BillingAddress_ZipCode`, `v`.`BillingAddress_Country_Code`, `v`.`BillingAddress_Country_FullName`, `v0`.`BillingAddress_AddressLine1` AS `BillingAddress_AddressLine10`, `v0`.`BillingAddress_AddressLine2` AS `BillingAddress_AddressLine20`, `v0`.`BillingAddress_ZipCode` AS `BillingAddress_ZipCode0`, `v0`.`BillingAddress_Country_Code` AS `BillingAddress_Country_Code0`, `v0`.`BillingAddress_Country_FullName` AS `BillingAddress_Country_FullName0` FROM `ValuedCustomer` AS `v`, `ValuedCustomer` AS `v0` ORDER BY `v`.`Id`, `v0`.`Id` @@ -1009,7 +1009,7 @@ public override async Task Union_of_same_entity_with_nested_complex_type_project AssertSql( """ -SELECT TOP 50 `u`.`Id`, `u`.`Name`, `u`.`BillingAddress_AddressLine1`, `u`.`BillingAddress_AddressLine2`, `u`.`BillingAddress_Tags`, `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_Country_Code`, `u`.`BillingAddress_Country_FullName`, `u`.`ShippingAddress_AddressLine1`, `u`.`ShippingAddress_AddressLine2`, `u`.`ShippingAddress_Tags`, `u`.`ShippingAddress_ZipCode`, `u`.`ShippingAddress_Country_Code`, `u`.`ShippingAddress_Country_FullName`, `u`.`Id0`, `u`.`Name0`, `u`.`BillingAddress_AddressLine10`, `u`.`BillingAddress_AddressLine20`, `u`.`BillingAddress_Tags0`, `u`.`BillingAddress_ZipCode0`, `u`.`BillingAddress_Country_Code0`, `u`.`BillingAddress_Country_FullName0`, `u`.`ShippingAddress_AddressLine10`, `u`.`ShippingAddress_AddressLine20`, `u`.`ShippingAddress_Tags0`, `u`.`ShippingAddress_ZipCode0`, `u`.`ShippingAddress_Country_Code0`, `u`.`ShippingAddress_Country_FullName0` +SELECT TOP @p `u`.`Id`, `u`.`Name`, `u`.`BillingAddress_AddressLine1`, `u`.`BillingAddress_AddressLine2`, `u`.`BillingAddress_Tags`, `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_Country_Code`, `u`.`BillingAddress_Country_FullName`, `u`.`ShippingAddress_AddressLine1`, `u`.`ShippingAddress_AddressLine2`, `u`.`ShippingAddress_Tags`, `u`.`ShippingAddress_ZipCode`, `u`.`ShippingAddress_Country_Code`, `u`.`ShippingAddress_Country_FullName`, `u`.`Id0`, `u`.`Name0`, `u`.`BillingAddress_AddressLine10`, `u`.`BillingAddress_AddressLine20`, `u`.`BillingAddress_Tags0`, `u`.`BillingAddress_ZipCode0`, `u`.`BillingAddress_Country_Code0`, `u`.`BillingAddress_Country_FullName0`, `u`.`ShippingAddress_AddressLine10`, `u`.`ShippingAddress_AddressLine20`, `u`.`ShippingAddress_Tags0`, `u`.`ShippingAddress_ZipCode0`, `u`.`ShippingAddress_Country_Code0`, `u`.`ShippingAddress_Country_FullName0` FROM ( SELECT `c`.`Id`, `c`.`Name`, `c`.`BillingAddress_AddressLine1`, `c`.`BillingAddress_AddressLine2`, `c`.`BillingAddress_Tags`, `c`.`BillingAddress_ZipCode`, `c`.`BillingAddress_Country_Code`, `c`.`BillingAddress_Country_FullName`, `c`.`ShippingAddress_AddressLine1`, `c`.`ShippingAddress_AddressLine2`, `c`.`ShippingAddress_Tags`, `c`.`ShippingAddress_ZipCode`, `c`.`ShippingAddress_Country_Code`, `c`.`ShippingAddress_Country_FullName`, `c0`.`Id` AS `Id0`, `c0`.`Name` AS `Name0`, `c0`.`BillingAddress_AddressLine1` AS `BillingAddress_AddressLine10`, `c0`.`BillingAddress_AddressLine2` AS `BillingAddress_AddressLine20`, `c0`.`BillingAddress_Tags` AS `BillingAddress_Tags0`, `c0`.`BillingAddress_ZipCode` AS `BillingAddress_ZipCode0`, `c0`.`BillingAddress_Country_Code` AS `BillingAddress_Country_Code0`, `c0`.`BillingAddress_Country_FullName` AS `BillingAddress_Country_FullName0`, `c0`.`ShippingAddress_AddressLine1` AS `ShippingAddress_AddressLine10`, `c0`.`ShippingAddress_AddressLine2` AS `ShippingAddress_AddressLine20`, `c0`.`ShippingAddress_Tags` AS `ShippingAddress_Tags0`, `c0`.`ShippingAddress_ZipCode` AS `ShippingAddress_ZipCode0`, `c0`.`ShippingAddress_Country_Code` AS `ShippingAddress_Country_Code0`, `c0`.`ShippingAddress_Country_FullName` AS `ShippingAddress_Country_FullName0` FROM `Customer` AS `c`, @@ -1029,11 +1029,11 @@ public override async Task Union_of_same_entity_with_nested_complex_type_project AssertSql( """ -SELECT TOP 50 `u1`.`Id`, `u1`.`Name`, `u1`.`BillingAddress_AddressLine1`, `u1`.`BillingAddress_AddressLine2`, `u1`.`BillingAddress_Tags`, `u1`.`BillingAddress_ZipCode`, `u1`.`BillingAddress_Country_Code`, `u1`.`BillingAddress_Country_FullName`, `u1`.`ShippingAddress_AddressLine1`, `u1`.`ShippingAddress_AddressLine2`, `u1`.`ShippingAddress_Tags`, `u1`.`ShippingAddress_ZipCode`, `u1`.`ShippingAddress_Country_Code`, `u1`.`ShippingAddress_Country_FullName`, `u1`.`Id0`, `u1`.`Name0`, `u1`.`BillingAddress_AddressLine10`, `u1`.`BillingAddress_AddressLine20`, `u1`.`BillingAddress_Tags0`, `u1`.`BillingAddress_ZipCode0`, `u1`.`BillingAddress_Country_Code0`, `u1`.`BillingAddress_Country_FullName0`, `u1`.`ShippingAddress_AddressLine10`, `u1`.`ShippingAddress_AddressLine20`, `u1`.`ShippingAddress_Tags0`, `u1`.`ShippingAddress_ZipCode0`, `u1`.`ShippingAddress_Country_Code0`, `u1`.`ShippingAddress_Country_FullName0` +SELECT TOP @p `u1`.`Id`, `u1`.`Name`, `u1`.`BillingAddress_AddressLine1`, `u1`.`BillingAddress_AddressLine2`, `u1`.`BillingAddress_Tags`, `u1`.`BillingAddress_ZipCode`, `u1`.`BillingAddress_Country_Code`, `u1`.`BillingAddress_Country_FullName`, `u1`.`ShippingAddress_AddressLine1`, `u1`.`ShippingAddress_AddressLine2`, `u1`.`ShippingAddress_Tags`, `u1`.`ShippingAddress_ZipCode`, `u1`.`ShippingAddress_Country_Code`, `u1`.`ShippingAddress_Country_FullName`, `u1`.`Id0`, `u1`.`Name0`, `u1`.`BillingAddress_AddressLine10`, `u1`.`BillingAddress_AddressLine20`, `u1`.`BillingAddress_Tags0`, `u1`.`BillingAddress_ZipCode0`, `u1`.`BillingAddress_Country_Code0`, `u1`.`BillingAddress_Country_FullName0`, `u1`.`ShippingAddress_AddressLine10`, `u1`.`ShippingAddress_AddressLine20`, `u1`.`ShippingAddress_Tags0`, `u1`.`ShippingAddress_ZipCode0`, `u1`.`ShippingAddress_Country_Code0`, `u1`.`ShippingAddress_Country_FullName0` FROM ( SELECT DISTINCT `u0`.`Id`, `u0`.`Name`, `u0`.`BillingAddress_AddressLine1`, `u0`.`BillingAddress_AddressLine2`, `u0`.`BillingAddress_Tags`, `u0`.`BillingAddress_ZipCode`, `u0`.`BillingAddress_Country_Code`, `u0`.`BillingAddress_Country_FullName`, `u0`.`ShippingAddress_AddressLine1`, `u0`.`ShippingAddress_AddressLine2`, `u0`.`ShippingAddress_Tags`, `u0`.`ShippingAddress_ZipCode`, `u0`.`ShippingAddress_Country_Code`, `u0`.`ShippingAddress_Country_FullName`, `u0`.`Id0`, `u0`.`Name0`, `u0`.`BillingAddress_AddressLine10`, `u0`.`BillingAddress_AddressLine20`, `u0`.`BillingAddress_Tags0`, `u0`.`BillingAddress_ZipCode0`, `u0`.`BillingAddress_Country_Code0`, `u0`.`BillingAddress_Country_FullName0`, `u0`.`ShippingAddress_AddressLine10`, `u0`.`ShippingAddress_AddressLine20`, `u0`.`ShippingAddress_Tags0`, `u0`.`ShippingAddress_ZipCode0`, `u0`.`ShippingAddress_Country_Code0`, `u0`.`ShippingAddress_Country_FullName0` FROM ( - SELECT TOP 50 `u`.`Id`, `u`.`Name`, `u`.`BillingAddress_AddressLine1`, `u`.`BillingAddress_AddressLine2`, `u`.`BillingAddress_Tags`, `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_Country_Code`, `u`.`BillingAddress_Country_FullName`, `u`.`ShippingAddress_AddressLine1`, `u`.`ShippingAddress_AddressLine2`, `u`.`ShippingAddress_Tags`, `u`.`ShippingAddress_ZipCode`, `u`.`ShippingAddress_Country_Code`, `u`.`ShippingAddress_Country_FullName`, `u`.`Id0`, `u`.`Name0`, `u`.`BillingAddress_AddressLine10`, `u`.`BillingAddress_AddressLine20`, `u`.`BillingAddress_Tags0`, `u`.`BillingAddress_ZipCode0`, `u`.`BillingAddress_Country_Code0`, `u`.`BillingAddress_Country_FullName0`, `u`.`ShippingAddress_AddressLine10`, `u`.`ShippingAddress_AddressLine20`, `u`.`ShippingAddress_Tags0`, `u`.`ShippingAddress_ZipCode0`, `u`.`ShippingAddress_Country_Code0`, `u`.`ShippingAddress_Country_FullName0` + SELECT TOP @p `u`.`Id`, `u`.`Name`, `u`.`BillingAddress_AddressLine1`, `u`.`BillingAddress_AddressLine2`, `u`.`BillingAddress_Tags`, `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_Country_Code`, `u`.`BillingAddress_Country_FullName`, `u`.`ShippingAddress_AddressLine1`, `u`.`ShippingAddress_AddressLine2`, `u`.`ShippingAddress_Tags`, `u`.`ShippingAddress_ZipCode`, `u`.`ShippingAddress_Country_Code`, `u`.`ShippingAddress_Country_FullName`, `u`.`Id0`, `u`.`Name0`, `u`.`BillingAddress_AddressLine10`, `u`.`BillingAddress_AddressLine20`, `u`.`BillingAddress_Tags0`, `u`.`BillingAddress_ZipCode0`, `u`.`BillingAddress_Country_Code0`, `u`.`BillingAddress_Country_FullName0`, `u`.`ShippingAddress_AddressLine10`, `u`.`ShippingAddress_AddressLine20`, `u`.`ShippingAddress_Tags0`, `u`.`ShippingAddress_ZipCode0`, `u`.`ShippingAddress_Country_Code0`, `u`.`ShippingAddress_Country_FullName0` FROM ( SELECT `c`.`Id`, `c`.`Name`, `c`.`BillingAddress_AddressLine1`, `c`.`BillingAddress_AddressLine2`, `c`.`BillingAddress_Tags`, `c`.`BillingAddress_ZipCode`, `c`.`BillingAddress_Country_Code`, `c`.`BillingAddress_Country_FullName`, `c`.`ShippingAddress_AddressLine1`, `c`.`ShippingAddress_AddressLine2`, `c`.`ShippingAddress_Tags`, `c`.`ShippingAddress_ZipCode`, `c`.`ShippingAddress_Country_Code`, `c`.`ShippingAddress_Country_FullName`, `c0`.`Id` AS `Id0`, `c0`.`Name` AS `Name0`, `c0`.`BillingAddress_AddressLine1` AS `BillingAddress_AddressLine10`, `c0`.`BillingAddress_AddressLine2` AS `BillingAddress_AddressLine20`, `c0`.`BillingAddress_Tags` AS `BillingAddress_Tags0`, `c0`.`BillingAddress_ZipCode` AS `BillingAddress_ZipCode0`, `c0`.`BillingAddress_Country_Code` AS `BillingAddress_Country_Code0`, `c0`.`BillingAddress_Country_FullName` AS `BillingAddress_Country_FullName0`, `c0`.`ShippingAddress_AddressLine1` AS `ShippingAddress_AddressLine10`, `c0`.`ShippingAddress_AddressLine2` AS `ShippingAddress_AddressLine20`, `c0`.`ShippingAddress_Tags` AS `ShippingAddress_Tags0`, `c0`.`ShippingAddress_ZipCode` AS `ShippingAddress_ZipCode0`, `c0`.`ShippingAddress_Country_Code` AS `ShippingAddress_Country_Code0`, `c0`.`ShippingAddress_Country_FullName` AS `ShippingAddress_Country_FullName0` FROM `Customer` AS `c`, @@ -1056,7 +1056,7 @@ public override async Task Union_of_same_nested_complex_type_projected_twice_wit AssertSql( """ -SELECT TOP 50 `u`.`BillingAddress_AddressLine1`, `u`.`BillingAddress_AddressLine2`, `u`.`BillingAddress_Tags`, `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_Country_Code`, `u`.`BillingAddress_Country_FullName`, `u`.`BillingAddress_AddressLine10`, `u`.`BillingAddress_AddressLine20`, `u`.`BillingAddress_Tags0`, `u`.`BillingAddress_ZipCode0`, `u`.`BillingAddress_Country_Code0`, `u`.`BillingAddress_Country_FullName0` +SELECT TOP @p `u`.`BillingAddress_AddressLine1`, `u`.`BillingAddress_AddressLine2`, `u`.`BillingAddress_Tags`, `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_Country_Code`, `u`.`BillingAddress_Country_FullName`, `u`.`BillingAddress_AddressLine10`, `u`.`BillingAddress_AddressLine20`, `u`.`BillingAddress_Tags0`, `u`.`BillingAddress_ZipCode0`, `u`.`BillingAddress_Country_Code0`, `u`.`BillingAddress_Country_FullName0` FROM ( SELECT `c`.`BillingAddress_AddressLine1`, `c`.`BillingAddress_AddressLine2`, `c`.`BillingAddress_Tags`, `c`.`BillingAddress_ZipCode`, `c`.`BillingAddress_Country_Code`, `c`.`BillingAddress_Country_FullName`, `c0`.`BillingAddress_AddressLine1` AS `BillingAddress_AddressLine10`, `c0`.`BillingAddress_AddressLine2` AS `BillingAddress_AddressLine20`, `c0`.`BillingAddress_Tags` AS `BillingAddress_Tags0`, `c0`.`BillingAddress_ZipCode` AS `BillingAddress_ZipCode0`, `c0`.`BillingAddress_Country_Code` AS `BillingAddress_Country_Code0`, `c0`.`BillingAddress_Country_FullName` AS `BillingAddress_Country_FullName0` FROM `Customer` AS `c`, @@ -1076,11 +1076,11 @@ public override async Task Union_of_same_nested_complex_type_projected_twice_wit AssertSql( """ -SELECT TOP 50 `u1`.`BillingAddress_AddressLine1`, `u1`.`BillingAddress_AddressLine2`, `u1`.`BillingAddress_Tags`, `u1`.`BillingAddress_ZipCode`, `u1`.`BillingAddress_Country_Code`, `u1`.`BillingAddress_Country_FullName`, `u1`.`BillingAddress_AddressLine10`, `u1`.`BillingAddress_AddressLine20`, `u1`.`BillingAddress_Tags0`, `u1`.`BillingAddress_ZipCode0`, `u1`.`BillingAddress_Country_Code0`, `u1`.`BillingAddress_Country_FullName0` +SELECT TOP @p `u1`.`BillingAddress_AddressLine1`, `u1`.`BillingAddress_AddressLine2`, `u1`.`BillingAddress_Tags`, `u1`.`BillingAddress_ZipCode`, `u1`.`BillingAddress_Country_Code`, `u1`.`BillingAddress_Country_FullName`, `u1`.`BillingAddress_AddressLine10`, `u1`.`BillingAddress_AddressLine20`, `u1`.`BillingAddress_Tags0`, `u1`.`BillingAddress_ZipCode0`, `u1`.`BillingAddress_Country_Code0`, `u1`.`BillingAddress_Country_FullName0` FROM ( SELECT DISTINCT `u0`.`BillingAddress_AddressLine1`, `u0`.`BillingAddress_AddressLine2`, `u0`.`BillingAddress_Tags`, `u0`.`BillingAddress_ZipCode`, `u0`.`BillingAddress_Country_Code`, `u0`.`BillingAddress_Country_FullName`, `u0`.`BillingAddress_AddressLine10`, `u0`.`BillingAddress_AddressLine20`, `u0`.`BillingAddress_Tags0`, `u0`.`BillingAddress_ZipCode0`, `u0`.`BillingAddress_Country_Code0`, `u0`.`BillingAddress_Country_FullName0` FROM ( - SELECT TOP 50 `u`.`BillingAddress_AddressLine1`, `u`.`BillingAddress_AddressLine2`, `u`.`BillingAddress_Tags`, `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_Country_Code`, `u`.`BillingAddress_Country_FullName`, `u`.`BillingAddress_AddressLine10`, `u`.`BillingAddress_AddressLine20`, `u`.`BillingAddress_Tags0`, `u`.`BillingAddress_ZipCode0`, `u`.`BillingAddress_Country_Code0`, `u`.`BillingAddress_Country_FullName0` + SELECT TOP @p `u`.`BillingAddress_AddressLine1`, `u`.`BillingAddress_AddressLine2`, `u`.`BillingAddress_Tags`, `u`.`BillingAddress_ZipCode`, `u`.`BillingAddress_Country_Code`, `u`.`BillingAddress_Country_FullName`, `u`.`BillingAddress_AddressLine10`, `u`.`BillingAddress_AddressLine20`, `u`.`BillingAddress_Tags0`, `u`.`BillingAddress_ZipCode0`, `u`.`BillingAddress_Country_Code0`, `u`.`BillingAddress_Country_FullName0` FROM ( SELECT `c`.`BillingAddress_AddressLine1`, `c`.`BillingAddress_AddressLine2`, `c`.`BillingAddress_Tags`, `c`.`BillingAddress_ZipCode`, `c`.`BillingAddress_Country_Code`, `c`.`BillingAddress_Country_FullName`, `c0`.`BillingAddress_AddressLine1` AS `BillingAddress_AddressLine10`, `c0`.`BillingAddress_AddressLine2` AS `BillingAddress_AddressLine20`, `c0`.`BillingAddress_Tags` AS `BillingAddress_Tags0`, `c0`.`BillingAddress_ZipCode` AS `BillingAddress_ZipCode0`, `c0`.`BillingAddress_Country_Code` AS `BillingAddress_Country_Code0`, `c0`.`BillingAddress_Country_FullName` AS `BillingAddress_Country_FullName0` FROM `Customer` AS `c`, @@ -1210,7 +1210,7 @@ public override async Task Projecting_complex_from_optional_navigation_using_con FROM ( SELECT DISTINCT `s`.`ShippingAddress_AddressLine1`, `s`.`ShippingAddress_AddressLine2`, `s`.`ShippingAddress_Tags`, `s`.`ShippingAddress_ZipCode`, `s`.`ShippingAddress_Country_Code`, `s`.`ShippingAddress_Country_FullName` FROM ( - SELECT TOP 20 `c0`.`ShippingAddress_AddressLine1`, `c0`.`ShippingAddress_AddressLine2`, `c0`.`ShippingAddress_Tags`, `c0`.`ShippingAddress_ZipCode`, `c0`.`ShippingAddress_Country_Code`, `c0`.`ShippingAddress_Country_FullName` + SELECT TOP @p `c0`.`ShippingAddress_AddressLine1`, `c0`.`ShippingAddress_AddressLine2`, `c0`.`ShippingAddress_Tags`, `c0`.`ShippingAddress_ZipCode`, `c0`.`ShippingAddress_Country_Code`, `c0`.`ShippingAddress_Country_FullName` FROM `CustomerGroup` AS `c` LEFT JOIN `Customer` AS `c0` ON `c`.`OptionalCustomerId` = `c0`.`Id` ORDER BY `c0`.`ShippingAddress_ZipCode` @@ -1229,7 +1229,7 @@ public override async Task Project_entity_with_complex_type_pushdown_and_then_le FROM ( SELECT DISTINCT `c0`.`Id`, `c0`.`Name`, `c0`.`BillingAddress_AddressLine1`, `c0`.`BillingAddress_AddressLine2`, `c0`.`BillingAddress_Tags`, `c0`.`BillingAddress_ZipCode`, `c0`.`BillingAddress_Country_Code`, `c0`.`BillingAddress_Country_FullName`, `c0`.`ShippingAddress_AddressLine1`, `c0`.`ShippingAddress_AddressLine2`, `c0`.`ShippingAddress_Tags`, `c0`.`ShippingAddress_ZipCode`, `c0`.`ShippingAddress_Country_Code`, `c0`.`ShippingAddress_Country_FullName` FROM ( - SELECT TOP 20 `c`.`Id`, `c`.`Name`, `c`.`BillingAddress_AddressLine1`, `c`.`BillingAddress_AddressLine2`, `c`.`BillingAddress_Tags`, `c`.`BillingAddress_ZipCode`, `c`.`BillingAddress_Country_Code`, `c`.`BillingAddress_Country_FullName`, `c`.`ShippingAddress_AddressLine1`, `c`.`ShippingAddress_AddressLine2`, `c`.`ShippingAddress_Tags`, `c`.`ShippingAddress_ZipCode`, `c`.`ShippingAddress_Country_Code`, `c`.`ShippingAddress_Country_FullName` + SELECT TOP @p `c`.`Id`, `c`.`Name`, `c`.`BillingAddress_AddressLine1`, `c`.`BillingAddress_AddressLine2`, `c`.`BillingAddress_Tags`, `c`.`BillingAddress_ZipCode`, `c`.`BillingAddress_Country_Code`, `c`.`BillingAddress_Country_FullName`, `c`.`ShippingAddress_AddressLine1`, `c`.`ShippingAddress_AddressLine2`, `c`.`ShippingAddress_Tags`, `c`.`ShippingAddress_ZipCode`, `c`.`ShippingAddress_Country_Code`, `c`.`ShippingAddress_Country_FullName` FROM `Customer` AS `c` ORDER BY `c`.`Id` ) AS `c0` @@ -1237,7 +1237,7 @@ ORDER BY `c`.`Id` LEFT JOIN ( SELECT DISTINCT `c2`.`Id`, `c2`.`Name`, `c2`.`BillingAddress_AddressLine1`, `c2`.`BillingAddress_AddressLine2`, `c2`.`BillingAddress_Tags`, `c2`.`BillingAddress_ZipCode`, `c2`.`BillingAddress_Country_Code`, `c2`.`BillingAddress_Country_FullName`, `c2`.`ShippingAddress_AddressLine1`, `c2`.`ShippingAddress_AddressLine2`, `c2`.`ShippingAddress_Tags`, `c2`.`ShippingAddress_ZipCode`, `c2`.`ShippingAddress_Country_Code`, `c2`.`ShippingAddress_Country_FullName` FROM ( - SELECT TOP 30 `c1`.`Id`, `c1`.`Name`, `c1`.`BillingAddress_AddressLine1`, `c1`.`BillingAddress_AddressLine2`, `c1`.`BillingAddress_Tags`, `c1`.`BillingAddress_ZipCode`, `c1`.`BillingAddress_Country_Code`, `c1`.`BillingAddress_Country_FullName`, `c1`.`ShippingAddress_AddressLine1`, `c1`.`ShippingAddress_AddressLine2`, `c1`.`ShippingAddress_Tags`, `c1`.`ShippingAddress_ZipCode`, `c1`.`ShippingAddress_Country_Code`, `c1`.`ShippingAddress_Country_FullName` + SELECT TOP @p0 `c1`.`Id`, `c1`.`Name`, `c1`.`BillingAddress_AddressLine1`, `c1`.`BillingAddress_AddressLine2`, `c1`.`BillingAddress_Tags`, `c1`.`BillingAddress_ZipCode`, `c1`.`BillingAddress_Country_Code`, `c1`.`BillingAddress_Country_FullName`, `c1`.`ShippingAddress_AddressLine1`, `c1`.`ShippingAddress_AddressLine2`, `c1`.`ShippingAddress_Tags`, `c1`.`ShippingAddress_ZipCode`, `c1`.`ShippingAddress_Country_Code`, `c1`.`ShippingAddress_Country_FullName` FROM `Customer` AS `c1` ORDER BY `c1`.`Id` DESC ) AS `c2` diff --git a/test/EFCore.Jet.FunctionalTests/Query/DbFunctionsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/DbFunctionsJetTest.cs index 0a6da712..19873478 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/DbFunctionsJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/DbFunctionsJetTest.cs @@ -506,30 +506,6 @@ public void IsDate_should_throw_on_client_eval() exIsDate.Message); } - public override async Task Random_return_less_than_1(bool async) - { - await base.Random_return_less_than_1(async); - - AssertSql( - """ -SELECT COUNT(*) -FROM `Orders` AS `o` -WHERE Rnd() < 1.0 -"""); - } - - public override async Task Random_return_greater_than_0(bool async) - { - await base.Random_return_greater_than_0(async); - - AssertSql( - """ -SELECT COUNT(*) -FROM `Orders` AS `o` -WHERE Rnd() >= 0.0 -"""); - } - private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); diff --git a/test/EFCore.Jet.FunctionalTests/Query/Ef6GroupByJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Ef6GroupByJetTest.cs index 999b4da2..26a72faf 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Ef6GroupByJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Ef6GroupByJetTest.cs @@ -764,9 +764,9 @@ public override async Task Whats_new_2021_sample_7(bool async) await base.Whats_new_2021_sample_7(async); AssertSql( -$""" -@__size_0='11' -@__size_0='11' + """ +@size='11' +@size='11' SELECT `p0`.`LastName`, `f`.`Size`, ( SELECT MIN(`f1`.`Size`) @@ -774,11 +774,11 @@ SELECT MIN(`f1`.`Size`) LEFT JOIN `Feet` AS `f0` ON `p1`.`Id` = `f0`.`Id`) LEFT JOIN `Person` AS `p2` ON `f0`.`Id` = `p2`.`Id`) LEFT JOIN `Feet` AS `f1` ON `p1`.`Id` = `f1`.`Id` - WHERE `f0`.`Size` = {AssertSqlHelper.Parameter("@__size_0")} AND `p1`.`MiddleInitial` IS NOT NULL AND (`f0`.`Id` <> 1 OR `f0`.`Id` IS NULL) AND (`f`.`Size` = `f0`.`Size` OR (`f`.`Size` IS NULL AND `f0`.`Size` IS NULL)) AND (`p0`.`LastName` = `p2`.`LastName` OR (`p0`.`LastName` IS NULL AND `p2`.`LastName` IS NULL))) AS `Min` + WHERE `f0`.`Size` = @size AND `p1`.`MiddleInitial` IS NOT NULL AND (`f0`.`Id` <> 1 OR `f0`.`Id` IS NULL) AND (`f`.`Size` = `f0`.`Size` OR (`f`.`Size` IS NULL AND `f0`.`Size` IS NULL)) AND (`p0`.`LastName` = `p2`.`LastName` OR (`p0`.`LastName` IS NULL AND `p2`.`LastName` IS NULL))) AS `Min` FROM (`Person` AS `p` LEFT JOIN `Feet` AS `f` ON `p`.`Id` = `f`.`Id`) LEFT JOIN `Person` AS `p0` ON `f`.`Id` = `p0`.`Id` -WHERE `f`.`Size` = {AssertSqlHelper.Parameter("@__size_0")} AND `p`.`MiddleInitial` IS NOT NULL AND (`f`.`Id` <> 1 OR `f`.`Id` IS NULL) +WHERE `f`.`Size` = @size AND `p`.`MiddleInitial` IS NOT NULL AND (`f`.`Id` <> 1 OR `f`.`Id` IS NULL) GROUP BY `f`.`Size`, `p0`.`LastName` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/EntitySplittingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/EntitySplittingQueryJetTest.cs index 52c22cb1..68b73c80 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/EntitySplittingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/EntitySplittingQueryJetTest.cs @@ -1,22 +1,19 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; using Xunit; namespace EntityFrameworkCore.Jet.FunctionalTests.Query; -public class EntitySplittingQueryJetTest : EntitySplittingQueryTestBase +public class EntitySplittingQueryJetTest(NonSharedFixture fixture) : EntitySplittingQueryTestBase(fixture) { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; - public EntitySplittingQueryJetTest() - { - } - [ConditionalFact] public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); diff --git a/test/EFCore.Jet.FunctionalTests/Query/FromSqlQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/FromSqlQueryJetTest.cs index d6da856d..9ba6f66a 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/FromSqlQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/FromSqlQueryJetTest.cs @@ -456,15 +456,15 @@ public override async Task FromSqlRaw_queryable_with_parameters_and_clos var queryString = await base.FromSqlRaw_queryable_with_parameters_and_closure(async); AssertSql( - $""" + """ p0='London' (Size = 255) -@__contactTitle_1='Sales Representative' (Size = 30) +@contactTitle='Sales Representative' (Size = 30) SELECT `m`.`CustomerID`, `m`.`Address`, `m`.`City`, `m`.`CompanyName`, `m`.`ContactName`, `m`.`ContactTitle`, `m`.`Country`, `m`.`Fax`, `m`.`Phone`, `m`.`PostalCode`, `m`.`Region` FROM ( - SELECT * FROM `Customers` WHERE `City` = {AssertSqlHelper.Parameter("@p0")} + SELECT * FROM `Customers` WHERE `City` = @p0 ) AS `m` -WHERE `m`.`ContactTitle` = {AssertSqlHelper.Parameter("@__contactTitle_1")} +WHERE `m`.`ContactTitle` = @contactTitle """); return null; @@ -619,18 +619,18 @@ public override async Task FromSqlRaw_with_dbParameter_mixed(bool async) await base.FromSqlRaw_with_dbParameter_mixed(async); AssertSql( - $""" + """ p0='London' (Size = 255) @title='Sales Representative' (Nullable = false) (Size = 20) -SELECT * FROM `Customers` WHERE `City` = {AssertSqlHelper.Parameter("@p0")} AND `ContactTitle` = {AssertSqlHelper.Parameter("@title")} +SELECT * FROM `Customers` WHERE `City` = @p0 AND `ContactTitle` = @title """, // - $""" + """ @city='London' (Nullable = false) (Size = 6) -p1='Sales Representative' (Size = 255) +p0='Sales Representative' (Size = 255) -SELECT * FROM `Customers` WHERE `City` = {AssertSqlHelper.Parameter("@city")} AND `ContactTitle` = {AssertSqlHelper.Parameter("@p1")} +SELECT * FROM `Customers` WHERE `City` = @city AND `ContactTitle` = @p0 """); } @@ -741,39 +741,39 @@ public override async Task FromSqlInterpolated_parameterization_issue_12213(bool await base.FromSqlInterpolated_parameterization_issue_12213(async); AssertSql( - $""" + """ p0='10300' SELECT `m`.`OrderID` FROM ( - SELECT * FROM `Orders` WHERE `OrderID` >= {AssertSqlHelper.Parameter("@p0")} + SELECT * FROM `Orders` WHERE `OrderID` >= @p0 ) AS `m` """, // - $""" -@__max_0='10400' + """ +@max='10400' p0='10300' SELECT `o`.`OrderID` FROM `Orders` AS `o` -WHERE `o`.`OrderID` <= {AssertSqlHelper.Parameter("@__max_0")} AND `o`.`OrderID` IN ( +WHERE `o`.`OrderID` <= @max AND `o`.`OrderID` IN ( SELECT `m`.`OrderID` FROM ( - SELECT * FROM `Orders` WHERE `OrderID` >= {AssertSqlHelper.Parameter("@p0")} + SELECT * FROM `Orders` WHERE `OrderID` >= @p0 ) AS `m` ) """, // - $""" -@__max_0='10400' + """ +@max='10400' p0='10300' SELECT `o`.`OrderID` FROM `Orders` AS `o` -WHERE `o`.`OrderID` <= {AssertSqlHelper.Parameter("@__max_0")} AND `o`.`OrderID` IN ( +WHERE `o`.`OrderID` <= @max AND `o`.`OrderID` IN ( SELECT `m`.`OrderID` FROM ( - SELECT * FROM `Orders` WHERE `OrderID` >= {AssertSqlHelper.Parameter("@p0")} + SELECT * FROM `Orders` WHERE `OrderID` >= @p0 ) AS `m` ) """); @@ -941,7 +941,7 @@ public override async Task FromSqlRaw_with_dbParameter_mixed_in_subquery(bool as await base.FromSqlRaw_with_dbParameter_mixed_in_subquery(async); AssertSql( - $""" + """ p0='London' (Size = 255) @title='Sales Representative' (Nullable = false) (Size = 20) @@ -950,46 +950,26 @@ public override async Task FromSqlRaw_with_dbParameter_mixed_in_subquery(bool as WHERE `o`.`CustomerID` IN ( SELECT `m`.`CustomerID` FROM ( - SELECT * FROM `Customers` WHERE `City` = {AssertSqlHelper.Parameter("@p0")} AND `ContactTitle` = {AssertSqlHelper.Parameter("@title")} + SELECT * FROM `Customers` WHERE `City` = @p0 AND `ContactTitle` = @title ) AS `m` ) """, // - $""" + """ @city='London' (Nullable = false) (Size = 6) -p1='Sales Representative' (Size = 255) +p0='Sales Representative' (Size = 255) SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` WHERE `o`.`CustomerID` IN ( SELECT `m`.`CustomerID` FROM ( - SELECT * FROM `Customers` WHERE `City` = {AssertSqlHelper.Parameter("@city")} AND `ContactTitle` = {AssertSqlHelper.Parameter("@p1")} + SELECT * FROM `Customers` WHERE `City` = @city AND `ContactTitle` = @p0 ) AS `m` ) """); } - public override async Task Multiple_occurrences_of_FromSql_with_db_parameter_adds_parameter_only_once(bool async) - { - await base.Multiple_occurrences_of_FromSql_with_db_parameter_adds_parameter_only_once(async); - - AssertSql( -""" -city='Seattle' (Nullable = false) (Size = 7) - -SELECT [m].[CustomerID], [m].[Address], [m].[City], [m].[CompanyName], [m].[ContactName], [m].[ContactTitle], [m].[Country], [m].[Fax], [m].[Phone], [m].[PostalCode], [m].[Region] -FROM ( - SELECT * FROM `Customers` WHERE "City" = @city -) AS [m] -INTERSECT -SELECT [m0].[CustomerID], [m0].[Address], [m0].[City], [m0].[CompanyName], [m0].[ContactName], [m0].[ContactTitle], [m0].[Country], [m0].[Fax], [m0].[Phone], [m0].[PostalCode], [m0].[Region] -FROM ( - SELECT * FROM `Customers` WHERE "City" = @city -) AS [m0] -"""); - } - public override async Task FromSqlRaw_composed_with_common_table_expression(bool async) { var exception = diff --git a/test/EFCore.Jet.FunctionalTests/Query/FromSqlSprocQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/FromSqlSprocQueryJetTest.cs index 752c1cd6..1e582f66 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/FromSqlSprocQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/FromSqlSprocQueryJetTest.cs @@ -27,7 +27,11 @@ public override async Task From_sql_queryable_stored_procedure_with_tag(bool asy await base.From_sql_queryable_stored_procedure_with_tag(async); AssertSql( - $@"EXEC `Ten Most Expensive Products`"); + """ +-- Stored Procedure + +EXEC `Ten Most Expensive Products` +"""); } public override async Task From_sql_queryable_stored_procedure_with_caller_info_tag(bool async) @@ -36,6 +40,8 @@ public override async Task From_sql_queryable_stored_procedure_with_caller_info_ AssertSql( """ +-- File: SampleFileName:13 + EXEC `Ten Most Expensive Products` """); } @@ -46,6 +52,10 @@ public override async Task From_sql_queryable_stored_procedure_with_caller_info_ AssertSql( """ +-- Before +-- File: SampleFileName:13 +-- After + EXEC `Ten Most Expensive Products` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/FunkyDataQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/FunkyDataQueryJetTest.cs index 778ed670..f9646180 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/FunkyDataQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/FunkyDataQueryJetTest.cs @@ -75,20 +75,20 @@ public override async Task String_contains_on_argument_with_wildcard_parameter(b await base.String_contains_on_argument_with_wildcard_parameter(isAsync); AssertSql( - $""" -@__prm1_0_contains='%[%]B%' (Size = 255) + """ +@prm1_contains='%[%]B%' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` LIKE {AssertSqlHelper.Parameter("@__prm1_0_contains")} +WHERE `f`.`FirstName` LIKE @prm1_contains """, // - $""" -@__prm2_0_contains='%a[_]%' (Size = 255) + """ +@prm2_contains='%a[_]%' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` LIKE {AssertSqlHelper.Parameter("@__prm2_0_contains")} +WHERE `f`.`FirstName` LIKE @prm2_contains """, // """ @@ -97,36 +97,36 @@ public override async Task String_contains_on_argument_with_wildcard_parameter(b WHERE 0 = 1 """, // - $""" -@__prm4_0_contains='%' (Size = 255) + """ +@prm4_contains='%' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` LIKE {AssertSqlHelper.Parameter("@__prm4_0_contains")} +WHERE `f`.`FirstName` LIKE @prm4_contains """, // -$""" -@__prm5_0_contains='%[_]Ba[_]%' (Size = 255) + """ +@prm5_contains='%[_]Ba[_]%' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` LIKE {AssertSqlHelper.Parameter("@__prm5_0_contains")} +WHERE `f`.`FirstName` LIKE @prm5_contains """, // - $""" -@__prm6_0_contains='%[%]B[%]a[%]r%' (Size = 255) + """ +@prm6_contains='%[%]B[%]a[%]r%' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` NOT LIKE {AssertSqlHelper.Parameter("@__prm6_0_contains")} OR `f`.`FirstName` IS NULL +WHERE `f`.`FirstName` NOT LIKE @prm6_contains OR `f`.`FirstName` IS NULL """, // - $""" -@__prm7_0_contains='%' (Size = 255) + """ +@prm7_contains='%' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` NOT LIKE {AssertSqlHelper.Parameter("@__prm7_0_contains")} OR `f`.`FirstName` IS NULL +WHERE `f`.`FirstName` NOT LIKE @prm7_contains OR `f`.`FirstName` IS NULL """, // """ @@ -219,20 +219,20 @@ public override async Task String_starts_with_on_argument_with_wildcard_paramete await base.String_starts_with_on_argument_with_wildcard_parameter(isAsync); AssertSql( - $""" -@__prm1_0_startswith='[%]B%' (Size = 255) + """ +@prm1_startswith='[%]B%' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` LIKE {AssertSqlHelper.Parameter("@__prm1_0_startswith")} +WHERE `f`.`FirstName` LIKE @prm1_startswith """, // - $""" -@__prm2_0_startswith='[_]B%' (Size = 255) + """ +@prm2_startswith='[_]B%' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` LIKE {AssertSqlHelper.Parameter("@__prm2_0_startswith")} +WHERE `f`.`FirstName` LIKE @prm2_startswith """, // """ @@ -241,36 +241,36 @@ public override async Task String_starts_with_on_argument_with_wildcard_paramete WHERE 0 = 1 """, // - $""" -@__prm4_0_startswith='%' (Size = 255) + """ +@prm4_startswith='%' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` LIKE {AssertSqlHelper.Parameter("@__prm4_0_startswith")} +WHERE `f`.`FirstName` LIKE @prm4_startswith """, // - $""" -@__prm5_0_startswith='[_]Ba[_]%' (Size = 255) + """ +@prm5_startswith='[_]Ba[_]%' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` LIKE {AssertSqlHelper.Parameter("@__prm5_0_startswith")} +WHERE `f`.`FirstName` LIKE @prm5_startswith """, // - $""" -@__prm6_0_startswith='[%]B[%]a[%]r%' (Size = 255) + """ +@prm6_startswith='[%]B[%]a[%]r%' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` NOT LIKE {AssertSqlHelper.Parameter("@__prm6_0_startswith")} OR `f`.`FirstName` IS NULL +WHERE `f`.`FirstName` NOT LIKE @prm6_startswith OR `f`.`FirstName` IS NULL """, // - $""" -@__prm7_0_startswith='%' (Size = 255) + """ +@prm7_startswith='%' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` NOT LIKE {AssertSqlHelper.Parameter("@__prm7_0_startswith")} OR `f`.`FirstName` IS NULL +WHERE `f`.`FirstName` NOT LIKE @prm7_startswith OR `f`.`FirstName` IS NULL """, // """ @@ -302,28 +302,28 @@ public override async Task String_starts_with_on_argument_with_bracket(bool isAs WHERE `f`.`FirstName` LIKE 'B[[][[]a[^]%' """, // - $""" -@__prm1_0_startswith='[[]%' (Size = 255) + """ +@prm1_startswith='[[]%' (Size = 255) SELECT `f`.`Id`, `f`.`FirstName`, `f`.`LastName`, `f`.`NullableBool` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` LIKE {AssertSqlHelper.Parameter("@__prm1_0_startswith")} +WHERE `f`.`FirstName` LIKE @prm1_startswith """, // - $""" -@__prm2_0_startswith='B[[]%' (Size = 255) + """ +@prm2_startswith='B[[]%' (Size = 255) SELECT `f`.`Id`, `f`.`FirstName`, `f`.`LastName`, `f`.`NullableBool` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` LIKE {AssertSqlHelper.Parameter("@__prm2_0_startswith")} +WHERE `f`.`FirstName` LIKE @prm2_startswith """, // - $""" -@__prm3_0_startswith='B[[][[]a[^]%' (Size = 255) + """ +@prm3_startswith='B[[][[]a[^]%' (Size = 255) SELECT `f`.`Id`, `f`.`FirstName`, `f`.`LastName`, `f`.`NullableBool` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` LIKE {AssertSqlHelper.Parameter("@__prm3_0_startswith")} +WHERE `f`.`FirstName` LIKE @prm3_startswith """, // """ @@ -417,20 +417,20 @@ public override async Task String_ends_with_on_argument_with_wildcard_parameter( await base.String_ends_with_on_argument_with_wildcard_parameter(isAsync); AssertSql( - $""" -@__prm1_0_endswith='%[%]r' (Size = 255) + """ +@prm1_endswith='%[%]r' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` LIKE {AssertSqlHelper.Parameter("@__prm1_0_endswith")} +WHERE `f`.`FirstName` LIKE @prm1_endswith """, // - $""" -@__prm2_0_endswith='%r[_]' (Size = 255) + """ +@prm2_endswith='%r[_]' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` LIKE {AssertSqlHelper.Parameter("@__prm2_0_endswith")} +WHERE `f`.`FirstName` LIKE @prm2_endswith """, // """ @@ -439,36 +439,36 @@ public override async Task String_ends_with_on_argument_with_wildcard_parameter( WHERE 0 = 1 """, // - $""" -@__prm4_0_endswith='%' (Size = 255) + """ +@prm4_endswith='%' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` LIKE {AssertSqlHelper.Parameter("@__prm4_0_endswith")} +WHERE `f`.`FirstName` LIKE @prm4_endswith """, // - $""" -@__prm5_0_endswith='%[_]r[_]' (Size = 255) + """ +@prm5_endswith='%[_]r[_]' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` LIKE {AssertSqlHelper.Parameter("@__prm5_0_endswith")} +WHERE `f`.`FirstName` LIKE @prm5_endswith """, // - $""" -@__prm6_0_endswith='%a[%]r[%]' (Size = 255) + """ +@prm6_endswith='%a[%]r[%]' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` NOT LIKE {AssertSqlHelper.Parameter("@__prm6_0_endswith")} OR `f`.`FirstName` IS NULL +WHERE `f`.`FirstName` NOT LIKE @prm6_endswith OR `f`.`FirstName` IS NULL """, // - $""" -@__prm7_0_endswith='%' (Size = 255) + """ +@prm7_endswith='%' (Size = 255) SELECT `f`.`FirstName` FROM `FunkyCustomers` AS `f` -WHERE `f`.`FirstName` NOT LIKE {AssertSqlHelper.Parameter("@__prm7_0_endswith")} OR `f`.`FirstName` IS NULL +WHERE `f`.`FirstName` NOT LIKE @prm7_endswith OR `f`.`FirstName` IS NULL """, // """ diff --git a/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs index 9a5368a8..61ca39e9 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs @@ -213,16 +213,16 @@ public override async Task Include_where_list_contains_navigation(bool isAsync) await base.Include_where_list_contains_navigation(isAsync); AssertSql( -""" + """ SELECT `t`.`Id` FROM `Tags` AS `t` """, -// -""" + // + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` FROM `Gears` AS `g` LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` -WHERE `t`.`Id` IS NOT NULL AND `t`.`Id` IN ('{b39a6fba-9026-4d69-828e-fd7068673e57}', '{34c8d86e-a4ac-4be5-827f-584dda348a07}', '{70534e05-782c-4052-8720-c2c54481ce5f}', '{a8ad98f9-e023-4e2a-9a70-c2728455bd34}', '{df36f493-463f-4123-83f9-6b135deeb7ba}', '{a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}') +WHERE `t`.`Id` IS NOT NULL AND `t`.`Id` IN ({b39a6fba-9026-4d69-828e-fd7068673e57}, {34c8d86e-a4ac-4be5-827f-584dda348a07}, {70534e05-782c-4052-8720-c2c54481ce5f}, {a8ad98f9-e023-4e2a-9a70-c2728455bd34}, {df36f493-463f-4123-83f9-6b135deeb7ba}, {a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}) """); } @@ -231,17 +231,17 @@ public override async Task Include_where_list_contains_navigation2(bool isAsync) await base.Include_where_list_contains_navigation2(isAsync); AssertSql( -""" + """ SELECT `t`.`Id` FROM `Tags` AS `t` """, -// -""" + // + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` FROM (`Gears` AS `g` INNER JOIN `Cities` AS `c` ON `g`.`CityOfBirthName` = `c`.`Name`) LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` -WHERE `c`.`Location` IS NOT NULL AND `t`.`Id` IN ('{b39a6fba-9026-4d69-828e-fd7068673e57}', '{34c8d86e-a4ac-4be5-827f-584dda348a07}', '{70534e05-782c-4052-8720-c2c54481ce5f}', '{a8ad98f9-e023-4e2a-9a70-c2728455bd34}', '{df36f493-463f-4123-83f9-6b135deeb7ba}', '{a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}') +WHERE `c`.`Location` IS NOT NULL AND `t`.`Id` IN ({b39a6fba-9026-4d69-828e-fd7068673e57}, {34c8d86e-a4ac-4be5-827f-584dda348a07}, {70534e05-782c-4052-8720-c2c54481ce5f}, {a8ad98f9-e023-4e2a-9a70-c2728455bd34}, {df36f493-463f-4123-83f9-6b135deeb7ba}, {a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}) """); } @@ -250,16 +250,16 @@ public override async Task Navigation_accessed_twice_outside_and_inside_subquery await base.Navigation_accessed_twice_outside_and_inside_subquery(isAsync); AssertSql( -""" + """ SELECT `t`.`Id` FROM `Tags` AS `t` """, -// -""" + // + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` -WHERE `t`.`Id` IS NOT NULL AND `t`.`Id` IN ('{b39a6fba-9026-4d69-828e-fd7068673e57}', '{34c8d86e-a4ac-4be5-827f-584dda348a07}', '{70534e05-782c-4052-8720-c2c54481ce5f}', '{a8ad98f9-e023-4e2a-9a70-c2728455bd34}', '{df36f493-463f-4123-83f9-6b135deeb7ba}', '{a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}') +WHERE `t`.`Id` IS NOT NULL AND `t`.`Id` IN ({b39a6fba-9026-4d69-828e-fd7068673e57}, {34c8d86e-a4ac-4be5-827f-584dda348a07}, {70534e05-782c-4052-8720-c2c54481ce5f}, {a8ad98f9-e023-4e2a-9a70-c2728455bd34}, {df36f493-463f-4123-83f9-6b135deeb7ba}, {a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}) """); } @@ -362,593 +362,222 @@ public override async Task Include_with_nested_navigation_in_order_by(bool isAsy """); } - public override async Task Where_enum(bool isAsync) + public override async Task Where_count_subquery_without_collision(bool isAsync) { - await base.Where_enum(isAsync); + await base.Where_count_subquery_without_collision(isAsync); AssertSql( """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` -WHERE `g`.`Rank` = 4 +WHERE ( + SELECT COUNT(*) + FROM `Weapons` AS `w` + WHERE `g`.`FullName` = `w`.`OwnerFullName`) = 2 """); } - public override async Task Where_nullable_enum_with_constant(bool isAsync) + public override async Task Where_any_subquery_without_collision(bool isAsync) { - await base.Where_nullable_enum_with_constant(isAsync); + await base.Where_any_subquery_without_collision(isAsync); AssertSql( - $""" - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE `w`.`AmmunitionType` = 1 - """); +""" +SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` +FROM `Gears` AS `g` +WHERE EXISTS ( + SELECT 1 + FROM `Weapons` AS `w` + WHERE `g`.`FullName` = `w`.`OwnerFullName`) +"""); } - public override async Task Where_nullable_enum_with_null_constant(bool isAsync) + public override async Task Select_inverted_boolean(bool isAsync) { - await base.Where_nullable_enum_with_null_constant(isAsync); + await base.Select_inverted_boolean(isAsync); AssertSql( - $""" - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE `w`.`AmmunitionType` IS NULL - """); + """ +SELECT `w`.`Id`, `w`.`IsAutomatic` BXOR TRUE AS `Manual` +FROM `Weapons` AS `w` +WHERE `w`.`IsAutomatic` = TRUE +"""); } - public override async Task Where_nullable_enum_with_non_nullable_parameter(bool isAsync) + public override async Task Select_inverted_nullable_boolean(bool async) { - await base.Where_nullable_enum_with_non_nullable_parameter(isAsync); + await base.Select_inverted_nullable_boolean(async); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ammunitionType_0='1'")} - - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE `w`.`AmmunitionType` = {AssertSqlHelper.Parameter("@__ammunitionType_0")} - """); + """ +SELECT `f`.`Id`, `f`.`Eradicated` BXOR TRUE AS `Alive` +FROM `Factions` AS `f` +"""); } - public override async Task Where_nullable_enum_with_nullable_parameter(bool isAsync) + public override async Task Select_comparison_with_null(bool isAsync) { - await base.Where_nullable_enum_with_nullable_parameter(isAsync); + await base.Select_comparison_with_null(isAsync); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ammunitionType_0='1' (Nullable = true)")} - - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE `w`.`AmmunitionType` = {AssertSqlHelper.Parameter("@__ammunitionType_0")} - """, - // - $""" - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE `w`.`AmmunitionType` IS NULL - """); - } - - public override async Task Where_bitwise_and_enum(bool isAsync) - { - await base.Where_bitwise_and_enum(isAsync); + """ +@ammunitionType='1' (Nullable = true) +@ammunitionType='1' (Nullable = true) - AssertSql( -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND 2) > 0 +SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` = @ammunitionType AND `w`.`AmmunitionType` IS NOT NULL, TRUE, FALSE) AS `Cartridge` +FROM `Weapons` AS `w` +WHERE `w`.`AmmunitionType` = @ammunitionType """, -// -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND 2) = 2 + // + """ +SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` IS NULL, TRUE, FALSE) AS `Cartridge` +FROM `Weapons` AS `w` +WHERE `w`.`AmmunitionType` IS NULL """); } - public override async Task Where_bitwise_and_integral(bool isAsync) + public override async Task Select_null_parameter(bool isAsync) { - await base.Where_bitwise_and_integral(isAsync); + await base.Select_null_parameter(isAsync); AssertSql( -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND 1) = 1 + """ +@ammunitionType='1' (Nullable = true) + +SELECT `w`.`Id`, @ammunitionType AS `AmmoType` +FROM `Weapons` AS `w` """, -// -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (CLNG(`g`.`Rank`) BAND 1) = 1 + // + """ +SELECT `w`.`Id`, CVar(NULL) AS `AmmoType` +FROM `Weapons` AS `w` """, -// -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (CINT(`g`.`Rank`) BAND 1) = 1 + // + """ +@ammunitionType='2' (Nullable = true) + +SELECT `w`.`Id`, @ammunitionType AS `AmmoType` +FROM `Weapons` AS `w` +""", + // + """ +SELECT `w`.`Id`, CVar(NULL) AS `AmmoType` +FROM `Weapons` AS `w` """); } - public override async Task Where_bitwise_and_nullable_enum_with_constant(bool isAsync) + public override async Task Select_ternary_operation_with_boolean(bool isAsync) { - await base.Where_bitwise_and_nullable_enum_with_constant(isAsync); + await base.Select_ternary_operation_with_boolean(isAsync); AssertSql( - $""" - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE (`w`.`AmmunitionType` BAND 1) > 0 - """); +""" +SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = TRUE, 1, 0) AS `Num` +FROM `Weapons` AS `w` +"""); } - public override async Task Where_bitwise_and_nullable_enum_with_null_constant(bool isAsync) + public override async Task Select_ternary_operation_with_inverted_boolean(bool isAsync) { - await base.Where_bitwise_and_nullable_enum_with_null_constant(isAsync); - + await base.Select_ternary_operation_with_inverted_boolean(isAsync); AssertSql( """ -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE, 1, 0) AS `Num` FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND NULL) > 0 """); } - public override async Task Where_bitwise_and_nullable_enum_with_non_nullable_parameter(bool isAsync) + public override async Task Select_ternary_operation_with_has_value_not_null(bool isAsync) { - await base.Where_bitwise_and_nullable_enum_with_non_nullable_parameter(isAsync); - + await base.Select_ternary_operation_with_has_value_not_null(isAsync); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ammunitionType_0='1'")} - - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE (`w`.`AmmunitionType` BAND {AssertSqlHelper.Parameter("@__ammunitionType_0")}) > 0 - """); +""" +SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` IS NOT NULL AND `w`.`AmmunitionType` = 1, 'Yes', 'No') AS `IsCartridge` +FROM `Weapons` AS `w` +WHERE `w`.`AmmunitionType` IS NOT NULL AND `w`.`AmmunitionType` = 1 +"""); } - public override async Task Where_bitwise_and_nullable_enum_with_nullable_parameter(bool isAsync) + public override async Task Select_ternary_operation_multiple_conditions(bool isAsync) { - await base.Where_bitwise_and_nullable_enum_with_nullable_parameter(isAsync); + await base.Select_ternary_operation_multiple_conditions(isAsync); AssertSql( """ -@__ammunitionType_0='1' (Nullable = true) - -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND @__ammunitionType_0) > 0 -""", -// -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` = 2 AND `w`.`SynergyWithId` = 1, 'Yes', 'No') AS `IsCartridge` FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND NULL) > 0 """); } - public override async Task Where_bitwise_or_enum(bool isAsync) + public override async Task Select_ternary_operation_multiple_conditions_2(bool isAsync) { - await base.Where_bitwise_or_enum(isAsync); - + await base.Select_ternary_operation_multiple_conditions_2(isAsync); AssertSql( """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (`g`.`Rank` BOR 2) > 0 +SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE AND `w`.`SynergyWithId` = 1, 'Yes', 'No') AS `IsCartridge` +FROM `Weapons` AS `w` """); } - public override async Task Bitwise_projects_values_in_select(bool isAsync) + public override async Task Select_multiple_conditions(bool isAsync) { - await base.Bitwise_projects_values_in_select(isAsync); + await base.Select_multiple_conditions(isAsync); AssertSql( """ -SELECT TOP 1 CBOOL((`g`.`Rank` BAND 2) BXOR 2) BXOR TRUE AS `BitwiseTrue`, CBOOL((`g`.`Rank` BAND 2) BXOR 4) BXOR TRUE AS `BitwiseFalse`, `g`.`Rank` BAND 2 AS `BitwiseValue` -FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND 2) = 2 +SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE AND `w`.`SynergyWithId` = 1 AND `w`.`SynergyWithId` IS NOT NULL, TRUE, FALSE) AS `IsCartridge` +FROM `Weapons` AS `w` """); } - public override async Task Where_enum_has_flag(bool isAsync) + public override async Task Select_nested_ternary_operations(bool isAsync) { - await base.Where_enum_has_flag(isAsync); + await base.Select_nested_ternary_operations(isAsync); AssertSql( -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND 2) = 2 -""", -// -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND 18) = 18 -""", -// -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND 1) = 1 -""", -// -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND 1) = 1 -""", -// -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (2 BAND `g`.`Rank`) = `g`.`Rank` + """ +SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE, IIF(`w`.`AmmunitionType` = 1, 'ManualCartridge', 'Manual'), 'Auto') AS `IsManualCartridge` +FROM `Weapons` AS `w` """); } - public override async Task Where_enum_has_flag_subquery(bool isAsync) + public override async Task Null_propagation_optimization1(bool isAsync) { - await base.Where_enum_has_flag_subquery(isAsync); + await base.Null_propagation_optimization1(isAsync); AssertSql( -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND IIF(( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) IS NULL, 0, ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`))) = IIF(( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) IS NULL, 0, ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`)) -""", -// -""" + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` -WHERE (2 BAND IIF(( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) IS NULL, 0, ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`))) = IIF(( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) IS NULL, 0, ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`)) +WHERE `g`.`LeaderNickname` = 'Marcus' """); } - public override async Task Where_enum_has_flag_subquery_with_pushdown(bool isAsync) + public override async Task Null_propagation_optimization2(bool isAsync) { - await base.Where_enum_has_flag_subquery_with_pushdown(isAsync); + await base.Null_propagation_optimization2(isAsync); - AssertSql( -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`)) = ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) OR ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) IS NULL -""", -// -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (2 BAND ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`)) = ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) OR ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) IS NULL -"""); + // issue #16050 + // AssertSql( + // $@"SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` + //FROM `Gears` AS `g` + //WHERE `g`.`Discriminator` IN ('Officer', 'Gear') AND `g`.`LeaderNickname` LIKE '%us'"); } - public override async Task Where_enum_has_flag_subquery_client_eval(bool isAsync) + public override async Task Null_propagation_optimization3(bool isAsync) { - await base.Where_enum_has_flag_subquery_client_eval(isAsync); + await base.Null_propagation_optimization3(isAsync); - AssertSql( -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`)) = ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) OR ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) IS NULL -"""); + // issue #16050 + // AssertSql( + // $@"SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` + //FROM `Gears` AS `g` + //WHERE `g`.`Discriminator` IN ('Officer', 'Gear') AND `g`.`LeaderNickname` LIKE '%us'"); } - public override async Task Where_enum_has_flag_with_non_nullable_parameter(bool isAsync) + public override async Task Null_propagation_optimization4(bool isAsync) { - await base.Where_enum_has_flag_with_non_nullable_parameter(isAsync); - - AssertSql( -""" -@__parameter_0='2' -@__parameter_0='2' - -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND @__parameter_0) = @__parameter_0 -"""); - } - - public override async Task Where_has_flag_with_nullable_parameter(bool isAsync) - { - await base.Where_has_flag_with_nullable_parameter(isAsync); - - AssertSql( -""" -@__parameter_0='2' (Nullable = true) -@__parameter_0='2' (Nullable = true) - -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND @__parameter_0) = @__parameter_0 -"""); - } - - public override async Task Select_enum_has_flag(bool isAsync) - { - await base.Select_enum_has_flag(isAsync); - - AssertSql( - """ -SELECT TOP 1 CBOOL((`g`.`Rank` BAND 2) BXOR 2) BXOR TRUE AS `hasFlagTrue`, CBOOL((`g`.`Rank` BAND 4) BXOR 4) BXOR TRUE AS `hasFlagFalse` -FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND 2) = 2 -"""); - } - - public override async Task Where_count_subquery_without_collision(bool isAsync) - { - await base.Where_count_subquery_without_collision(isAsync); - - AssertSql( -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE ( - SELECT COUNT(*) - FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName`) = 2 -"""); - } - - public override async Task Where_any_subquery_without_collision(bool isAsync) - { - await base.Where_any_subquery_without_collision(isAsync); - - AssertSql( -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE EXISTS ( - SELECT 1 - FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName`) -"""); - } - - public override async Task Select_inverted_boolean(bool isAsync) - { - await base.Select_inverted_boolean(isAsync); - - AssertSql( - """ -SELECT `w`.`Id`, `w`.`IsAutomatic` BXOR TRUE AS `Manual` -FROM `Weapons` AS `w` -WHERE `w`.`IsAutomatic` = TRUE -"""); - } - - public override async Task Select_inverted_nullable_boolean(bool async) - { - await base.Select_inverted_nullable_boolean(async); - - AssertSql( - """ -SELECT `f`.`Id`, `f`.`Eradicated` BXOR TRUE AS `Alive` -FROM `Factions` AS `f` -"""); - } - - public override async Task Select_comparison_with_null(bool isAsync) - { - await base.Select_comparison_with_null(isAsync); - - AssertSql( -""" -@__ammunitionType_0='1' (Nullable = true) -@__ammunitionType_0='1' (Nullable = true) - -SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` = @__ammunitionType_0 AND `w`.`AmmunitionType` IS NOT NULL, TRUE, FALSE) AS `Cartridge` -FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` = @__ammunitionType_0 -""", -// -""" -SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` IS NULL, TRUE, FALSE) AS `Cartridge` -FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` IS NULL -"""); - } - - public override async Task Select_null_parameter(bool isAsync) - { - await base.Select_null_parameter(isAsync); - - AssertSql( - """ -@__ammunitionType_0='1' (Nullable = true) - -SELECT `w`.`Id`, @__ammunitionType_0 AS `AmmoType` -FROM `Weapons` AS `w` -""", - // - """ -SELECT `w`.`Id`, CVar(NULL) AS `AmmoType` -FROM `Weapons` AS `w` -""", - // - """ -@__ammunitionType_0='2' (Nullable = true) - -SELECT `w`.`Id`, @__ammunitionType_0 AS `AmmoType` -FROM `Weapons` AS `w` -""", - // - """ -SELECT `w`.`Id`, CVar(NULL) AS `AmmoType` -FROM `Weapons` AS `w` -"""); - } - - public override async Task Select_ternary_operation_with_boolean(bool isAsync) - { - await base.Select_ternary_operation_with_boolean(isAsync); - - AssertSql( -""" -SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = TRUE, 1, 0) AS `Num` -FROM `Weapons` AS `w` -"""); - } - - public override async Task Select_ternary_operation_with_inverted_boolean(bool isAsync) - { - await base.Select_ternary_operation_with_inverted_boolean(isAsync); - AssertSql( - """ -SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE, 1, 0) AS `Num` -FROM `Weapons` AS `w` -"""); - } - - public override async Task Select_ternary_operation_with_has_value_not_null(bool isAsync) - { - await base.Select_ternary_operation_with_has_value_not_null(isAsync); - AssertSql( -""" -SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` IS NOT NULL AND `w`.`AmmunitionType` = 1, 'Yes', 'No') AS `IsCartridge` -FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` IS NOT NULL AND `w`.`AmmunitionType` = 1 -"""); - } - - public override async Task Select_ternary_operation_multiple_conditions(bool isAsync) - { - await base.Select_ternary_operation_multiple_conditions(isAsync); - - AssertSql( -""" -SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` = 2 AND `w`.`SynergyWithId` = 1, 'Yes', 'No') AS `IsCartridge` -FROM `Weapons` AS `w` -"""); - } - - public override async Task Select_ternary_operation_multiple_conditions_2(bool isAsync) - { - await base.Select_ternary_operation_multiple_conditions_2(isAsync); - AssertSql( - """ -SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE AND `w`.`SynergyWithId` = 1, 'Yes', 'No') AS `IsCartridge` -FROM `Weapons` AS `w` -"""); - } - - public override async Task Select_multiple_conditions(bool isAsync) - { - await base.Select_multiple_conditions(isAsync); - - AssertSql( - """ -SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE AND `w`.`SynergyWithId` = 1 AND `w`.`SynergyWithId` IS NOT NULL, TRUE, FALSE) AS `IsCartridge` -FROM `Weapons` AS `w` -"""); - } - - public override async Task Select_nested_ternary_operations(bool isAsync) - { - await base.Select_nested_ternary_operations(isAsync); - - AssertSql( - """ -SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE, IIF(`w`.`AmmunitionType` = 1, 'ManualCartridge', 'Manual'), 'Auto') AS `IsManualCartridge` -FROM `Weapons` AS `w` -"""); - } - - public override async Task Null_propagation_optimization1(bool isAsync) - { - await base.Null_propagation_optimization1(isAsync); - - AssertSql( - """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Gears` AS `g` -WHERE `g`.`LeaderNickname` = 'Marcus' -"""); - } - - public override async Task Null_propagation_optimization2(bool isAsync) - { - await base.Null_propagation_optimization2(isAsync); - - // issue #16050 - // AssertSql( - // $@"SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` - //FROM `Gears` AS `g` - //WHERE `g`.`Discriminator` IN ('Officer', 'Gear') AND `g`.`LeaderNickname` LIKE '%us'"); - } - - public override async Task Null_propagation_optimization3(bool isAsync) - { - await base.Null_propagation_optimization3(isAsync); - - // issue #16050 - // AssertSql( - // $@"SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` - //FROM `Gears` AS `g` - //WHERE `g`.`Discriminator` IN ('Officer', 'Gear') AND `g`.`LeaderNickname` LIKE '%us'"); - } - - public override async Task Null_propagation_optimization4(bool isAsync) - { - await base.Null_propagation_optimization4(isAsync); + await base.Null_propagation_optimization4(isAsync); // issue #16050 // AssertSql( @@ -1287,39 +916,85 @@ public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scal """); } - public override async Task Select_Singleton_Navigation_With_Member_Access(bool isAsync) + public override async Task Conditional_Navigation_With_Trivial_Member_Access(bool async) { - await base.Select_Singleton_Navigation_With_Member_Access(isAsync); + await base.Conditional_Navigation_With_Trivial_Member_Access(async); AssertSql( -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM `Tags` AS `t` -LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` -WHERE `g`.`Nickname` = 'Marcus' AND (`g`.`CityOfBirthName` <> 'Ephyra' OR `g`.`CityOfBirthName` IS NULL) + """ +SELECT `g`.`Nickname` +FROM (`Gears` AS `g` +LEFT JOIN `Cities` AS `c` ON `g`.`AssignedCityName` = `c`.`Name`) +INNER JOIN `Cities` AS `c0` ON `g`.`CityOfBirthName` = `c0`.`Name` +WHERE IIF(`c`.`Name` IS NOT NULL, `c`.`Name`, `c0`.`Name`) <> 'Ephyra' """); } - public override async Task Select_Where_Navigation(bool isAsync) + public override async Task Conditional_Navigation_With_Member_Access_On_Same_Type(bool async) { - await base.Select_Where_Navigation(isAsync); + await base.Conditional_Navigation_With_Member_Access_On_Same_Type(async); AssertSql( -""" -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` -WHERE `g`.`Nickname` = 'Marcus' + """ +SELECT `g`.`Nickname`, `g`.`FullName` +FROM (`Gears` AS `g` +LEFT JOIN `Cities` AS `c` ON `g`.`AssignedCityName` = `c`.`Name`) +INNER JOIN `Cities` AS `c0` ON `g`.`CityOfBirthName` = `c0`.`Name` +WHERE IIF(`c`.`Name` IS NOT NULL, `c`.`Nation`, `c0`.`Nation`) = 'Tyrus' """); } - public override async Task Select_Where_Navigation_Equals_Navigation(bool isAsync) + public override async Task Conditional_Navigation_With_Member_Access_On_Related_Types(bool async) { - await base.Select_Where_Navigation_Equals_Navigation(isAsync); + await base.Conditional_Navigation_With_Member_Access_On_Related_Types(async); AssertSql( """ -SELECT `s`.`Id`, `s`.`GearNickName`, `s`.`GearSquadId`, `s`.`IssueDate`, `s`.`Note`, `s`.`Id0`, `s`.`GearNickName0`, `s`.`GearSquadId0`, `s`.`IssueDate0`, `s`.`Note0` +SELECT `f`.`Name` +FROM (`Factions` AS `f` +LEFT JOIN `LocustLeaders` AS `l` ON `f`.`DeputyCommanderName` = `l`.`Name`) +LEFT JOIN ( + SELECT `l0`.`Name`, `l0`.`ThreatLevel` + FROM `LocustLeaders` AS `l0` + WHERE `l0`.`Discriminator` = 'LocustCommander' +) AS `l1` ON `f`.`CommanderName` = `l1`.`Name` +WHERE IIF(`l`.`Name` IS NOT NULL, `l`.`ThreatLevel`, `l1`.`ThreatLevel`) = 4 +"""); + } + + public override async Task Select_Singleton_Navigation_With_Member_Access(bool isAsync) + { + await base.Select_Singleton_Navigation_With_Member_Access(isAsync); + + AssertSql( +""" +SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` +FROM `Tags` AS `t` +LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` +WHERE `g`.`Nickname` = 'Marcus' AND (`g`.`CityOfBirthName` <> 'Ephyra' OR `g`.`CityOfBirthName` IS NULL) +"""); + } + + public override async Task Select_Where_Navigation(bool isAsync) + { + await base.Select_Where_Navigation(isAsync); + + AssertSql( +""" +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` +WHERE `g`.`Nickname` = 'Marcus' +"""); + } + + public override async Task Select_Where_Navigation_Equals_Navigation(bool isAsync) + { + await base.Select_Where_Navigation_Equals_Navigation(isAsync); + + AssertSql( + """ +SELECT `s`.`Id`, `s`.`GearNickName`, `s`.`GearSquadId`, `s`.`IssueDate`, `s`.`Note`, `s`.`Id0`, `s`.`GearNickName0`, `s`.`GearSquadId0`, `s`.`IssueDate0`, `s`.`Note0` FROM (( SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note`, `t0`.`Id` AS `Id0`, `t0`.`GearNickName` AS `GearNickName0`, `t0`.`GearSquadId` AS `GearSquadId0`, `t0`.`IssueDate` AS `IssueDate0`, `t0`.`Note` AS `Note0` FROM `Tags` AS `t`, @@ -1510,10 +1185,10 @@ public override async Task Where_subquery_distinct_singleordefault_boolean2(bool SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` WHERE `g`.`HasSoulPatch` = TRUE AND IIF(( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` + SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%')) IS NULL, FALSE, ( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` + SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%'))) = TRUE ORDER BY `g`.`Nickname` @@ -2019,12 +1694,12 @@ public override async Task Non_unicode_parameter_is_used_for_non_unicode_column( await base.Non_unicode_parameter_is_used_for_non_unicode_column(isAsync); AssertSql( -""" -@__value_0='Unknown' (Size = 100) + """ +@value='Unknown' (Size = 100) SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` FROM `Cities` AS `c` -WHERE `c`.`Location` = @__value_0 +WHERE `c`.`Location` = @value """); } @@ -2608,235 +2283,6 @@ LEFT JOIN `Weapons` AS `w` ON `w`.`SynergyWithId` IS NOT NULL """); } - public override async Task Where_datetimeoffset_now(bool isAsync) - { - await base.Where_datetimeoffset_now(isAsync); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE `m`.`Timeline` <> NOW() -"""); - } - - public override async Task Where_datetimeoffset_utcnow(bool isAsync) - { - var dtoffset = -1 * TimeZoneInfo.Local.BaseUtcOffset.TotalMinutes; - await base.Where_datetimeoffset_utcnow(isAsync); - - AssertSql( - $""" -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE `m`.`Timeline` <> DATEADD('n', {dtoffset}.0, NOW()) -"""); - } - - public override async Task Where_datetimeoffset_date_component(bool isAsync) - { - //We have to specifically use 1 JAn 100 as that is the minimum in Jet. - //The default 0 in DateTimeOffset is normally mapped to the OLE Automation date 30 Dec 1899 - //Investigate if we can pick the scenario up automatically and have a new DateTimeOffset().Date go to the required value if we have a comparison - //await base.Where_datetimeoffset_date_component(isAsync); - await AssertQuery( - isAsync, - ss => from m in ss.Set() - where m.Timeline.Date > new DateTimeOffset(100,1,1,0,0,0,new TimeSpan()).Date - select m); - - AssertSql( - """ -@__Date_0='0100-01-01T00:00:00.0000000' (DbType = DateTime) - -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEVALUE(`m`.`Timeline`) > CDATE(@__Date_0) -"""); - } - - public override async Task Where_datetimeoffset_year_component(bool isAsync) - { - await AssertQuery( - isAsync, - ss => from m in ss.Set() - where m.Timeline.Year == 102 - select m); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('yyyy', `m`.`Timeline`) = 102 -"""); - } - - public override async Task Where_datetimeoffset_month_component(bool isAsync) - { - await base.Where_datetimeoffset_month_component(isAsync); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('m', `m`.`Timeline`) = 1 -"""); - } - - public override async Task Where_datetimeoffset_dayofyear_component(bool isAsync) - { - await base.Where_datetimeoffset_dayofyear_component(isAsync); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('y', `m`.`Timeline`) = 2 -"""); - } - - public override async Task Where_datetimeoffset_day_component(bool isAsync) - { - await base.Where_datetimeoffset_day_component(isAsync); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('d', `m`.`Timeline`) = 2 -"""); - } - - public override async Task Where_datetimeoffset_hour_component(bool isAsync) - { - await AssertQuery( - isAsync, - ss => from m in ss.Set() - where m.Timeline.Hour == 8 - select m); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('h', `m`.`Timeline`) = 8 -"""); - } - - public override async Task Where_datetimeoffset_minute_component(bool isAsync) - { - await base.Where_datetimeoffset_minute_component(isAsync); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('n', `m`.`Timeline`) = 0 -"""); - } - - public override async Task Where_datetimeoffset_second_component(bool isAsync) - { - await base.Where_datetimeoffset_second_component(isAsync); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('s', `m`.`Timeline`) = 0 -"""); - } - - public override async Task Where_datetimeoffset_millisecond_component(bool isAsync) - { - await base.Where_datetimeoffset_millisecond_component(isAsync); - - AssertSql( - $""" - SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Rating`, `m`.`Timeline` - FROM `Missions` AS `m` - WHERE DATEPART(millisecond, `m`.`Timeline`) = 0 - """); - } - - public override async Task DateTimeOffset_DateAdd_AddMonths(bool isAsync) - { - await base.DateTimeOffset_DateAdd_AddMonths(isAsync); - - AssertSql( - $""" - SELECT DATEADD('m', 1, `m`.`Timeline`) - FROM `Missions` AS `m` - """); - } - - public override async Task DateTimeOffset_DateAdd_AddDays(bool isAsync) - { - await base.DateTimeOffset_DateAdd_AddDays(isAsync); - - AssertSql( - """ -SELECT DATEADD('d', 1.0, `m`.`Timeline`) -FROM `Missions` AS `m` -"""); - } - - public override async Task DateTimeOffset_DateAdd_AddHours(bool isAsync) - { - await base.DateTimeOffset_DateAdd_AddHours(isAsync); - - AssertSql( - """ -SELECT DATEADD('h', 1.0, `m`.`Timeline`) -FROM `Missions` AS `m` -"""); - } - - public override async Task DateTimeOffset_DateAdd_AddMinutes(bool isAsync) - { - await base.DateTimeOffset_DateAdd_AddMinutes(isAsync); - - AssertSql( - """ -SELECT DATEADD('n', 1.0, `m`.`Timeline`) -FROM `Missions` AS `m` -"""); - } - - public override async Task DateTimeOffset_DateAdd_AddSeconds(bool isAsync) - { - await base.DateTimeOffset_DateAdd_AddSeconds(isAsync); - - AssertSql( - """ -SELECT DATEADD('s', 1.0, `m`.`Timeline`) -FROM `Missions` AS `m` -"""); - } - - public override async Task DateTimeOffset_DateAdd_AddMilliseconds(bool isAsync) - { - await base.DateTimeOffset_DateAdd_AddMilliseconds(isAsync); - - AssertSql( - $""" - SELECT DATEADD(millisecond, CAST(300.0E0 AS int), `m`.`Timeline`) - FROM `Missions` AS `m` - """); - } - - public override async Task Where_datetimeoffset_milliseconds_parameter_and_constant(bool isAsync) - { - await base.Where_datetimeoffset_milliseconds_parameter_and_constant(isAsync); - - AssertSql( -""" -SELECT COUNT(*) -FROM `Missions` AS `m` -WHERE `m`.`Timeline` = #1902-01-02 10:00:00# -"""); - } - public override async Task Orderby_added_for_client_side_GroupJoin_composite_dependent_to_principal_LOJ_when_incomplete_key_is_used( bool isAsync) { @@ -2949,7 +2395,7 @@ public override async Task Contains_with_local_nullable_guid_list_closure(bool i """ SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` FROM `Tags` AS `t` -WHERE `t`.`Id` IN ('{df36f493-463f-4123-83f9-6b135deeb7ba}', '{23cbcf9b-ce14-45cf-aafa-2c2667ebfdd3}', '{ab1b82d7-88db-42bd-a132-7eef9aa68af4}') +WHERE `t`.`Id` IN ({df36f493-463f-4123-83f9-6b135deeb7ba}, {23cbcf9b-ce14-45cf-aafa-2c2667ebfdd3}, {ab1b82d7-88db-42bd-a132-7eef9aa68af4}) """); } @@ -3110,7 +2556,7 @@ public override async Task Subquery_with_result_operator_is_not_lifted(bool isAs """ SELECT `g0`.`FullName` FROM ( - SELECT TOP 2 `g`.`FullName`, `g`.`Rank` + SELECT TOP @p `g`.`FullName`, `g`.`Rank` FROM `Gears` AS `g` WHERE `g`.`HasSoulPatch` = FALSE ORDER BY `g`.`FullName` @@ -3181,7 +2627,7 @@ public override async Task Take_without_orderby_followed_by_orderBy_is_pushed_do """ SELECT `g0`.`FullName` FROM ( - SELECT TOP 999 `g`.`FullName`, `g`.`Rank` + SELECT TOP @p `g`.`FullName`, `g`.`Rank` FROM `Gears` AS `g` WHERE `g`.`HasSoulPatch` = FALSE ) AS `g0` @@ -3225,10 +2671,10 @@ public override async Task Member_access_on_derived_materialized_entity_using_ca AssertSql( """ - SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`Eradicated` - FROM `Factions` AS `f` - ORDER BY `f`.`Name` - """); +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated` +FROM `Factions` AS `f` +ORDER BY `f`.`Name` +"""); } public override async Task Member_access_on_derived_entity_using_cast_and_let(bool isAsync) @@ -3278,7 +2724,7 @@ public override async Task Navigation_access_on_derived_materialized_entity_usin AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`Eradicated`, `l0`.`ThreatLevel` AS `Threat` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated`, `l0`.`ThreatLevel` AS `Threat` FROM `Factions` AS `f` LEFT JOIN ( SELECT `l`.`Name`, `l`.`ThreatLevel` @@ -3357,7 +2803,7 @@ public override async Task Include_on_derived_entity_using_OfType(bool isAsync) AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`Eradicated`, `l0`.`Name`, `l0`.`Discriminator`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, `l1`.`Name`, `l1`.`Discriminator`, `l1`.`LocustHordeId`, `l1`.`ThreatLevel`, `l1`.`ThreatLevelByte`, `l1`.`ThreatLevelNullableByte`, `l1`.`DefeatedByNickname`, `l1`.`DefeatedBySquadId`, `l1`.`HighCommandId` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated`, `l0`.`Name`, `l0`.`Discriminator`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, `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`, `l`.`Discriminator`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, `l`.`DefeatedByNickname`, `l`.`DefeatedBySquadId`, `l`.`HighCommandId` @@ -3809,7 +3255,7 @@ public override async Task ThenInclude_collection_on_derived_after_derived_refer AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`Eradicated`, `l0`.`Name`, `l0`.`Discriminator`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated`, `l0`.`Name`, `l0`.`Discriminator`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM ((`Factions` AS `f` LEFT JOIN ( SELECT `l`.`Name`, `l`.`Discriminator`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, `l`.`DefeatedByNickname`, `l`.`DefeatedBySquadId`, `l`.`HighCommandId` @@ -3845,7 +3291,7 @@ public override async Task ThenInclude_reference_on_derived_after_derived_collec AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`Eradicated`, `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` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated`, `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` FROM `Factions` AS `f` LEFT JOIN ( SELECT `l`.`Name`, `l`.`Discriminator`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, `l`.`DefeatedByNickname`, `l`.`DefeatedBySquadId`, `l`.`HighCommandId`, `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator` AS `Discriminator0`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` @@ -3862,7 +3308,7 @@ public override async Task Multiple_derived_included_on_one_method(bool isAsync) AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`Eradicated`, `l0`.`Name`, `l0`.`Discriminator`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated`, `l0`.`Name`, `l0`.`Discriminator`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM ((`Factions` AS `f` LEFT JOIN ( SELECT `l`.`Name`, `l`.`Discriminator`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, `l`.`DefeatedByNickname`, `l`.`DefeatedBySquadId`, `l`.`HighCommandId` @@ -4722,6 +4168,21 @@ public override async Task Correlated_collections_on_left_join_with_predicate(bo """); } + public override async Task Correlated_collections_on_RightJoin_with_predicate(bool async) + { + await base.Correlated_collections_on_RightJoin_with_predicate(async); + + AssertSql( + """ +SELECT [g].[Nickname], [g].[SquadId], [t].[Id], [w].[Name], [w].[Id] +FROM [Gears] AS [g] +RIGHT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] +LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] +WHERE [g].[HasSoulPatch] = CAST(0 AS bit) +ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id] +"""); + } + public override async Task Correlated_collections_on_left_join_with_null_value(bool isAsync) { await base.Correlated_collections_on_left_join_with_null_value(isAsync); @@ -4955,10 +4416,10 @@ public override async Task Null_semantics_on_nullable_bool_from_inner_join_subqu AssertSql( """ -SELECT `f0`.`Id`, `f0`.`CapitalName`, `f0`.`Discriminator`, `f0`.`Name`, `f0`.`ServerAddress`, `f0`.`CommanderName`, `f0`.`Eradicated` +SELECT `f0`.`Id`, `f0`.`CapitalName`, `f0`.`Discriminator`, `f0`.`Name`, `f0`.`ServerAddress`, `f0`.`CommanderName`, `f0`.`DeputyCommanderName`, `f0`.`Eradicated` FROM `LocustLeaders` AS `l` INNER JOIN ( - SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`Eradicated` + SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated` FROM `Factions` AS `f` WHERE `f`.`Name` = 'Swarm' ) AS `f0` ON `l`.`Name` = `f0`.`CommanderName` @@ -4972,10 +4433,10 @@ public override async Task Null_semantics_on_nullable_bool_from_left_join_subque AssertSql( """ -SELECT `f0`.`Id`, `f0`.`CapitalName`, `f0`.`Discriminator`, `f0`.`Name`, `f0`.`ServerAddress`, `f0`.`CommanderName`, `f0`.`Eradicated` +SELECT `f0`.`Id`, `f0`.`CapitalName`, `f0`.`Discriminator`, `f0`.`Name`, `f0`.`ServerAddress`, `f0`.`CommanderName`, `f0`.`DeputyCommanderName`, `f0`.`Eradicated` FROM `LocustLeaders` AS `l` LEFT JOIN ( - SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`Eradicated` + SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated` FROM `Factions` AS `f` WHERE `f`.`Name` = 'Swarm' ) AS `f0` ON `l`.`Name` = `f0`.`CommanderName` @@ -4991,7 +4452,7 @@ public override async Task Include_on_derived_type_with_order_by_and_paging(bool """ 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` FROM ( - SELECT TOP 10 `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`.`Id`, `t`.`Note` FROM (`LocustLeaders` AS `l` LEFT JOIN `Gears` AS `g` ON `l`.`DefeatedByNickname` = `g`.`Nickname` AND `l`.`DefeatedBySquadId` = `g`.`SquadId`) LEFT JOIN `Tags` AS `t` ON (`g`.`Nickname` = `t`.`GearNickName` OR (`g`.`Nickname` IS NULL AND `t`.`GearNickName` IS NULL)) AND (`g`.`SquadId` = `t`.`GearSquadId` OR (`g`.`SquadId` IS NULL AND `t`.`GearSquadId` IS NULL)) @@ -5833,10 +5294,10 @@ public override async Task Select_subquery_distinct_singleordefault_boolean2(boo AssertSql( """ SELECT IIF(( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` + SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%')) IS NULL, FALSE, ( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` + SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%'))) FROM `Gears` AS `g` @@ -5884,12 +5345,12 @@ public override async Task Select_subquery_distinct_singleordefault_boolean_empt await base.Select_subquery_distinct_singleordefault_boolean_empty2(isAsync); AssertSql( -""" + """ SELECT IIF(( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` + SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND `w`.`Name` = 'BFG') IS NULL, FALSE, ( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` + SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND `w`.`Name` = 'BFG')) FROM `Gears` AS `g` @@ -6087,17 +5548,6 @@ public override async Task String_concat_on_various_types(bool isAsync) """); } - public override async Task Time_of_day_datetimeoffset(bool isAsync) - { - await base.Time_of_day_datetimeoffset(isAsync); - - AssertSql( - """ -SELECT TIMEVALUE(`m`.`Timeline`) -FROM `Missions` AS `m` -"""); - } - public override async Task GroupBy_Property_Include_Select_Average(bool isAsync) { await base.GroupBy_Property_Include_Select_Average(isAsync); @@ -6276,7 +5726,7 @@ public override async Task OrderBy_same_expression_containing_IsNull_correctly_d """ SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, CBOOL(IIF(LEN(`g`.`Nickname`) IS NULL, NULL, CLNG(LEN(`g`.`Nickname`))) BXOR 5) BXOR TRUE, NULL) FROM `Gears` AS `g` -ORDER BY NOT (IIF(IIF(`g`.`LeaderNickname` IS NOT NULL, CBOOL(IIF(LEN(`g`.`Nickname`) IS NULL, NULL, CLNG(LEN(`g`.`Nickname`))) BXOR 5) BXOR TRUE, NULL) IS NOT NULL, TRUE, FALSE)) +ORDER BY NOT (IIF(`g`.`LeaderNickname` IS NOT NULL, TRUE, FALSE)) """); } @@ -6414,57 +5864,23 @@ WHERE IIF(LEN(`s`.`Name`) IS NULL, NULL, MID(`t`.`Note`, 0 + 1, IIF(LEN(`s`.`Nam """); } - public override async Task Filter_with_new_Guid(bool isAsync) + public override async Task OfTypeNav1(bool isAsync) { - await base.Filter_with_new_Guid(isAsync); + await base.OfTypeNav1(isAsync); AssertSql( - """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -WHERE `t`.`Id` = '{df36f493-463f-4123-83f9-6b135deeb7ba}' +""" +SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` +FROM (`Gears` AS `g` +LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId`) +LEFT JOIN `Tags` AS `t0` ON `g`.`Nickname` = `t0`.`GearNickName` AND `g`.`SquadId` = `t0`.`GearSquadId` +WHERE (`t`.`Note` <> 'Foo' OR `t`.`Note` IS NULL) AND `g`.`Discriminator` = 'Officer' AND (`t0`.`Note` <> 'Bar' OR `t0`.`Note` IS NULL) """); } - public override async Task Filter_with_new_Guid_closure(bool isAsync) + public override async Task OfTypeNav2(bool isAsync) { - await base.Filter_with_new_Guid_closure(isAsync); - - AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='df36f493-463f-4123-83f9-6b135deeb7bd'")} - - SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`Note` - FROM `Tags` AS `t` - WHERE `t`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} - """, - // - $""" - {AssertSqlHelper.Declaration("@__p_0='b39a6fba-9026-4d69-828e-fd7068673e57'")} - - SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`Note` - FROM `Tags` AS `t` - WHERE `t`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} - """); - } - - public override async Task OfTypeNav1(bool isAsync) - { - await base.OfTypeNav1(isAsync); - - AssertSql( -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` -FROM (`Gears` AS `g` -LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId`) -LEFT JOIN `Tags` AS `t0` ON `g`.`Nickname` = `t0`.`GearNickName` AND `g`.`SquadId` = `t0`.`GearSquadId` -WHERE (`t`.`Note` <> 'Foo' OR `t`.`Note` IS NULL) AND `g`.`Discriminator` = 'Officer' AND (`t0`.`Note` <> 'Bar' OR `t0`.`Note` IS NULL) -"""); - } - - public override async Task OfTypeNav2(bool isAsync) - { - await base.OfTypeNav2(isAsync); + await base.OfTypeNav2(isAsync); AssertSql( """ @@ -6529,7 +5945,7 @@ public override async Task Nav_rewrite_with_convert2(bool isAsync) AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`Eradicated` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated` FROM (`Factions` AS `f` LEFT JOIN `Cities` AS `c` ON `f`.`CapitalName` = `c`.`Name`) LEFT JOIN ( @@ -6547,7 +5963,7 @@ public override async Task Nav_rewrite_with_convert3(bool isAsync) AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`Eradicated` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated` FROM (`Factions` AS `f` LEFT JOIN `Cities` AS `c` ON `f`.`CapitalName` = `c`.`Name`) LEFT JOIN ( @@ -6632,12 +6048,12 @@ await AssertQuery( AssertSql( """ -@__start_0='1902-01-01T08:30:00.0000000Z' (DbType = DateTime) -@__end_1='1902-01-03T08:30:00.0000000Z' (DbType = DateTime) +@start='1902-01-01T08:30:00.0000000Z' (DbType = DateTime) +@end='1902-01-03T08:30:00.0000000Z' (DbType = DateTime) SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` FROM `Missions` AS `m` -WHERE @__start_0 <= DATEVALUE(`m`.`Timeline`) AND `m`.`Timeline` < @__end_1 AND `m`.`Timeline` = CDATE('1902-01-02 08:30:00') +WHERE @start <= DATEVALUE(`m`.`Timeline`) AND `m`.`Timeline` < @end AND `m`.`Timeline` = CDATE('1902-01-02 08:30:00') """); } @@ -6741,14 +6157,14 @@ public override async Task SelectMany_Where_DefaultIfEmpty_with_navigation_in_th AssertSql( """ -@__isAutomatic_0='True' +@isAutomatic='True' SELECT `g`.`Nickname`, `g`.`FullName`, IIF(`w0`.`Id` IS NOT NULL, TRUE, FALSE) AS `Collection` FROM `Gears` AS `g` LEFT JOIN ( SELECT `w`.`Id`, `w`.`OwnerFullName` FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` = @__isAutomatic_0 + WHERE `w`.`IsAutomatic` = @isAutomatic ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` """); } @@ -6759,14 +6175,14 @@ public override async Task SelectMany_Where_DefaultIfEmpty_with_navigation_in_th AssertSql( """ -@__isAutomatic_0='True' +@isAutomatic='True' SELECT `g`.`Nickname`, `g`.`FullName`, IIF(`w0`.`Id` IS NOT NULL, TRUE, FALSE) AS `Collection` FROM `Gears` AS `g` LEFT JOIN ( SELECT `w`.`Id`, `w`.`OwnerFullName` FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` <> @__isAutomatic_0 + WHERE `w`.`IsAutomatic` <> @isAutomatic ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` """); } @@ -6777,14 +6193,14 @@ public override async Task SelectMany_Where_DefaultIfEmpty_with_navigation_in_th AssertSql( """ -@__prm_0='1' +@prm='1' SELECT `g`.`Nickname`, `g`.`FullName`, IIF(`w0`.`Id` IS NOT NULL, TRUE, FALSE) AS `Collection` FROM `Gears` AS `g` LEFT JOIN ( SELECT `w`.`Id`, `w`.`OwnerFullName` FROM `Weapons` AS `w` - WHERE `w`.`Id` > @__prm_0 + WHERE `w`.`Id` > @prm ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` """); } @@ -6819,7 +6235,7 @@ public override async Task Navigation_based_on_complex_expression1(bool isAsync) AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`Eradicated` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated` FROM `Factions` AS `f` LEFT JOIN ( SELECT `l`.`Name` @@ -6836,7 +6252,7 @@ public override async Task Navigation_based_on_complex_expression2(bool isAsync) AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`Eradicated` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated` FROM `Factions` AS `f` LEFT JOIN ( SELECT `l`.`Name` @@ -7023,13 +6439,13 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para AssertSql( """ -@__prm_Inner_Nickname_0='Marcus' (Size = 255) +@prm_Inner_Nickname='Marcus' (Size = 255) SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM ( SELECT DISTINCT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` - WHERE `g`.`Nickname` <> @__prm_Inner_Nickname_0 + WHERE `g`.`Nickname` <> @prm_Inner_Nickname ) AS `g0` ORDER BY `g0`.`FullName` """); @@ -7041,8 +6457,8 @@ public override async Task Query_reusing_parameter_with_inner_query_doesnt_decla AssertSql( """ -@__squadId_0='1' -@__squadId_0='1' +@squadId='1' +@squadId='1' SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`Discriminator`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank` FROM ( @@ -7052,7 +6468,7 @@ public override async Task Query_reusing_parameter_with_inner_query_doesnt_decla WHERE `s`.`Id` IN ( SELECT `s0`.`Id` FROM `Squads` AS `s0` - WHERE `s0`.`Id` = @__squadId_0 + WHERE `s0`.`Id` = @squadId ) UNION ALL SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` @@ -7061,7 +6477,7 @@ UNION ALL WHERE `s1`.`Id` IN ( SELECT `s2`.`Id` FROM `Squads` AS `s2` - WHERE `s2`.`Id` = @__squadId_0 + WHERE `s2`.`Id` = @squadId ) ) AS `u` ORDER BY `u`.`FullName` @@ -7073,17 +6489,17 @@ public override async Task Query_reusing_parameter_with_inner_query_expression_d await base.Query_reusing_parameter_with_inner_query_expression_doesnt_declare_duplicate_parameter(async); AssertSql( - $""" - {AssertSqlHelper.Parameter("@__gearId_0='1'")} - {AssertSqlHelper.Parameter("@__gearId_0='1'")} - - SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` - FROM `Squads` AS `s` - WHERE EXISTS ( - SELECT 1 - FROM `Gears` AS `g` - WHERE `s`.`Id` = `g`.`SquadId` AND `g`.`SquadId` = {AssertSqlHelper.Declaration("@__gearId_0")} AND `g`.`SquadId` = {AssertSqlHelper.Declaration("@__gearId_0")}) - """); + """ +@gearId='1' +@gearId='1' + +SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` +FROM `Squads` AS `s` +WHERE EXISTS ( + SELECT 1 + FROM `Gears` AS `g` + WHERE `s`.`Id` = `g`.`SquadId` AND `g`.`SquadId` = @gearId AND `g`.`SquadId` = @gearId) +"""); } public override async Task Query_reusing_parameter_doesnt_declare_duplicate_parameter_complex(bool isAsync) @@ -7092,18 +6508,18 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para AssertSql( """ -@__entity_equality_prm_Inner_Squad_0_Id='1' (Nullable = true) -@__entity_equality_prm_Inner_Squad_0_Id='1' (Nullable = true) +@entity_equality_prm_Inner_Squad_Id='1' (Nullable = true) +@entity_equality_prm_Inner_Squad_Id='1' (Nullable = true) SELECT `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`AssignedCityName`, `s1`.`CityOfBirthName`, `s1`.`Discriminator`, `s1`.`FullName`, `s1`.`HasSoulPatch`, `s1`.`LeaderNickname`, `s1`.`LeaderSquadId`, `s1`.`Rank` FROM ( SELECT DISTINCT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` INNER JOIN `Squads` AS `s` ON `g`.`SquadId` = `s`.`Id` - WHERE `s`.`Id` = @__entity_equality_prm_Inner_Squad_0_Id + WHERE `s`.`Id` = @entity_equality_prm_Inner_Squad_Id ) AS `s1` INNER JOIN `Squads` AS `s0` ON `s1`.`SquadId` = `s0`.`Id` -WHERE `s0`.`Id` = @__entity_equality_prm_Inner_Squad_0_Id +WHERE `s0`.`Id` = @entity_equality_prm_Inner_Squad_Id ORDER BY `s1`.`FullName` """); } @@ -7259,10 +6675,10 @@ public override async Task Select_null_parameter_is_not_null(bool isAsync) await base.Select_null_parameter_is_not_null(isAsync); AssertSql( -""" -@__p_0='False' + """ +@p='False' -SELECT CBOOL(@__p_0) +SELECT CBOOL(@p) FROM `Gears` AS `g` """); } @@ -7271,12 +6687,12 @@ public override async Task Where_null_parameter_is_not_null(bool isAsync) { await base.Where_null_parameter_is_not_null(isAsync); AssertSql( -""" -@__p_0='False' + """ +@p='False' SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` -WHERE @__p_0 = TRUE +WHERE @p = TRUE """); } @@ -7309,33 +6725,33 @@ public override async Task Where_with_enum_flags_parameter(bool isAsync) AssertSql( """ - @__rank_0='1' (Nullable = true) - @__rank_0='1' (Nullable = true) - - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` - FROM `Gears` AS `g` - WHERE (`g`.`Rank` BAND @__rank_0) = @__rank_0 - """, +@rank='1' (Nullable = true) +@rank='1' (Nullable = true) + +SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` +FROM `Gears` AS `g` +WHERE (`g`.`Rank` BAND @rank) = @rank +""", // """ - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` - FROM `Gears` AS `g` - """, +SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` +FROM `Gears` AS `g` +""", // """ - @__rank_0='2' (Nullable = true) - @__rank_0='2' (Nullable = true) - - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` - FROM `Gears` AS `g` - WHERE (`g`.`Rank` BOR @__rank_0) <> @__rank_0 - """, +@rank='2' (Nullable = true) +@rank='2' (Nullable = true) + +SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` +FROM `Gears` AS `g` +WHERE (`g`.`Rank` BOR @rank) <> @rank +""", // """ - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` - FROM `Gears` AS `g` - WHERE 0 = 1 - """); +SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` +FROM `Gears` AS `g` +WHERE 0 = 1 +"""); } public override async Task FirstOrDefault_navigation_access_entity_equality_in_where_predicate_apply_peneding_selector(bool isAsync) @@ -7365,27 +6781,27 @@ public override async Task Bitwise_operation_with_non_null_parameter_optimizes_n AssertSql( """ -@__ranks_0='134' +@ranks='134' SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND @__ranks_0) <> 0 +WHERE (`g`.`Rank` BAND @ranks) <> 0 """, // """ -@__ranks_0='134' -@__ranks_0='134' +@ranks='134' +@ranks='134' -SELECT CBOOL((`g`.`Rank` BOR @__ranks_0) BXOR @__ranks_0) BXOR TRUE +SELECT CBOOL((`g`.`Rank` BOR @ranks) BXOR @ranks) BXOR TRUE FROM `Gears` AS `g` """, // """ -@__ranks_0='134' -@__ranks_0='134' -@__ranks_0='134' +@ranks='134' +@ranks='134' +@ranks='134' -SELECT CBOOL((`g`.`Rank` BOR (`g`.`Rank` BOR (@__ranks_0 BOR (`g`.`Rank` BOR @__ranks_0)))) BXOR @__ranks_0) BXOR TRUE +SELECT CBOOL((`g`.`Rank` BOR (`g`.`Rank` BOR (@ranks BOR (`g`.`Rank` BOR @ranks)))) BXOR @ranks) BXOR TRUE FROM `Gears` AS `g` """); } @@ -7395,44 +6811,44 @@ public override async Task Bitwise_operation_with_null_arguments(bool async) await base.Bitwise_operation_with_null_arguments(async); AssertSql( -""" + """ SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` WHERE `w`.`AmmunitionType` IS NULL """, -// -""" + // + """ SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` WHERE `w`.`AmmunitionType` IS NULL """, -// -""" + // + """ SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` WHERE `w`.`AmmunitionType` IS NULL """, -// -""" + // + """ SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` """, -// -""" -@__prm_0='2' (Nullable = true) + // + """ +@prm='2' (Nullable = true) SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND @__prm_0) <> 0 OR `w`.`AmmunitionType` IS NULL +WHERE (`w`.`AmmunitionType` BAND @prm) <> 0 OR `w`.`AmmunitionType` IS NULL """, -// -""" -@__prm_0='1' (Nullable = true) -@__prm_0='1' (Nullable = true) + // + """ +@prm='1' (Nullable = true) +@prm='1' (Nullable = true) SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND @__prm_0) = @__prm_0 +WHERE (`w`.`AmmunitionType` BAND @prm) = @prm """); } @@ -7442,19 +6858,19 @@ public override async Task Logical_operation_with_non_null_parameter_optimizes_n AssertSql( """ -@__prm_0='True' +@prm='True' SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` -WHERE `g`.`HasSoulPatch` <> @__prm_0 +WHERE `g`.`HasSoulPatch` <> @prm """, // """ -@__prm_0='False' +@prm='False' SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` -WHERE `g`.`HasSoulPatch` <> @__prm_0 +WHERE `g`.`HasSoulPatch` <> @prm """); } @@ -7483,23 +6899,6 @@ WHERE IIF(`f`.`Name` = 'Locust', TRUE, NULL) <> TRUE OR IIF(`f`.`Name` = 'Locust """); } - public override async Task Byte_array_contains_literal(bool async) - { - await base.Byte_array_contains_literal(async); - - AssertSql( - """ -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE INSTR(1, STRCONV(`s`.`Banner`, 64), 0x01, 0) > 0 -"""); - } - - public override async Task Byte_array_filter_by_length_literal(bool async) - { - var exception = await Assert.ThrowsAsync(() => base.Byte_array_filter_by_length_literal(async)); - } - [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual async Task Byte_array_filter_by_length_literal2(bool async) @@ -7517,11 +6916,6 @@ WHERE IIF(ASCB(RIGHTB(`s`.`Banner`, 1)) = 0, LENB(`s`.`Banner`) - 1, LENB(`s`.`B """); } - public override async Task Byte_array_filter_by_length_parameter(bool async) - { - var exception = await Assert.ThrowsAsync(() => base.Byte_array_filter_by_length_parameter(async)); - } - [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual async Task Byte_array_filter_by_length_parameter2(bool async) @@ -7534,19 +6928,14 @@ await AssertQuery( AssertSql( """ -@__p_1='2' +@p='2' SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` FROM `Squads` AS `s` -WHERE IIF(ASCB(RIGHTB(`s`.`Banner`, 1)) = 0, LENB(`s`.`Banner`) - 1, LENB(`s`.`Banner`)) = @__p_1 +WHERE IIF(ASCB(RIGHTB(`s`.`Banner`, 1)) = 0, LENB(`s`.`Banner`) - 1, LENB(`s`.`Banner`)) = @p """); } - public override void Byte_array_filter_by_length_parameter_compiled() - { - var exception = Assert.Throws(() => base.Byte_array_filter_by_length_parameter_compiled()); - } - [ConditionalFact] public virtual void Byte_array_filter_by_length_parameter_compiled2() { @@ -7561,30 +6950,16 @@ public virtual void Byte_array_filter_by_length_parameter_compiled2() AssertSql( """ -@__byteArrayParam='0x2A80' (Size = 510) -@__byteArrayParam='0x2A80' (Size = 510) -@__byteArrayParam='0x2A80' (Size = 510) -@__byteArrayParam='0x2A80' (Size = 510) -@__byteArrayParam='0x2A80' (Size = 510) -@__byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) SELECT COUNT(*) FROM `Squads` AS `s` -WHERE IIF(ASCB(RIGHTB(`s`.`Banner`, 1)) = 0, LENB(`s`.`Banner`) - 1, LENB(`s`.`Banner`)) = IIF(IIF(ASCB(RIGHTB(@__byteArrayParam, 1)) = 0, LENB(@__byteArrayParam) - 1, LENB(@__byteArrayParam)) IS NULL, NULL, CLNG(IIF(ASCB(RIGHTB(@__byteArrayParam, 1)) = 0, LENB(@__byteArrayParam) - 1, LENB(@__byteArrayParam)))) -"""); - } - - public override async Task Byte_array_contains_parameter(bool async) - { - await base.Byte_array_contains_parameter(async); - - AssertSql( - """ -@__someByte_0='1' (Size = 1) - -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE INSTR(1, STRCONV(`s`.`Banner`, 64), CHR(@__someByte_0), 0) > 0 +WHERE IIF(ASCB(RIGHTB(`s`.`Banner`, 1)) = 0, LENB(`s`.`Banner`) - 1, LENB(`s`.`Banner`)) = IIF(IIF(ASCB(RIGHTB(@byteArrayParam, 1)) = 0, LENB(@byteArrayParam) - 1, LENB(@byteArrayParam)) IS NULL, NULL, CLNG(IIF(ASCB(RIGHTB(@byteArrayParam, 1)) = 0, LENB(@byteArrayParam) - 1, LENB(@byteArrayParam)))) """); } @@ -7616,12 +6991,12 @@ public override async Task Conditional_expression_with_test_being_simplified_to_ AssertSql( """ - @__prm_0='True' - - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` - FROM `Gears` AS `g` - WHERE IIF(`g`.`HasSoulPatch` = @__prm_0, TRUE, FALSE) = TRUE - """); +@prm='True' + +SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` +FROM `Gears` AS `g` +WHERE IIF(`g`.`HasSoulPatch` = @prm, TRUE, FALSE) = TRUE +"""); } public override async Task Conditional_expression_with_test_being_simplified_to_constant_complex(bool isAsync) @@ -7629,16 +7004,16 @@ public override async Task Conditional_expression_with_test_being_simplified_to_ await base.Conditional_expression_with_test_being_simplified_to_constant_complex(isAsync); AssertSql( -""" -@__prm_0='True' -@__prm2_1='Marcus' Lancer' (Size = 255) + """ +@prm='True' +@prm2='Marcus' Lancer' (Size = 255) SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` -WHERE IIF(`g`.`HasSoulPatch` = @__prm_0 AND ( +WHERE IIF(`g`.`HasSoulPatch` = @prm AND ( SELECT TOP 1 `w`.`Name` FROM `Weapons` AS `w` - WHERE `w`.`Id` = `g`.`SquadId`) = @__prm2_1, TRUE, FALSE) = TRUE + WHERE `w`.`Id` = `g`.`SquadId`) = @prm2, TRUE, FALSE) = TRUE """); } @@ -7665,11 +7040,11 @@ await AssertQuery( AssertSql( """ -@__dateTimeOffset_Date_0='0102-03-01T00:00:00.0000000' (DbType = DateTime) +@dateTimeOffset_Date='0102-03-01T00:00:00.0000000' (DbType = DateTime) SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` FROM `Missions` AS `m` -WHERE DATEVALUE(`m`.`Timeline`) >= CDATE(@__dateTimeOffset_Date_0) +WHERE DATEVALUE(`m`.`Timeline`) >= CDATE(@dateTimeOffset_Date) """); } @@ -7706,20 +7081,6 @@ SELECT FALSE """); } - public override async Task Byte_array_filter_by_SequenceEqual(bool isAsync) - { - await base.Byte_array_filter_by_SequenceEqual(isAsync); - - AssertSql( - """ -@__byteArrayParam_0='0x0405060708' (Size = 5) - -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE `s`.`Banner5` = @__byteArrayParam_0 -"""); - } - public override async Task Group_by_nullable_property_HasValue_and_project_the_grouping_key(bool async) { await base.Group_by_nullable_property_HasValue_and_project_the_grouping_key(async); @@ -7771,98 +7132,6 @@ WHERE CLNG(`l`.`ThreatLevel`) <= (5 + CLNG(`l`.`ThreatLevel`)) """); } - public override async Task TimeSpan_Hours(bool async) - { - await base.TimeSpan_Hours(async); - - AssertSql( - """ -SELECT DATEPART('h', `m`.`Duration`) -FROM `Missions` AS `m` -"""); - } - - public override async Task TimeSpan_Minutes(bool async) - { - await base.TimeSpan_Minutes(async); - - AssertSql( - """ -SELECT DATEPART('n', `m`.`Duration`) -FROM `Missions` AS `m` -"""); - } - - public override async Task TimeSpan_Seconds(bool async) - { - await base.TimeSpan_Seconds(async); - - AssertSql( - """ -SELECT DATEPART('s', `m`.`Duration`) -FROM `Missions` AS `m` -"""); - } - - public override async Task TimeSpan_Milliseconds(bool async) - { - await base.TimeSpan_Milliseconds(async); - - AssertSql( - """ -SELECT DATEPART(millisecond, `m`.`Duration`) -FROM `Missions` AS `m` -"""); - } - - public override async Task Where_TimeSpan_Hours(bool async) - { - await base.Where_TimeSpan_Hours(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('h', `m`.`Duration`) = 1 -"""); - } - - public override async Task Where_TimeSpan_Minutes(bool async) - { - await base.Where_TimeSpan_Minutes(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('n', `m`.`Duration`) = 2 -"""); - } - - public override async Task Where_TimeSpan_Seconds(bool async) - { - await base.Where_TimeSpan_Seconds(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('s', `m`.`Duration`) = 3 -"""); - } - - public override async Task Where_TimeSpan_Milliseconds(bool async) - { - await base.Where_TimeSpan_Milliseconds(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`BriefingDocument`, `m`.`BriefingDocumentFileExtension`, `m`.`CodeName`, `m`.`Duration`, `m`.`Rating`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART(millisecond, `m`.`Duration`) = 1 -"""); - } - public override async Task Contains_on_collection_of_byte_subquery(bool async) { await base.Contains_on_collection_of_byte_subquery(async); @@ -7923,19 +7192,6 @@ SELECT 1 """); } - public override async Task Contains_on_byte_array_property_using_byte_column(bool async) - { - await base.Contains_on_byte_array_property_using_byte_column(async); - - AssertSql( - """ -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name`, `l`.`Name`, `l`.`Discriminator`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, `l`.`DefeatedByNickname`, `l`.`DefeatedBySquadId`, `l`.`HighCommandId` -FROM `Squads` AS `s`, -`LocustLeaders` AS `l` -WHERE INSTR(1, STRCONV(`s`.`Banner`, 64), CHR(`l`.`ThreatLevelByte`), 0) > 0 -"""); - } - public override async Task Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion( bool async) { @@ -8019,12 +7275,12 @@ public override async Task Enum_closure_typed_as_underlying_type_generates_corre await base.Enum_closure_typed_as_underlying_type_generates_correct_parameter_type(async); AssertSql( - """ -@__prm_0='1' (Nullable = true) + """ +@prm='1' (Nullable = true) SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` -WHERE @__prm_0 = `w`.`AmmunitionType` +WHERE @prm = `w`.`AmmunitionType` """); } @@ -8034,12 +7290,12 @@ public override async Task Enum_flags_closure_typed_as_underlying_type_generates AssertSql( """ - @__prm_0='133' - - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` - FROM `Gears` AS `g` - WHERE (@__prm_0 BAND `g`.`Rank`) = `g`.`Rank` - """); +@prm='133' + +SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` +FROM `Gears` AS `g` +WHERE (@prm BAND `g`.`Rank`) = `g`.`Rank` +"""); } public override async Task Enum_flags_closure_typed_as_different_type_generates_correct_parameter_type(bool async) @@ -8048,12 +7304,12 @@ public override async Task Enum_flags_closure_typed_as_different_type_generates_ AssertSql( """ - @__prm_0='5' - - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` - FROM `Gears` AS `g` - WHERE (@__prm_0 BAND CLNG(`g`.`Rank`)) = CLNG(`g`.`Rank`) - """); +@prm='5' + +SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` +FROM `Gears` AS `g` +WHERE (@prm BAND CLNG(`g`.`Rank`)) = CLNG(`g`.`Rank`) +"""); } public override async Task Constant_enum_with_same_underlying_value_as_previously_parameterized_int(bool async) @@ -8061,37 +7317,24 @@ public override async Task Constant_enum_with_same_underlying_value_as_previousl await base.Constant_enum_with_same_underlying_value_as_previously_parameterized_int(async); AssertSql( - """ -SELECT TOP 1 `g`.`Rank` BAND 1 + """ +SELECT TOP @p `g`.`Rank` BAND 1 FROM `Gears` AS `g` ORDER BY `g`.`Nickname` """); } - public override async Task Enum_array_contains(bool async) - { - await base.Enum_array_contains(async); - - AssertSql( -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -WHERE `w0`.`Id` IS NOT NULL AND (`w0`.`AmmunitionType` IS NULL OR `w0`.`AmmunitionType` = 1) -"""); - } - public override async Task Coalesce_with_non_root_evaluatable_Convert(bool async) { await base.Coalesce_with_non_root_evaluatable_Convert(async); AssertSql( """ -@__rank_0='1' (Nullable = true) +@rank='1' (Nullable = true) SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` -WHERE @__rank_0 = `g`.`Rank` +WHERE @rank = `g`.`Rank` """); } @@ -8397,44 +7640,20 @@ SELECT TOP 1 `t0`.`IssueDate` """); } - public override async Task First_on_byte_array(bool async) + public override async Task Project_shadow_properties(bool async) { - await base.First_on_byte_array(async); + await base.Project_shadow_properties(async); AssertSql( - """ -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE ASCB(MIDB(`s`.`Banner`, 1, 1)) = 2 + """ +SELECT `g`.`Nickname`, `g`.`AssignedCityName` +FROM `Gears` AS `g` """); } - public override async Task Array_access_on_byte_array(bool async) + public override async Task Project_discriminator_columns(bool async) { - await base.Array_access_on_byte_array(async); - - AssertSql( - """ -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE ASCB(MIDB(`s`.`Banner5`, 2 + 1, 1)) = 6 -"""); - } - - public override async Task Project_shadow_properties(bool async) - { - await base.Project_shadow_properties(async); - - AssertSql( - """ -SELECT `g`.`Nickname`, `g`.`AssignedCityName` -FROM `Gears` AS `g` -"""); - } - - public override async Task Project_discriminator_columns(bool async) - { - await base.Project_discriminator_columns(async); + await base.Project_discriminator_columns(async); AssertSql( """ @@ -8654,538 +7873,238 @@ ORDER BY `t`.`Note` """); } - public override async Task Projecting_property_converted_to_nullable_into_member_access(bool async) - { - await base.Projecting_property_converted_to_nullable_into_member_access(async); - - AssertSql( -""" -SELECT `g`.`Nickname` -FROM `Gears` AS `g` -LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` -WHERE DATEPART('m', `t`.`IssueDate`) <> 5 -ORDER BY `g`.`Nickname` -"""); - } - - public override async Task Projecting_property_converted_to_nullable_and_use_it_in_order_by(bool async) - { - await base.Projecting_property_converted_to_nullable_and_use_it_in_order_by(async); - - AssertSql( -""" -SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, TRUE, FALSE), `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` -FROM `Tags` AS `t` -LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `g`.`Nickname`, NULL) IS NOT NULL -ORDER BY IIF(`t`.`GearNickName` IS NOT NULL, `g`.`SquadId`, NULL), `t`.`Note` -"""); - } - - public override async Task Correlated_collection_with_distinct_projecting_identifier_column(bool async) - { - await base.Correlated_collection_with_distinct_projecting_identifier_column(async); - - AssertSql( - """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `t`.`Name` -FROM `Gears` AS `g` -OUTER APPLY ( - SELECT DISTINCT `w`.`Id`, `w`.`Name` - FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName` -) AS `t` -ORDER BY `g`.`Nickname`, `g`.`SquadId` -"""); - } - - public override async Task Correlated_collection_with_distinct_projecting_identifier_column_and_correlation_key(bool async) - { - await base.Correlated_collection_with_distinct_projecting_identifier_column_and_correlation_key(async); - - AssertSql( - """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id`, `w0`.`Name`, `w0`.`OwnerFullName` -FROM `Gears` AS `g` -LEFT JOIN ( - SELECT DISTINCT `w`.`Id`, `w`.`Name`, `w`.`OwnerFullName` - FROM `Weapons` AS `w` -) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `g`.`Nickname`, `g`.`SquadId` -"""); - } - - public override async Task Correlated_collection_with_distinct_projecting_identifier_column_composite_key(bool async) - { - await base.Correlated_collection_with_distinct_projecting_identifier_column_composite_key(async); - - AssertSql( - """ -SELECT `s`.`Id`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`HasSoulPatch` -FROM `Squads` AS `s` -LEFT JOIN ( - SELECT DISTINCT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` -) AS `g0` ON `s`.`Id` = `g0`.`SquadId` -ORDER BY `s`.`Id`, `g0`.`Nickname` -"""); - } - - public override async Task Correlated_collection_with_distinct_not_projecting_identifier_column(bool async) - { - await base.Correlated_collection_with_distinct_not_projecting_identifier_column(async); - - AssertSql( - """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `t`.`Name`, `t`.`IsAutomatic` -FROM `Gears` AS `g` -OUTER APPLY ( - SELECT DISTINCT `w`.`Name`, `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName` -) AS `t` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Name` -"""); - } - - public override async Task - Correlated_collection_with_groupby_not_projecting_identifier_column_but_only_grouping_key_in_final_projection(bool async) - { - await base.Correlated_collection_with_groupby_not_projecting_identifier_column_but_only_grouping_key_in_final_projection(async); - - AssertSql( - """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `t`.`Key` -FROM `Gears` AS `g` -OUTER APPLY ( - SELECT `w`.`IsAutomatic` AS `Key` - FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName` - GROUP BY `w`.`IsAutomatic` -) AS `t` -ORDER BY `g`.`Nickname`, `g`.`SquadId` -"""); - } - - public override async Task - Correlated_collection_with_groupby_not_projecting_identifier_column_with_group_aggregate_in_final_projection(bool async) - { - await base.Correlated_collection_with_groupby_not_projecting_identifier_column_with_group_aggregate_in_final_projection(async); - - AssertSql( - """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `t`.`Key`, `t`.`Count` -FROM `Gears` AS `g` -OUTER APPLY ( - SELECT `w`.`IsAutomatic` AS `Key`, COUNT(*) AS `Count` - FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName` - GROUP BY `w`.`IsAutomatic` -) AS `t` -ORDER BY `g`.`Nickname`, `g`.`SquadId` -"""); - } - - public override async Task - Correlated_collection_with_groupby_not_projecting_identifier_column_with_group_aggregate_in_final_projection_multiple_grouping_keys( - bool async) - { - await base - .Correlated_collection_with_groupby_not_projecting_identifier_column_with_group_aggregate_in_final_projection_multiple_grouping_keys( - async); - - AssertSql( - """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `t`.`IsAutomatic`, `t`.`Name`, `t`.`Count` -FROM `Gears` AS `g` -OUTER APPLY ( - SELECT `w`.`IsAutomatic`, `w`.`Name`, COUNT(*) AS `Count` - FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName` - GROUP BY `w`.`IsAutomatic`, `w`.`Name` -) AS `t` -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`IsAutomatic` -"""); - } - - public override async Task - Correlated_collection_with_groupby_with_complex_grouping_key_not_projecting_identifier_column_with_group_aggregate_in_final_projection( - bool async) - { - await base - .Correlated_collection_with_groupby_with_complex_grouping_key_not_projecting_identifier_column_with_group_aggregate_in_final_projection( - async); - - AssertSql( - """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `t0`.`Key`, `t0`.`Count` -FROM `Gears` AS `g` -OUTER APPLY ( - SELECT `t`.`Key`, COUNT(*) AS `Count` - FROM ( - SELECT CAST(LEN(`w`.`Name`) AS int) AS `Key` - FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName` - ) AS `t` - GROUP BY `t`.`Key` -) AS `t0` -ORDER BY `g`.`Nickname`, `g`.`SquadId` -"""); - } - - public override async Task Correlated_collection_via_SelectMany_with_Distinct_missing_indentifying_columns_in_projection(bool async) - { - await base.Correlated_collection_via_SelectMany_with_Distinct_missing_indentifying_columns_in_projection(async); - - AssertSql( - """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `t`.`HasSoulPatch` -FROM `Gears` AS `g` -OUTER APPLY ( - SELECT DISTINCT `g1`.`HasSoulPatch` - FROM `Weapons` AS `w` - LEFT JOIN `Gears` AS `g0` ON `w`.`OwnerFullName` = `g0`.`FullName` - LEFT JOIN `Cities` AS `c` ON `g0`.`AssignedCityName` = `c`.`Name` - INNER JOIN `Gears` AS `g1` ON `c`.`Name` = `g1`.`CityOfBirthName` - WHERE `g`.`FullName` = `w`.`OwnerFullName` -) AS `t` -ORDER BY `g`.`Nickname`, `g`.`SquadId` -"""); - } - - public override async Task Correlated_collection_after_distinct_3_levels(bool async) - { - await base.Correlated_collection_after_distinct_3_levels(async); - - AssertSql( - """ -SELECT `t`.`Id`, `t`.`Name`, `t1`.`Nickname`, `t1`.`FullName`, `t1`.`HasSoulPatch`, `t1`.`Id`, `t1`.`Name`, `t1`.`Nickname0`, `t1`.`FullName0`, `t1`.`HasSoulPatch0`, `t1`.`Id0` -FROM ( - SELECT DISTINCT `s`.`Id`, `s`.`Name` - FROM `Squads` AS `s` -) AS `t` -OUTER APPLY ( - SELECT `t0`.`Nickname`, `t0`.`FullName`, `t0`.`HasSoulPatch`, `t2`.`Id`, `t2`.`Name`, `t2`.`Nickname` AS `Nickname0`, `t2`.`FullName` AS `FullName0`, `t2`.`HasSoulPatch` AS `HasSoulPatch0`, `t2`.`Id0` - FROM ( - SELECT DISTINCT `g`.`Nickname`, `g`.`FullName`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - WHERE `g`.`SquadId` = `t`.`Id` - ) AS `t0` - OUTER APPLY ( - SELECT `t`.`Id`, `t`.`Name`, `t0`.`Nickname`, `t0`.`FullName`, `t0`.`HasSoulPatch`, `w`.`Id` AS `Id0` - FROM `Weapons` AS `w` - WHERE `w`.`OwnerFullName` = `t0`.`FullName` - ) AS `t2` -) AS `t1` -ORDER BY `t`.`Id`, `t1`.`Nickname`, `t1`.`FullName`, `t1`.`HasSoulPatch` -"""); - } - - public override async Task Correlated_collection_after_distinct_3_levels_without_original_identifiers(bool async) - { - await base.Correlated_collection_after_distinct_3_levels_without_original_identifiers(async); - - AssertSql(); - } - - public override async Task Where_DateOnly_Year(bool async) - { - await base.Where_DateOnly_Year(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('yyyy', `m`.`Date`) = 1990 -"""); - } - - public override async Task Where_DateOnly_Month(bool async) - { - await base.Where_DateOnly_Month(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('m', `m`.`Date`) = 11 -"""); - } - - public override async Task Where_DateOnly_Day(bool async) - { - await base.Where_DateOnly_Day(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('d', `m`.`Date`) = 10 -"""); - } - - public override async Task Where_DateOnly_DayOfYear(bool async) - { - await base.Where_DateOnly_DayOfYear(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('y', `m`.`Date`) = 314 -"""); - } - - public override async Task Where_DateOnly_DayOfWeek(bool async) - { - await AssertTranslationFailed(() => base.Where_DateOnly_DayOfWeek(async)); - - AssertSql(); - } - - public override async Task Where_DateOnly_AddYears(bool async) - { - await base.Where_DateOnly_AddYears(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEADD('yyyy', CLNG(3), `m`.`Date`) = #1993-11-10# -"""); - } - - public override async Task Where_DateOnly_AddMonths(bool async) - { - await base.Where_DateOnly_AddMonths(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEADD('m', CLNG(3), `m`.`Date`) = #1991-02-10# -"""); - } - - public override async Task Where_DateOnly_AddDays(bool async) - { - await base.Where_DateOnly_AddDays(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEADD('d', CLNG(3), `m`.`Date`) = #1990-11-13# -"""); - } - - public override async Task Where_TimeOnly_Hour(bool async) - { - await base.Where_TimeOnly_Hour(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('h', `m`.`Time`) = 10 -"""); - } - - public override async Task Where_TimeOnly_Minute(bool async) - { - await base.Where_TimeOnly_Minute(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('n', `m`.`Time`) = 15 -"""); - } - - public override async Task Where_TimeOnly_Second(bool async) + public override async Task Projecting_property_converted_to_nullable_into_member_access(bool async) { - await base.Where_TimeOnly_Second(async); + await base.Projecting_property_converted_to_nullable_into_member_access(async); AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('s', `m`.`Time`) = 50 +""" +SELECT `g`.`Nickname` +FROM `Gears` AS `g` +LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` +WHERE DATEPART('m', `t`.`IssueDate`) <> 5 +ORDER BY `g`.`Nickname` """); } - public override async Task Where_TimeOnly_Millisecond(bool async) + public override async Task Projecting_property_converted_to_nullable_and_use_it_in_order_by(bool async) { - await base.Where_TimeOnly_Millisecond(async); + await base.Projecting_property_converted_to_nullable_and_use_it_in_order_by(async); AssertSql( - """ -SELECT [m].[Id], [m].[BriefingDocument], [m].[BriefingDocumentFileExtension], [m].[CodeName], [m].[Date], [m].[Duration], [m].[Rating], [m].[Time], [m].[Timeline] -FROM [Missions] AS [m] -WHERE DATEPART(millisecond, [m].[Time]) = 500 +""" +SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, TRUE, FALSE), `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` +FROM `Tags` AS `t` +LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `g`.`Nickname`, NULL) IS NOT NULL +ORDER BY IIF(`t`.`GearNickName` IS NOT NULL, `g`.`SquadId`, NULL), `t`.`Note` """); } - public override async Task Where_TimeOnly_AddHours(bool async) + public override async Task Correlated_collection_with_distinct_projecting_identifier_column(bool async) { - await base.Where_TimeOnly_AddHours(async); + await base.Correlated_collection_with_distinct_projecting_identifier_column(async); AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE TIMEVALUE(DATEADD('h', CLNG(3.0), `m`.`Time`)) = TIMEVALUE('13:15:50') + """ +SELECT `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `t`.`Name` +FROM `Gears` AS `g` +OUTER APPLY ( + SELECT DISTINCT `w`.`Id`, `w`.`Name` + FROM `Weapons` AS `w` + WHERE `g`.`FullName` = `w`.`OwnerFullName` +) AS `t` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } - public override async Task Where_TimeOnly_AddMinutes(bool async) + public override async Task Correlated_collection_with_distinct_projecting_identifier_column_and_correlation_key(bool async) { - await base.Where_TimeOnly_AddMinutes(async); + await base.Correlated_collection_with_distinct_projecting_identifier_column_and_correlation_key(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE TIMEVALUE(DATEADD('n', CLNG(3.0), `m`.`Time`)) = TIMEVALUE('10:18:50') +SELECT `g`.`Nickname`, `g`.`SquadId`, `w0`.`Id`, `w0`.`Name`, `w0`.`OwnerFullName` +FROM `Gears` AS `g` +LEFT JOIN ( + SELECT DISTINCT `w`.`Id`, `w`.`Name`, `w`.`OwnerFullName` + FROM `Weapons` AS `w` +) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } - public override async Task Where_TimeOnly_Add_TimeSpan(bool async) - { - await AssertTranslationFailed(() => base.Where_TimeOnly_Add_TimeSpan(async)); - - AssertSql(); - } - - public override async Task Where_TimeOnly_IsBetween(bool async) + public override async Task Correlated_collection_with_distinct_projecting_identifier_column_composite_key(bool async) { - await base.Where_TimeOnly_IsBetween(async); + await base.Correlated_collection_with_distinct_projecting_identifier_column_composite_key(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE (IIF(`m`.`Time` >= TIMEVALUE('10:00:00'), TRUE, FALSE) BAND IIF(`m`.`Time` < TIMEVALUE('11:00:00'), TRUE, FALSE)) = TRUE +SELECT `s`.`Id`, `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`HasSoulPatch` +FROM `Squads` AS `s` +LEFT JOIN ( + SELECT DISTINCT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` +) AS `g0` ON `s`.`Id` = `g0`.`SquadId` +ORDER BY `s`.`Id`, `g0`.`Nickname` """); } - public override async Task Where_TimeOnly_subtract_TimeOnly(bool async) - { - await AssertTranslationFailed(() => base.Where_TimeOnly_subtract_TimeOnly(async)); - - AssertSql(); - } - - public override async Task Where_TimeOnly_FromDateTime_compared_to_property(bool async) + public override async Task Correlated_collection_with_distinct_not_projecting_identifier_column(bool async) { - await base.Where_TimeOnly_FromDateTime_compared_to_property(async); + await base.Correlated_collection_with_distinct_not_projecting_identifier_column(async); AssertSql( - """ -SELECT `t`.`Id` AS `TagId`, `m`.`Id` AS `MissionId` -FROM `Tags` AS `t`, -`Missions` AS `m` -WHERE TIMEVALUE(`t`.`IssueDate`) = `m`.`Time` + """ +SELECT `g`.`Nickname`, `g`.`SquadId`, `t`.`Name`, `t`.`IsAutomatic` +FROM `Gears` AS `g` +OUTER APPLY ( + SELECT DISTINCT `w`.`Name`, `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `g`.`FullName` = `w`.`OwnerFullName` +) AS `t` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Name` """); } - public override async Task Where_TimeOnly_FromDateTime_compared_to_parameter(bool async) + public override async Task + Correlated_collection_with_groupby_not_projecting_identifier_column_but_only_grouping_key_in_final_projection(bool async) { - await base.Where_TimeOnly_FromDateTime_compared_to_parameter(async); + await base.Correlated_collection_with_groupby_not_projecting_identifier_column_but_only_grouping_key_in_final_projection(async); AssertSql( """ -@__time_0='02:00' (DbType = Time) - -SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] -FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [g].[Nickname] IS NOT NULL AND [g].[SquadId] IS NOT NULL AND CAST(DATEADD(hour, CAST(CAST([g].[SquadId] AS float) AS int), [t].[IssueDate]) AS time) = @__time_0 +SELECT `g`.`Nickname`, `g`.`SquadId`, `t`.`Key` +FROM `Gears` AS `g` +OUTER APPLY ( + SELECT `w`.`IsAutomatic` AS `Key` + FROM `Weapons` AS `w` + WHERE `g`.`FullName` = `w`.`OwnerFullName` + GROUP BY `w`.`IsAutomatic` +) AS `t` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } - public override async Task Where_TimeOnly_FromDateTime_compared_to_constant(bool async) + public override async Task + Correlated_collection_with_groupby_not_projecting_identifier_column_with_group_aggregate_in_final_projection(bool async) { - await base.Where_TimeOnly_FromDateTime_compared_to_constant(async); + await base.Correlated_collection_with_groupby_not_projecting_identifier_column_with_group_aggregate_in_final_projection(async); AssertSql( - """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -WHERE IIF(DATEADD('h', CDBL(IIF(LEN(`t`.`Note`) IS NULL, NULL, CLNG(LEN(`t`.`Note`)))), `t`.`IssueDate`) IS NULL, NULL, TIMEVALUE(DATEADD('h', CDBL(IIF(LEN(`t`.`Note`) IS NULL, NULL, CLNG(LEN(`t`.`Note`)))), `t`.`IssueDate`))) > TIMEVALUE('09:00:00') + """ +SELECT `g`.`Nickname`, `g`.`SquadId`, `t`.`Key`, `t`.`Count` +FROM `Gears` AS `g` +OUTER APPLY ( + SELECT `w`.`IsAutomatic` AS `Key`, COUNT(*) AS `Count` + FROM `Weapons` AS `w` + WHERE `g`.`FullName` = `w`.`OwnerFullName` + GROUP BY `w`.`IsAutomatic` +) AS `t` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } - public override async Task Where_TimeOnly_FromTimeSpan_compared_to_property(bool async) + public override async Task + Correlated_collection_with_groupby_not_projecting_identifier_column_with_group_aggregate_in_final_projection_multiple_grouping_keys( + bool async) { - await base.Where_TimeOnly_FromTimeSpan_compared_to_property(async); + await base + .Correlated_collection_with_groupby_not_projecting_identifier_column_with_group_aggregate_in_final_projection_multiple_grouping_keys( + async); AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE TIMEVALUE(`m`.`Duration`) < `m`.`Time` + """ +SELECT `g`.`Nickname`, `g`.`SquadId`, `t`.`IsAutomatic`, `t`.`Name`, `t`.`Count` +FROM `Gears` AS `g` +OUTER APPLY ( + SELECT `w`.`IsAutomatic`, `w`.`Name`, COUNT(*) AS `Count` + FROM `Weapons` AS `w` + WHERE `g`.`FullName` = `w`.`OwnerFullName` + GROUP BY `w`.`IsAutomatic`, `w`.`Name` +) AS `t` +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`IsAutomatic` """); } - public override async Task Where_TimeOnly_FromTimeSpan_compared_to_parameter(bool async) + public override async Task + Correlated_collection_with_groupby_with_complex_grouping_key_not_projecting_identifier_column_with_group_aggregate_in_final_projection( + bool async) { - await base.Where_TimeOnly_FromTimeSpan_compared_to_parameter(async); + await base + .Correlated_collection_with_groupby_with_complex_grouping_key_not_projecting_identifier_column_with_group_aggregate_in_final_projection( + async); AssertSql( - """ -@__time_0='01:02:03' - -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE TIMEVALUE(`m`.`Duration`) = TIMEVALUE(@__time_0) + """ +SELECT `g`.`Nickname`, `g`.`SquadId`, `t0`.`Key`, `t0`.`Count` +FROM `Gears` AS `g` +OUTER APPLY ( + SELECT `t`.`Key`, COUNT(*) AS `Count` + FROM ( + SELECT CAST(LEN(`w`.`Name`) AS int) AS `Key` + FROM `Weapons` AS `w` + WHERE `g`.`FullName` = `w`.`OwnerFullName` + ) AS `t` + GROUP BY `t`.`Key` +) AS `t0` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } - public override async Task Order_by_TimeOnly_FromTimeSpan(bool async) + public override async Task Correlated_collection_via_SelectMany_with_Distinct_missing_indentifying_columns_in_projection(bool async) { - await base.Order_by_TimeOnly_FromTimeSpan(async); + await base.Correlated_collection_via_SelectMany_with_Distinct_missing_indentifying_columns_in_projection(async); AssertSql( """ -SELECT [m].[Id], [m].[BriefingDocument], [m].[BriefingDocumentFileExtension], [m].[CodeName], [m].[Date], [m].[Difficulty], [m].[Duration], [m].[Rating], [m].[Time], [m].[Timeline] -FROM [Missions] AS [m] -ORDER BY CAST([m].[Duration] AS time) +SELECT `g`.`Nickname`, `g`.`SquadId`, `t`.`HasSoulPatch` +FROM `Gears` AS `g` +OUTER APPLY ( + SELECT DISTINCT `g1`.`HasSoulPatch` + FROM `Weapons` AS `w` + LEFT JOIN `Gears` AS `g0` ON `w`.`OwnerFullName` = `g0`.`FullName` + LEFT JOIN `Cities` AS `c` ON `g0`.`AssignedCityName` = `c`.`Name` + INNER JOIN `Gears` AS `g1` ON `c`.`Name` = `g1`.`CityOfBirthName` + WHERE `g`.`FullName` = `w`.`OwnerFullName` +) AS `t` +ORDER BY `g`.`Nickname`, `g`.`SquadId` """); } - public override async Task Where_DateOnly_FromDateTime_compared_to_property(bool async) + public override async Task Correlated_collection_after_distinct_3_levels(bool async) { - await base.Where_DateOnly_FromDateTime_compared_to_property(async); + await base.Correlated_collection_after_distinct_3_levels(async); AssertSql( - """ -SELECT `t`.`Id` AS `TagId`, `m`.`Id` AS `MissionId` -FROM `Tags` AS `t`, -`Missions` AS `m` -WHERE `t`.`IssueDate` > `m`.`Date` + """ +SELECT `t`.`Id`, `t`.`Name`, `t1`.`Nickname`, `t1`.`FullName`, `t1`.`HasSoulPatch`, `t1`.`Id`, `t1`.`Name`, `t1`.`Nickname0`, `t1`.`FullName0`, `t1`.`HasSoulPatch0`, `t1`.`Id0` +FROM ( + SELECT DISTINCT `s`.`Id`, `s`.`Name` + FROM `Squads` AS `s` +) AS `t` +OUTER APPLY ( + SELECT `t0`.`Nickname`, `t0`.`FullName`, `t0`.`HasSoulPatch`, `t2`.`Id`, `t2`.`Name`, `t2`.`Nickname` AS `Nickname0`, `t2`.`FullName` AS `FullName0`, `t2`.`HasSoulPatch` AS `HasSoulPatch0`, `t2`.`Id0` + FROM ( + SELECT DISTINCT `g`.`Nickname`, `g`.`FullName`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + WHERE `g`.`SquadId` = `t`.`Id` + ) AS `t0` + OUTER APPLY ( + SELECT `t`.`Id`, `t`.`Name`, `t0`.`Nickname`, `t0`.`FullName`, `t0`.`HasSoulPatch`, `w`.`Id` AS `Id0` + FROM `Weapons` AS `w` + WHERE `w`.`OwnerFullName` = `t0`.`FullName` + ) AS `t2` +) AS `t1` +ORDER BY `t`.`Id`, `t1`.`Nickname`, `t1`.`FullName`, `t1`.`HasSoulPatch` """); } - public override async Task Where_DateOnly_FromDateTime_compared_to_constant_and_parameter(bool async) + public override async Task Correlated_collection_after_distinct_3_levels_without_original_identifiers(bool async) { - //await base.Where_DateOnly_FromDateTime_compared_to_constant_and_parameter(async); - - var prm = new DateOnly(102, 10, 11); - - await AssertQuery( - async, - ss => ss.Set().Where(x => new[] { prm, new DateOnly(115, 3, 7) }.Contains(DateOnly.FromDateTime(x.IssueDate)))); - - AssertSql( - $""" -@__prm_0='0102-10-11T00:00:00.0000000' (DbType = Date) + await base.Correlated_collection_after_distinct_3_levels_without_original_identifiers(async); -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -WHERE `t`.`IssueDate` IN ({AssertSqlHelper.Parameter("@__prm_0")}, #0115-03-07#) -"""); + AssertSql(); } public override async Task Include_on_entity_that_is_not_present_in_final_projection_but_uses_TypeIs_instead(bool async) @@ -9204,8 +8123,8 @@ public override async Task Comparison_with_value_converted_subclass(bool async) await base.Comparison_with_value_converted_subclass(async); AssertSql( - """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`Eradicated` + """ +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated` FROM `Factions` AS `f` WHERE `f`.`ServerAddress` = '127.0.0.1' """); @@ -9291,9 +8210,9 @@ public override async Task Join_entity_with_itself_grouped_by_key_followed_by_in """ SELECT `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`AssignedCityName`, `s0`.`CityOfBirthName`, `s0`.`Discriminator`, `s0`.`FullName`, `s0`.`HasSoulPatch`, `s0`.`LeaderNickname`, `s0`.`LeaderSquadId`, `s0`.`Rank`, `s0`.`HasSoulPatch0`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM ( - SELECT TOP 10 `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`Discriminator`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`HasSoulPatch0` + SELECT TOP @p0 `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`Discriminator`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`HasSoulPatch0` FROM ( - SELECT TOP 10 `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g1`.`HasSoulPatch` AS `HasSoulPatch0` + SELECT TOP @p + @p0 `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `g1`.`HasSoulPatch` AS `HasSoulPatch0` FROM `Gears` AS `g` LEFT JOIN ( SELECT MIN(IIF(LEN(`g0`.`Nickname`) IS NULL, NULL, CLNG(LEN(`g0`.`Nickname`)))) AS `c`, `g0`.`HasSoulPatch` @@ -9339,12 +8258,12 @@ public override async Task Parameter_used_multiple_times_take_appropriate_inferr AssertSql( """ -@__place_0='Ephyra's location' (Size = 255), @__place_0_1='Ephyra's location' (Size = 100) -@__place_0_1='Ephyra's location' (Size = 100) +@place='Ephyra's location' (Size = 255), @place0='Ephyra's location' (Size = 100) +@place='Ephyra's location' (Size = 255) SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` FROM `Cities` AS `c` -WHERE `c`.`Nation` = @__place_0 OR `c`.`Location` = @__place_0_1 OR `c`.`Location` = @__place_0_1 +WHERE `c`.`Nation` = @place OR `c`.`Location` = @place0 OR `c`.`Location` = @place """); } @@ -9354,12 +8273,12 @@ public override async Task Enum_matching_take_value_gets_different_type_mapping( AssertSql( """ - @__value_1='1' - - SELECT TOP 1 `g`.`Rank` BAND @__value_1 - FROM `Gears` AS `g` - ORDER BY `g`.`Nickname` - """); +@value='1' + +SELECT TOP @p `g`.`Rank` BAND @value +FROM `Gears` AS `g` +ORDER BY `g`.`Nickname` +"""); } public override async Task Include_after_Select_throws(bool async) @@ -9368,7 +8287,7 @@ public override async Task Include_after_Select_throws(bool async) AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`Eradicated`, `c`.`Name`, `c`.`Location`, `c`.`Nation` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated`, `c`.`Name`, `c`.`Location`, `c`.`Nation` FROM `Factions` AS `f` LEFT JOIN `Cities` AS `c` ON `f`.`CapitalName` = `c`.`Name` """); @@ -9430,24 +8349,13 @@ public override async Task Basic_query_gears(bool async) """); } - public override async Task DateTimeOffset_DateAdd_AddYears(bool async) - { - await base.DateTimeOffset_DateAdd_AddYears(async); - - AssertSql( - """ -SELECT DATEADD('yyyy', 1, `m`.`Timeline`) -FROM `Missions` AS `m` -"""); - } - public override async Task Include_on_derived_entity_with_cast(bool async) { await base.Include_on_derived_entity_with_cast(async); AssertSql( - """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`Eradicated`, `c`.`Name`, `c`.`Location`, `c`.`Nation` + """ +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated`, `c`.`Name`, `c`.`Location`, `c`.`Nation` FROM `Factions` AS `f` LEFT JOIN `Cities` AS `c` ON `f`.`CapitalName` = `c`.`Name` ORDER BY `f`.`Id` @@ -9466,26 +8374,6 @@ public override async Task Where_equals_method_on_nullable_with_object_overload( """); } - public override async Task ToString_guid_property_projection(bool async) - { - await AssertQuery( - async, - ss => ss.Set().Select( - ct => new { A = ct.GearNickName, B = ct.Id.ToString("B") }), - elementSorter: e => e.B, - elementAsserter: (e, a) => - { - Assert.Equal(e.A, a.A); - Assert.Equal(e.B.ToLower(), a.B.ToLower()); - }); - - AssertSql( - """ -SELECT `t`.`GearNickName`, `t`.`Id` -FROM `Tags` AS `t` -"""); - } - public override async Task Cast_to_derived_followed_by_multiple_includes(bool async) { await base.Cast_to_derived_followed_by_multiple_includes(async); @@ -9532,8 +8420,8 @@ public override async Task Project_derivied_entity_with_convert_to_parent(bool a await base.Project_derivied_entity_with_convert_to_parent(async); AssertSql( - """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`Eradicated` + """ +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Discriminator`, `f`.`Name`, `f`.`ServerAddress`, `f`.`CommanderName`, `f`.`DeputyCommanderName`, `f`.`Eradicated` FROM `Factions` AS `f` """); } @@ -9931,7 +8819,7 @@ public override async Task ElementAt_basic_with_OrderBy(bool async) FROM ( SELECT TOP 1 `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM ( - SELECT TOP 1 `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` + SELECT TOP @p + 1 `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` ORDER BY `g`.`FullName` ) AS `g0` @@ -9951,7 +8839,7 @@ public override async Task ElementAtOrDefault_basic_with_OrderBy(bool async) FROM ( SELECT TOP 1 `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM ( - SELECT TOP 2 `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` + SELECT TOP @p + 1 `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` ORDER BY `g`.`FullName` ) AS `g0` @@ -9971,7 +8859,7 @@ public override async Task ElementAtOrDefault_basic_with_OrderBy_parameter(bool FROM ( SELECT TOP 1 `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`Discriminator`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank` FROM ( - SELECT TOP 3 `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` + SELECT TOP @p + 1 `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` ORDER BY `g`.`FullName` ) AS `g0` @@ -10026,48 +8914,6 @@ public override async Task Using_indexer_on_byte_array_and_string_in_projection( """); } - public override async Task DateTimeOffset_to_unix_time_milliseconds(bool async) - { - await base.DateTimeOffset_to_unix_time_milliseconds(async); - - AssertSql( - """ -@__unixEpochMilliseconds_0='0' - -SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name], [s1].[SquadId], [s1].[MissionId] -FROM [Gears] AS [g] -INNER JOIN [Squads] AS [s] ON [g].[SquadId] = [s].[Id] -LEFT JOIN [SquadMissions] AS [s1] ON [s].[Id] = [s1].[SquadId] -WHERE NOT EXISTS ( - SELECT 1 - FROM [SquadMissions] AS [s0] - INNER JOIN [Missions] AS [m] ON [s0].[MissionId] = [m].[Id] - WHERE [s].[Id] = [s0].[SquadId] AND @__unixEpochMilliseconds_0 = DATEDIFF_BIG(millisecond, '1970-01-01T00:00:00.0000000+00:00', [m].[Timeline])) -ORDER BY [g].[Nickname], [g].[SquadId], [s].[Id], [s1].[SquadId] -"""); - } - - public override async Task DateTimeOffset_to_unix_time_seconds(bool async) - { - await base.DateTimeOffset_to_unix_time_seconds(async); - - AssertSql( - $""" -@__unixEpochSeconds_0='0' (DbType = Decimal) - -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name`, `s1`.`SquadId`, `s1`.`MissionId` -FROM (`Gears` AS `g` -INNER JOIN `Squads` AS `s` ON `g`.`SquadId` = `s`.`Id`) -LEFT JOIN `SquadMissions` AS `s1` ON `s`.`Id` = `s1`.`SquadId` -WHERE NOT EXISTS ( - SELECT `s0`.`SquadId` - FROM `SquadMissions` AS `s0` - INNER JOIN `Missions` AS `m` ON `s0`.`MissionId` = `m`.`Id` - WHERE `s`.`Id` = `s0`.`SquadId` AND {AssertSqlHelper.Parameter("@__unixEpochSeconds_0")} = DATEDIFF('s', CDATE('1970-01-01 00:00:00'), `m`.`Timeline`)) -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Id`, `s1`.`SquadId` -"""); - } - public override async Task Set_operator_with_navigation_in_projection_groupby_aggregate(bool async) { await base.Set_operator_with_navigation_in_projection_groupby_aggregate(async); @@ -10306,21 +9152,21 @@ public override async Task Nested_contains_with_enum(bool async) AssertSql( """ -@__key_1='5f221fb9-66f4-442a-92c9-d97ed5989cc7' -@__key_1='5f221fb9-66f4-442a-92c9-d97ed5989cc7' +@key='5f221fb9-66f4-442a-92c9-d97ed5989cc7' +@key='5f221fb9-66f4-442a-92c9-d97ed5989cc7' SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` -WHERE IIF(`g`.`Rank` = 1, @__key_1, @__key_1) IN ('{0a47bcb7-a1cb-4345-8944-c58f82d6aac7}', '{5f221fb9-66f4-442a-92c9-d97ed5989cc7}') +WHERE IIF(`g`.`Rank` = 1, @key, @key) IN ({0a47bcb7-a1cb-4345-8944-c58f82d6aac7}, {5f221fb9-66f4-442a-92c9-d97ed5989cc7}) """, // """ -@__key_1='5f221fb9-66f4-442a-92c9-d97ed5989cc7' -@__key_1='5f221fb9-66f4-442a-92c9-d97ed5989cc7' +@key='5f221fb9-66f4-442a-92c9-d97ed5989cc7' +@key='5f221fb9-66f4-442a-92c9-d97ed5989cc7' SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` -WHERE IIF(`w`.`AmmunitionType` = 1, @__key_1, @__key_1) IN ('{0a47bcb7-a1cb-4345-8944-c58f82d6aac7}', '{5f221fb9-66f4-442a-92c9-d97ed5989cc7}') +WHERE IIF(`w`.`AmmunitionType` = 1, @key, @key) IN ({0a47bcb7-a1cb-4345-8944-c58f82d6aac7}, {5f221fb9-66f4-442a-92c9-d97ed5989cc7}) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/ManyToManyNoTrackingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ManyToManyNoTrackingQueryJetTest.cs index 957c01ad..c6d889df 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ManyToManyNoTrackingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ManyToManyNoTrackingQueryJetTest.cs @@ -86,14 +86,14 @@ public override async Task Skip_navigation_count_without_predicate(bool async) await base.Skip_navigation_count_without_predicate(async); AssertSql( -""" -SELECT [e].[Id], [e].[Name] -FROM [EntityOnes] AS [e] -WHERE ( - SELECT COUNT(*) - FROM [JoinOneSelfPayload] AS [j] - INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] - WHERE [e].[Id] = [j].[RightId]) > 0 + """ +SELECT `e`.`Id`, `e`.`Name` +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`) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/ManyToManyQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ManyToManyQueryJetTest.cs index 333d4dae..1e37b8a0 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ManyToManyQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ManyToManyQueryJetTest.cs @@ -86,14 +86,14 @@ public override async Task Skip_navigation_count_without_predicate(bool async) await base.Skip_navigation_count_without_predicate(async); AssertSql( -""" -SELECT [e].[Id], [e].[Name] -FROM [EntityOnes] AS [e] -WHERE ( - SELECT COUNT(*) - FROM [JoinOneSelfPayload] AS [j] - INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] - WHERE [e].[Id] = [j].[RightId]) > 0 + """ +SELECT `e`.`Id`, `e`.`Name` +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`) """); } @@ -1804,8 +1804,8 @@ public override async Task Contains_on_skip_collection_navigation(bool async) await base.Contains_on_skip_collection_navigation(async); AssertSql( - $""" -@__entity_equality_two_0_Id='1' (Nullable = true) + """ +@entity_equality_two_Id='1' (Nullable = true) SELECT `e`.`Id`, `e`.`Name` FROM `EntityOnes` AS `e` @@ -1813,7 +1813,7 @@ WHERE EXISTS ( SELECT 1 FROM `JoinOneToTwo` AS `j` INNER JOIN `EntityTwos` AS `e0` ON `j`.`TwoId` = `e0`.`Id` - WHERE `e`.`Id` = `j`.`OneId` AND `e0`.`Id` = {AssertSqlHelper.Parameter("@__entity_equality_two_0_Id")}) + WHERE `e`.`Id` = `j`.`OneId` AND `e0`.`Id` = @entity_equality_two_Id) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs index fda4409a..e9d43d14 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs @@ -44,9 +44,6 @@ public override async Task LastOrDefault_when_no_order_by(bool async) AssertSql(); } - public override async Task Contains_with_local_tuple_array_closure(bool async) - => await AssertTranslationFailed(() => base.Contains_with_local_tuple_array_closure(async)); - public override async Task Array_cast_to_IEnumerable_Contains_with_constant(bool async) { await base.Array_cast_to_IEnumerable_Contains_with_constant(async); @@ -489,7 +486,7 @@ public override async Task OrderBy_client_Take(bool async) AssertSql( """ -SELECT TOP 10 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` +SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` ORDER BY 1 """); @@ -1103,7 +1100,7 @@ SELECT MIN(`o0`.`ProductID`) FROM `Orders` AS `o` WHERE `c0`.`CustomerID` = `o`.`CustomerID`)) FROM ( - SELECT TOP 3 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` @@ -1124,7 +1121,7 @@ SELECT MAX(`o0`.`ProductID`) FROM `Orders` AS `o` WHERE `c0`.`CustomerID` = `o`.`CustomerID`)) FROM ( - SELECT TOP 3 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` @@ -1193,7 +1190,7 @@ SELECT MAX(`o0`.`ProductID`) FROM `Orders` AS `o` WHERE `c0`.`CustomerID` = `o`.`CustomerID`)) FROM ( - SELECT TOP 3 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` @@ -1214,7 +1211,7 @@ SELECT IIF(SUM(`o0`.`ProductID`) IS NULL, 0, SUM(`o0`.`ProductID`)) FROM `Orders` AS `o` WHERE `c0`.`CustomerID` = `o`.`CustomerID`)) FROM ( - SELECT TOP 3 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` @@ -1642,24 +1639,6 @@ public override async Task Contains_with_local_uint_array_closure(bool isAsync) """); } - public override async Task Contains_with_local_nullable_uint_array_closure(bool isAsync) - { - await base.Contains_with_local_nullable_uint_array_closure(isAsync); - - AssertSql( - $""" - SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` - FROM `Employees` AS `e` - WHERE `e`.`EmployeeID` IN (0, 1) - """, - // - $""" - SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` - FROM `Employees` AS `e` - WHERE `e`.`EmployeeID` = 0 - """); - } - public override async Task Contains_with_local_array_inline(bool isAsync) { await base.Contains_with_local_array_inline(isAsync); @@ -2071,10 +2050,10 @@ public override async Task Contains_top_level(bool isAsync) await base.Contains_top_level(isAsync); AssertSql( - $""" -@__p_0='ALFKI' (Size = 5) + """ +@p='ALFKI' (Size = 5) -SELECT IIF({AssertSqlHelper.Parameter("@__p_0")} IN ( +SELECT IIF(@p IN ( SELECT `c`.`CustomerID` FROM `Customers` AS `c` ), TRUE, FALSE) @@ -2082,13 +2061,6 @@ SELECT IIF({AssertSqlHelper.Parameter("@__p_0")} IN ( """); } - public override async Task Contains_with_local_anonymous_type_array_closure(bool isAsync) - { - await AssertTranslationFailed(() => base.Contains_with_local_anonymous_type_array_closure(isAsync)); - - AssertSql(); - } - public override async Task OfType_Select(bool async) { await base.OfType_Select(async); @@ -2160,7 +2132,7 @@ public override async Task OrderBy_Take_Last_gives_correct_result(bool isAsync) """ SELECT TOP 1 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` FROM ( - SELECT TOP 20 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` @@ -2192,21 +2164,21 @@ public override async Task Contains_over_entityType_should_rewrite_to_identity_e await base.Contains_over_entityType_should_rewrite_to_identity_equality(async); AssertSql( - $""" - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE `o`.`OrderID` = 10248 - """, + """ +SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderID` = 10248 +""", // - $""" - {AssertSqlHelper.Declaration("@__entity_equality_p_0_OrderID='10248' (Nullable = true)")} - - SELECT IIF(EXISTS ( - SELECT 1 - FROM `Orders` AS `o` - WHERE `o`.`CustomerID` = 'VINET' AND `o`.`OrderID` = {AssertSqlHelper.Parameter("@__entity_equality_p_0_OrderID")}), TRUE, FALSE) - FROM (SELECT COUNT(*) FROM `#Dual`) - """); + """ +@entity_equality_p_OrderID='10248' (Nullable = true) + +SELECT IIF(EXISTS ( + SELECT 1 + FROM `Orders` AS `o` + WHERE `o`.`CustomerID` = 'VINET' AND `o`.`OrderID` = @entity_equality_p_OrderID), TRUE, FALSE) +FROM (SELECT COUNT(*) FROM `#Dual`) +"""); } public override async Task List_Contains_over_entityType_should_rewrite_to_identity_equality(bool isAsync) @@ -2214,16 +2186,16 @@ public override async Task List_Contains_over_entityType_should_rewrite_to_ident await base.List_Contains_over_entityType_should_rewrite_to_identity_equality(isAsync); AssertSql( - $""" - @__entity_equality_someOrder_0_OrderID='10248' (Nullable = true) - - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE EXISTS ( - SELECT 1 - FROM `Orders` AS `o` - WHERE `c`.`CustomerID` = `o`.`CustomerID` AND `o`.`OrderID` = {AssertSqlHelper.Parameter("@__entity_equality_someOrder_0_OrderID")}) - """); + """ +@entity_equality_someOrder_OrderID='10248' (Nullable = true) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE EXISTS ( + SELECT 1 + FROM `Orders` AS `o` + WHERE `c`.`CustomerID` = `o`.`CustomerID` AND `o`.`OrderID` = @entity_equality_someOrder_OrderID) +"""); } public override async Task List_Contains_with_constant_list(bool isAsync) @@ -2716,7 +2688,7 @@ public override async Task Count_after_client_projection(bool async) """ SELECT COUNT(*) FROM ( - SELECT TOP 1 1 + SELECT TOP @p 1 FROM `Orders` AS `o` ) AS `o0` """); diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindChangeTrackingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindChangeTrackingQueryJetTest.cs index ada0f08e..6d285278 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindChangeTrackingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindChangeTrackingQueryJetTest.cs @@ -76,7 +76,7 @@ public override void Can_disable_and_reenable_query_result_tracking() AssertSql( """ -SELECT TOP 1 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` +SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` """, @@ -84,9 +84,9 @@ ORDER BY `e`.`EmployeeID` """ SELECT `e1`.`EmployeeID`, `e1`.`City`, `e1`.`Country`, `e1`.`FirstName`, `e1`.`ReportsTo`, `e1`.`Title` FROM ( - SELECT TOP 1 `e0`.`EmployeeID`, `e0`.`City`, `e0`.`Country`, `e0`.`FirstName`, `e0`.`ReportsTo`, `e0`.`Title` + SELECT TOP @p `e0`.`EmployeeID`, `e0`.`City`, `e0`.`Country`, `e0`.`FirstName`, `e0`.`ReportsTo`, `e0`.`Title` FROM ( - SELECT TOP 2 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` + SELECT TOP @p + @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` ) AS `e0` @@ -252,7 +252,7 @@ public override void Can_disable_and_reenable_query_result_tracking_starting_wit AssertSql( """ -SELECT TOP 1 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` +SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` """, @@ -260,9 +260,9 @@ ORDER BY `e`.`EmployeeID` """ SELECT `e1`.`EmployeeID`, `e1`.`City`, `e1`.`Country`, `e1`.`FirstName`, `e1`.`ReportsTo`, `e1`.`Title` FROM ( - SELECT TOP 1 `e0`.`EmployeeID`, `e0`.`City`, `e0`.`Country`, `e0`.`FirstName`, `e0`.`ReportsTo`, `e0`.`Title` + SELECT TOP @p `e0`.`EmployeeID`, `e0`.`City`, `e0`.`Country`, `e0`.`FirstName`, `e0`.`ReportsTo`, `e0`.`Title` FROM ( - SELECT TOP 2 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` + SELECT TOP @p + @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` ) AS `e0` diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindCompiledQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindCompiledQueryJetTest.cs index f05aec82..1e9c37ff 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindCompiledQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindCompiledQueryJetTest.cs @@ -91,21 +91,21 @@ public override void Query_with_single_parameter() base.Query_with_single_parameter(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__customerID='ALFKI' (Size = 5)")} - - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} - """, + """ +@customerID='ALFKI' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = @customerID +""", // - $""" - {AssertSqlHelper.Declaration("@__customerID='ANATR' (Size = 5)")} - - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} - """); + """ +@customerID='ANATR' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = @customerID +"""); } public override void First_query_with_single_parameter() @@ -113,21 +113,21 @@ public override void First_query_with_single_parameter() base.First_query_with_single_parameter(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__customerID='ALFKI' (Size = 5)")} - - SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} - """, + """ +@customerID='ALFKI' (Size = 5) + +SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = @customerID +""", // - $""" - {AssertSqlHelper.Declaration("@__customerID='ANATR' (Size = 5)")} - - SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} - """); + """ +@customerID='ANATR' (Size = 5) + +SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = @customerID +"""); } public override void Query_with_two_parameters() @@ -135,21 +135,21 @@ public override void Query_with_two_parameters() base.Query_with_two_parameters(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__customerID='ALFKI' (Size = 5)")} - - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} - """, + """ +@customerID='ALFKI' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = @customerID +""", // - $""" - {AssertSqlHelper.Declaration("@__customerID='ANATR' (Size = 5)")} - - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} - """); + """ +@customerID='ANATR' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = @customerID +"""); } public override void Query_with_three_parameters() @@ -157,21 +157,21 @@ public override void Query_with_three_parameters() base.Query_with_three_parameters(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__customerID='ALFKI' (Size = 5)")} - - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} - """, + """ +@customerID='ALFKI' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = @customerID +""", // - $""" - {AssertSqlHelper.Declaration("@__customerID='ANATR' (Size = 5)")} - - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} - """); + """ +@customerID='ANATR' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = @customerID +"""); } public override void Query_with_contains() @@ -215,13 +215,13 @@ public override void Compiled_query_when_does_not_end_in_query_operator() base.Compiled_query_when_does_not_end_in_query_operator(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__customerID='ALFKI' (Size = 5)")} - - SELECT COUNT(*) - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} - """); + """ +@customerID='ALFKI' (Size = 5) + +SELECT COUNT(*) +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = @customerID +"""); } public override async Task Compiled_query_with_max_parameters() @@ -229,161 +229,161 @@ public override async Task Compiled_query_with_max_parameters() await base.Compiled_query_with_max_parameters(); AssertSql( -$""" -@__s1='ALFKI' (Size = 5) -@__s2='ANATR' (Size = 5) -@__s3='ANTON' (Size = 5) -@__s4='AROUT' (Size = 5) -@__s5='BERGS' (Size = 5) -@__s6='BLAUS' (Size = 5) -@__s7='BLONP' (Size = 5) -@__s8='BOLID' (Size = 5) -@__s9='BONAP' (Size = 5) -@__s10='BSBEV' (Size = 5) -@__s11='CACTU' (Size = 5) -@__s12='CENTC' (Size = 5) -@__s13='CHOPS' (Size = 5) -@__s14='CONSH' (Size = 5) -@__s15='RANDM' (Size = 5) + """ +@s1='ALFKI' (Size = 5) +@s2='ANATR' (Size = 5) +@s3='ANTON' (Size = 5) +@s4='AROUT' (Size = 5) +@s5='BERGS' (Size = 5) +@s6='BLAUS' (Size = 5) +@s7='BLONP' (Size = 5) +@s8='BOLID' (Size = 5) +@s9='BONAP' (Size = 5) +@s10='BSBEV' (Size = 5) +@s11='CACTU' (Size = 5) +@s12='CENTC' (Size = 5) +@s13='CHOPS' (Size = 5) +@s14='CONSH' (Size = 5) +@s15='RANDM' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s1")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s2")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s3")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s4")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s5")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s6")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s7")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s8")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s9")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s10")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s11")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s12")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s13")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s14")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s15")} +WHERE `c`.`CustomerID` = @s1 OR `c`.`CustomerID` = @s2 OR `c`.`CustomerID` = @s3 OR `c`.`CustomerID` = @s4 OR `c`.`CustomerID` = @s5 OR `c`.`CustomerID` = @s6 OR `c`.`CustomerID` = @s7 OR `c`.`CustomerID` = @s8 OR `c`.`CustomerID` = @s9 OR `c`.`CustomerID` = @s10 OR `c`.`CustomerID` = @s11 OR `c`.`CustomerID` = @s12 OR `c`.`CustomerID` = @s13 OR `c`.`CustomerID` = @s14 OR `c`.`CustomerID` = @s15 """, // -$""" -@__s1='ALFKI' (Size = 5) -@__s2='ANATR' (Size = 5) -@__s3='ANTON' (Size = 5) -@__s4='AROUT' (Size = 5) -@__s5='BERGS' (Size = 5) -@__s6='BLAUS' (Size = 5) -@__s7='BLONP' (Size = 5) -@__s8='BOLID' (Size = 5) -@__s9='BONAP' (Size = 5) -@__s10='BSBEV' (Size = 5) -@__s11='CACTU' (Size = 5) -@__s12='CENTC' (Size = 5) -@__s13='CHOPS' (Size = 5) -@__s14='CONSH' (Size = 5) -@__s15='RANDM' (Size = 5) + """ +@s1='ALFKI' (Size = 5) +@s2='ANATR' (Size = 5) +@s3='ANTON' (Size = 5) +@s4='AROUT' (Size = 5) +@s5='BERGS' (Size = 5) +@s6='BLAUS' (Size = 5) +@s7='BLONP' (Size = 5) +@s8='BOLID' (Size = 5) +@s9='BONAP' (Size = 5) +@s10='BSBEV' (Size = 5) +@s11='CACTU' (Size = 5) +@s12='CENTC' (Size = 5) +@s13='CHOPS' (Size = 5) +@s14='CONSH' (Size = 5) +@s15='RANDM' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s1")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s2")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s3")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s4")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s5")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s6")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s7")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s8")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s9")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s10")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s11")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s12")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s13")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s14")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s15")} +WHERE `c`.`CustomerID` = @s1 OR `c`.`CustomerID` = @s2 OR `c`.`CustomerID` = @s3 OR `c`.`CustomerID` = @s4 OR `c`.`CustomerID` = @s5 OR `c`.`CustomerID` = @s6 OR `c`.`CustomerID` = @s7 OR `c`.`CustomerID` = @s8 OR `c`.`CustomerID` = @s9 OR `c`.`CustomerID` = @s10 OR `c`.`CustomerID` = @s11 OR `c`.`CustomerID` = @s12 OR `c`.`CustomerID` = @s13 OR `c`.`CustomerID` = @s14 OR `c`.`CustomerID` = @s15 ORDER BY `c`.`CustomerID` """, // -$""" -@__s1='ALFKI' (Size = 5) -@__s2='ANATR' (Size = 5) -@__s3='ANTON' (Size = 5) -@__s4='AROUT' (Size = 5) -@__s5='BERGS' (Size = 5) -@__s6='BLAUS' (Size = 5) -@__s7='BLONP' (Size = 5) -@__s8='BOLID' (Size = 5) -@__s9='BONAP' (Size = 5) -@__s10='BSBEV' (Size = 5) -@__s11='CACTU' (Size = 5) -@__s12='CENTC' (Size = 5) -@__s13='CHOPS' (Size = 5) -@__s14='CONSH' (Size = 5) -@__s15='RANDM' (Size = 5) + """ +@s1='ALFKI' (Size = 5) +@s2='ANATR' (Size = 5) +@s3='ANTON' (Size = 5) +@s4='AROUT' (Size = 5) +@s5='BERGS' (Size = 5) +@s6='BLAUS' (Size = 5) +@s7='BLONP' (Size = 5) +@s8='BOLID' (Size = 5) +@s9='BONAP' (Size = 5) +@s10='BSBEV' (Size = 5) +@s11='CACTU' (Size = 5) +@s12='CENTC' (Size = 5) +@s13='CHOPS' (Size = 5) +@s14='CONSH' (Size = 5) +@s15='RANDM' (Size = 5) SELECT COUNT(*) FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s1")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s2")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s3")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s4")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s5")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s6")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s7")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s8")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s9")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s10")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s11")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s12")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s13")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s14")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s15")} +WHERE `c`.`CustomerID` = @s1 OR `c`.`CustomerID` = @s2 OR `c`.`CustomerID` = @s3 OR `c`.`CustomerID` = @s4 OR `c`.`CustomerID` = @s5 OR `c`.`CustomerID` = @s6 OR `c`.`CustomerID` = @s7 OR `c`.`CustomerID` = @s8 OR `c`.`CustomerID` = @s9 OR `c`.`CustomerID` = @s10 OR `c`.`CustomerID` = @s11 OR `c`.`CustomerID` = @s12 OR `c`.`CustomerID` = @s13 OR `c`.`CustomerID` = @s14 OR `c`.`CustomerID` = @s15 """, // -$""" -@__s1='ALFKI' (Size = 5) -@__s2='ANATR' (Size = 5) -@__s3='ANTON' (Size = 5) -@__s4='AROUT' (Size = 5) -@__s5='BERGS' (Size = 5) -@__s6='BLAUS' (Size = 5) -@__s7='BLONP' (Size = 5) -@__s8='BOLID' (Size = 5) -@__s9='BONAP' (Size = 5) -@__s10='BSBEV' (Size = 5) -@__s11='CACTU' (Size = 5) -@__s12='CENTC' (Size = 5) -@__s13='CHOPS' (Size = 5) -@__s14='CONSH' (Size = 5) -@__s15='RANDM' (Size = 5) + """ +@s1='ALFKI' (Size = 5) +@s2='ANATR' (Size = 5) +@s3='ANTON' (Size = 5) +@s4='AROUT' (Size = 5) +@s5='BERGS' (Size = 5) +@s6='BLAUS' (Size = 5) +@s7='BLONP' (Size = 5) +@s8='BOLID' (Size = 5) +@s9='BONAP' (Size = 5) +@s10='BSBEV' (Size = 5) +@s11='CACTU' (Size = 5) +@s12='CENTC' (Size = 5) +@s13='CHOPS' (Size = 5) +@s14='CONSH' (Size = 5) +@s15='RANDM' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s1")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s2")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s3")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s4")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s5")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s6")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s7")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s8")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s9")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s10")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s11")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s12")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s13")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s14")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s15")} +WHERE `c`.`CustomerID` = @s1 OR `c`.`CustomerID` = @s2 OR `c`.`CustomerID` = @s3 OR `c`.`CustomerID` = @s4 OR `c`.`CustomerID` = @s5 OR `c`.`CustomerID` = @s6 OR `c`.`CustomerID` = @s7 OR `c`.`CustomerID` = @s8 OR `c`.`CustomerID` = @s9 OR `c`.`CustomerID` = @s10 OR `c`.`CustomerID` = @s11 OR `c`.`CustomerID` = @s12 OR `c`.`CustomerID` = @s13 OR `c`.`CustomerID` = @s14 OR `c`.`CustomerID` = @s15 """, // -$""" -@__s1='ALFKI' (Size = 5) -@__s2='ANATR' (Size = 5) -@__s3='ANTON' (Size = 5) -@__s4='AROUT' (Size = 5) -@__s5='BERGS' (Size = 5) -@__s6='BLAUS' (Size = 5) -@__s7='BLONP' (Size = 5) -@__s8='BOLID' (Size = 5) -@__s9='BONAP' (Size = 5) -@__s10='BSBEV' (Size = 5) -@__s11='CACTU' (Size = 5) -@__s12='CENTC' (Size = 5) -@__s13='CHOPS' (Size = 5) -@__s14='CONSH' (Size = 5) -@__s15='RANDM' (Size = 5) + """ +@s1='ALFKI' (Size = 5) +@s2='ANATR' (Size = 5) +@s3='ANTON' (Size = 5) +@s4='AROUT' (Size = 5) +@s5='BERGS' (Size = 5) +@s6='BLAUS' (Size = 5) +@s7='BLONP' (Size = 5) +@s8='BOLID' (Size = 5) +@s9='BONAP' (Size = 5) +@s10='BSBEV' (Size = 5) +@s11='CACTU' (Size = 5) +@s12='CENTC' (Size = 5) +@s13='CHOPS' (Size = 5) +@s14='CONSH' (Size = 5) +@s15='RANDM' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s1")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s2")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s3")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s4")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s5")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s6")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s7")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s8")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s9")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s10")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s11")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s12")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s13")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s14")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s15")} +WHERE `c`.`CustomerID` = @s1 OR `c`.`CustomerID` = @s2 OR `c`.`CustomerID` = @s3 OR `c`.`CustomerID` = @s4 OR `c`.`CustomerID` = @s5 OR `c`.`CustomerID` = @s6 OR `c`.`CustomerID` = @s7 OR `c`.`CustomerID` = @s8 OR `c`.`CustomerID` = @s9 OR `c`.`CustomerID` = @s10 OR `c`.`CustomerID` = @s11 OR `c`.`CustomerID` = @s12 OR `c`.`CustomerID` = @s13 OR `c`.`CustomerID` = @s14 OR `c`.`CustomerID` = @s15 ORDER BY `c`.`CustomerID` """, // -$""" -@__s1='ALFKI' (Size = 5) -@__s2='ANATR' (Size = 5) -@__s3='ANTON' (Size = 5) -@__s4='AROUT' (Size = 5) -@__s5='BERGS' (Size = 5) -@__s6='BLAUS' (Size = 5) -@__s7='BLONP' (Size = 5) -@__s8='BOLID' (Size = 5) -@__s9='BONAP' (Size = 5) -@__s10='BSBEV' (Size = 5) -@__s11='CACTU' (Size = 5) -@__s12='CENTC' (Size = 5) -@__s13='CHOPS' (Size = 5) -@__s14='CONSH' (Size = 5) -@__s15='RANDM' (Size = 5) + """ +@s1='ALFKI' (Size = 5) +@s2='ANATR' (Size = 5) +@s3='ANTON' (Size = 5) +@s4='AROUT' (Size = 5) +@s5='BERGS' (Size = 5) +@s6='BLAUS' (Size = 5) +@s7='BLONP' (Size = 5) +@s8='BOLID' (Size = 5) +@s9='BONAP' (Size = 5) +@s10='BSBEV' (Size = 5) +@s11='CACTU' (Size = 5) +@s12='CENTC' (Size = 5) +@s13='CHOPS' (Size = 5) +@s14='CONSH' (Size = 5) +@s15='RANDM' (Size = 5) SELECT COUNT(*) FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s1")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s2")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s3")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s4")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s5")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s6")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s7")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s8")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s9")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s10")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s11")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s12")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s13")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s14")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s15")} +WHERE `c`.`CustomerID` = @s1 OR `c`.`CustomerID` = @s2 OR `c`.`CustomerID` = @s3 OR `c`.`CustomerID` = @s4 OR `c`.`CustomerID` = @s5 OR `c`.`CustomerID` = @s6 OR `c`.`CustomerID` = @s7 OR `c`.`CustomerID` = @s8 OR `c`.`CustomerID` = @s9 OR `c`.`CustomerID` = @s10 OR `c`.`CustomerID` = @s11 OR `c`.`CustomerID` = @s12 OR `c`.`CustomerID` = @s13 OR `c`.`CustomerID` = @s14 OR `c`.`CustomerID` = @s15 """, // -$""" -@__s1='ALFKI' (Size = 5) -@__s2='ANATR' (Size = 5) -@__s3='ANTON' (Size = 5) -@__s4='AROUT' (Size = 5) -@__s5='BERGS' (Size = 5) -@__s6='BLAUS' (Size = 5) -@__s7='BLONP' (Size = 5) -@__s8='BOLID' (Size = 5) -@__s9='BONAP' (Size = 5) -@__s10='BSBEV' (Size = 5) -@__s11='CACTU' (Size = 5) -@__s12='CENTC' (Size = 5) -@__s13='CHOPS' (Size = 5) -@__s14='CONSH' (Size = 5) + """ +@s1='ALFKI' (Size = 5) +@s2='ANATR' (Size = 5) +@s3='ANTON' (Size = 5) +@s4='AROUT' (Size = 5) +@s5='BERGS' (Size = 5) +@s6='BLAUS' (Size = 5) +@s7='BLONP' (Size = 5) +@s8='BOLID' (Size = 5) +@s9='BONAP' (Size = 5) +@s10='BSBEV' (Size = 5) +@s11='CACTU' (Size = 5) +@s12='CENTC' (Size = 5) +@s13='CHOPS' (Size = 5) +@s14='CONSH' (Size = 5) SELECT COUNT(*) FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s1")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s2")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s3")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s4")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s5")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s6")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s7")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s8")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s9")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s10")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s11")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s12")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s13")} OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__s14")} +WHERE `c`.`CustomerID` = @s1 OR `c`.`CustomerID` = @s2 OR `c`.`CustomerID` = @s3 OR `c`.`CustomerID` = @s4 OR `c`.`CustomerID` = @s5 OR `c`.`CustomerID` = @s6 OR `c`.`CustomerID` = @s7 OR `c`.`CustomerID` = @s8 OR `c`.`CustomerID` = @s9 OR `c`.`CustomerID` = @s10 OR `c`.`CustomerID` = @s11 OR `c`.`CustomerID` = @s12 OR `c`.`CustomerID` = @s13 OR `c`.`CustomerID` = @s14 """); } @@ -484,20 +484,20 @@ public override async Task First_query_with_cancellation_async() await base.First_query_with_cancellation_async(); AssertSql( -$""" -@__customerID='ALFKI' (Size = 5) + """ +@customerID='ALFKI' (Size = 5) SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} +WHERE `c`.`CustomerID` = @customerID """, // -$""" -@__customerID='ANATR' (Size = 5) + """ +@customerID='ANATR' (Size = 5) SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} +WHERE `c`.`CustomerID` = @customerID """); } @@ -518,20 +518,20 @@ public override async Task First_query_with_single_parameter_async() await base.First_query_with_single_parameter_async(); AssertSql( -$""" -@__customerID='ALFKI' (Size = 5) + """ +@customerID='ALFKI' (Size = 5) SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} +WHERE `c`.`CustomerID` = @customerID """, // -$""" -@__customerID='ANATR' (Size = 5) + """ +@customerID='ANATR' (Size = 5) SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} +WHERE `c`.`CustomerID` = @customerID """); } @@ -566,20 +566,20 @@ public override async Task Query_with_three_parameters_async() await base.Query_with_three_parameters_async(); AssertSql( -$""" -@__customerID='ALFKI' (Size = 5) + """ +@customerID='ALFKI' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} +WHERE `c`.`CustomerID` = @customerID """, // -$""" -@__customerID='ANATR' (Size = 5) + """ +@customerID='ANATR' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} +WHERE `c`.`CustomerID` = @customerID """); } @@ -588,20 +588,20 @@ public override async Task Query_with_two_parameters_async() await base.Query_with_two_parameters_async(); AssertSql( -$""" -@__customerID='ALFKI' (Size = 5) + """ +@customerID='ALFKI' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} +WHERE `c`.`CustomerID` = @customerID """, // -$""" -@__customerID='ANATR' (Size = 5) + """ +@customerID='ANATR' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} +WHERE `c`.`CustomerID` = @customerID """); } @@ -624,20 +624,20 @@ public override async Task Query_with_single_parameter_async() await base.Query_with_single_parameter_async(); AssertSql( - $""" -@__customerID='ALFKI' (Size = 5) + """ +@customerID='ALFKI' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} +WHERE `c`.`CustomerID` = @customerID """, // -$""" -@__customerID='ANATR' (Size = 5) + """ +@customerID='ANATR' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} +WHERE `c`.`CustomerID` = @customerID """); } @@ -736,23 +736,23 @@ public override void Query_with_single_parameter_with_include() base.Query_with_single_parameter_with_include(); AssertSql( -$""" -@__customerID='ALFKI' (Size = 5) + """ +@customerID='ALFKI' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} +WHERE `c`.`CustomerID` = @customerID ORDER BY `c`.`CustomerID` """, // -$""" -@__customerID='ANATR' (Size = 5) + """ +@customerID='ANATR' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Customers` AS `c` LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} +WHERE `c`.`CustomerID` = @customerID ORDER BY `c`.`CustomerID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs index c280173c..a906c306 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs @@ -275,7 +275,7 @@ public override async Task Include_duplicate_reference3(bool async) FROM ( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o1`, @@ -284,7 +284,7 @@ ORDER BY `o`.`OrderID` FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`OrderID` ) AS `o3` @@ -306,7 +306,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as """ SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactTitle` ) AS `c0` @@ -344,7 +344,7 @@ public override async Task Include_collection_take_no_order_by(bool async) """ SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` @@ -503,6 +503,21 @@ public override async Task Include_collection_with_left_join_clause_with_filter( """); } + public override async Task Include_collection_with_right_join_clause_with_filter(bool async) + { + await base.Include_collection_with_right_join_clause_with_filter(async); + + AssertSql( + """ +SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] +FROM [Customers] AS [c] +RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] +LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] +WHERE [c].[CustomerID] LIKE N'F%' +ORDER BY [c].[CustomerID], [o].[OrderID] +"""); + } + public override async Task Include_duplicate_collection(bool async) { await base.Include_duplicate_collection(async); @@ -697,7 +712,7 @@ public override async Task Include_duplicate_reference(bool async) FROM (( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`CustomerID`, `o`.`OrderID` ) AS `o1`, @@ -706,7 +721,7 @@ public override async Task Include_duplicate_reference(bool async) FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`CustomerID`, `o0`.`OrderID` ) AS `o3` @@ -872,7 +887,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as """ SELECT `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` FROM ( - SELECT TOP 5 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, @@ -1414,7 +1429,7 @@ public override async Task Multi_level_includes_are_applied_with_skip(bool async FROM ( SELECT TOP 1 `c0`.`CustomerID` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p + 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'A%' ORDER BY `c`.`CustomerID` @@ -1664,7 +1679,7 @@ public override async Task Include_collection_orderby_take(bool async) """ SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 5 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` @@ -1739,7 +1754,7 @@ public override async Task Include_duplicate_reference2(bool async) FROM ( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o1`, @@ -1748,7 +1763,7 @@ ORDER BY `o`.`OrderID` FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`OrderID` ) AS `o3` @@ -2093,9 +2108,9 @@ public override async Task Include_where_skip_take_projection(bool async) """ SELECT `o0`.`CustomerID` FROM ( - SELECT TOP 2 `o2`.`OrderID`, `o2`.`ProductID` + SELECT TOP @p0 `o2`.`OrderID`, `o2`.`ProductID` FROM ( - SELECT TOP 3 `o`.`OrderID`, `o`.`ProductID` + SELECT TOP @p + @p0 `o`.`OrderID`, `o`.`ProductID` FROM `Order Details` AS `o` WHERE `o`.`Quantity` = 10 ORDER BY `o`.`OrderID`, `o`.`ProductID` @@ -2115,7 +2130,7 @@ public override async Task Include_with_take(bool async) """ SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactName` DESC ) AS `c0` diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs index 88a9e307..89a8808f 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs @@ -32,2653 +32,91 @@ public NorthwindFunctionsQueryJetTest( public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); - public override async Task TimeSpan_Compare_to_simple_zero(bool async, bool compareTo) + public override async Task Client_evaluation_of_uncorrelated_method_call(bool async) { - await base.TimeSpan_Compare_to_simple_zero(async, compareTo); - - AssertSql( -$""" -@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderDate` = CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) -""", -// -$""" -@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderDate` <> CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) OR `o`.`OrderDate` IS NULL -""", -// -$""" -@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderDate` > CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) -""", -// -$""" -@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderDate` <= CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) -""", -// -$""" -@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderDate` > CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) -""", -// -$""" -@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderDate` <= CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) -"""); - } - - public override async Task String_StartsWith_Literal(bool isAsync) - { - await base.String_StartsWith_Literal(isAsync); - - AssertSql( -""" -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactName` LIKE 'M%' -"""); - } - - public override async Task String_StartsWith_Parameter(bool async) - { - await base.String_StartsWith_Parameter(async); - - AssertSql( - $""" -@__pattern_0_startswith='M%' (Size = 30) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactName` LIKE {AssertSqlHelper.Parameter("@__pattern_0_startswith")} -"""); - } - - public override async Task String_StartsWith_Identity(bool isAsync) - { - await base.String_StartsWith_Identity(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactName` IS NOT NULL AND LEFT(`c`.`ContactName`, IIF(LEN(`c`.`ContactName`) IS NULL, 0, LEN(`c`.`ContactName`))) = `c`.`ContactName` -"""); - } - - public override async Task String_StartsWith_Column(bool isAsync) - { - await base.String_StartsWith_Column(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactName` IS NOT NULL AND LEFT(`c`.`ContactName`, IIF(LEN(`c`.`ContactName`) IS NULL, 0, LEN(`c`.`ContactName`))) = `c`.`ContactName` -"""); - } - - public override async Task String_StartsWith_MethodCall(bool isAsync) - { - await base.String_StartsWith_MethodCall(isAsync); - - AssertSql( -""" -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactName` LIKE 'M%' -"""); - } - - public override async Task String_StartsWith_with_StringComparison_Ordinal(bool async) - { - await base.String_StartsWith_with_StringComparison_Ordinal(async); - - AssertSql(); - } - - public override async Task String_StartsWith_with_StringComparison_OrdinalIgnoreCase(bool async) - { - await base.String_StartsWith_with_StringComparison_OrdinalIgnoreCase(async); - - AssertSql(); - } - - public override async Task String_StartsWith_with_StringComparison_unsupported(bool async) - { - await base.String_StartsWith_with_StringComparison_unsupported(async); - - AssertSql(); - } - - public override async Task String_EndsWith_Literal(bool isAsync) - { - await base.String_EndsWith_Literal(isAsync); - - AssertSql( -""" -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactName` LIKE '%b' -"""); - } - - public override async Task String_EndsWith_Parameter(bool async) - { - await base.String_EndsWith_Parameter(async); - - AssertSql( - $""" -@__pattern_0_endswith='%b' (Size = 30) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactName` LIKE {AssertSqlHelper.Parameter("@__pattern_0_endswith")} -"""); - } - - public override async Task String_EndsWith_Identity(bool isAsync) - { - await base.String_EndsWith_Identity(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactName` IS NOT NULL AND RIGHT(`c`.`ContactName`, IIF(LEN(`c`.`ContactName`) IS NULL, 0, LEN(`c`.`ContactName`))) = `c`.`ContactName` -"""); - } - - public override async Task String_EndsWith_Column(bool isAsync) - { - await base.String_EndsWith_Column(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactName` IS NOT NULL AND RIGHT(`c`.`ContactName`, IIF(LEN(`c`.`ContactName`) IS NULL, 0, LEN(`c`.`ContactName`))) = `c`.`ContactName` -"""); - } - - public override async Task String_EndsWith_MethodCall(bool isAsync) - { - await base.String_EndsWith_MethodCall(isAsync); - - AssertSql( -""" -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactName` LIKE '%m' -"""); - } - - public override async Task String_EndsWith_with_StringComparison_Ordinal(bool async) - { - await base.String_EndsWith_with_StringComparison_Ordinal(async); - - AssertSql(); - } - - public override async Task String_EndsWith_with_StringComparison_OrdinalIgnoreCase(bool async) - { - await base.String_EndsWith_with_StringComparison_OrdinalIgnoreCase(async); - - AssertSql(); - } - - public override async Task String_EndsWith_with_StringComparison_unsupported(bool async) - { - await base.String_EndsWith_with_StringComparison_unsupported(async); - - AssertSql(); - } - - public override async Task String_Contains_Literal(bool isAsync) - { - await AssertQuery( - isAsync, - ss => ss.Set().Where(c => c.ContactName.Contains("M")), // case-insensitive - ss => ss.Set().Where(c => c.ContactName.Contains('M') || c.ContactName.Contains('m'))); // case-sensitive - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactName` LIKE '%M%' -"""); - } - - public override async Task String_Contains_Identity(bool isAsync) - { - await base.String_Contains_Identity(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactName` IS NOT NULL AND (INSTR(1, `c`.`ContactName`, `c`.`ContactName`, 1) > 0 OR (`c`.`ContactName` LIKE '')) -"""); - } - - public override async Task String_Contains_Column(bool isAsync) - { - await base.String_Contains_Column(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactName` IS NOT NULL AND (INSTR(1, `c`.`CompanyName`, `c`.`ContactName`, 1) > 0 OR (`c`.`ContactName` LIKE '')) -"""); - } - - public override async Task String_Contains_constant_with_whitespace(bool async) - { - await base.String_Contains_constant_with_whitespace(async); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactName` LIKE '% %' -"""); - } - - public override async Task String_Contains_parameter_with_whitespace(bool async) - { - await base.String_Contains_parameter_with_whitespace(async); - - AssertSql( - $""" -@__pattern_0_contains='% %' (Size = 30) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactName` LIKE {AssertSqlHelper.Parameter("@__pattern_0_contains")} -"""); - } - - public override async Task String_FirstOrDefault_MethodCall(bool async) - { - await base.String_FirstOrDefault_MethodCall(async); - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE MID(`c`.`ContactName`, 1, 1) = 'A' -"""); - } - - public override async Task String_LastOrDefault_MethodCall(bool async) - { - await base.String_LastOrDefault_MethodCall(async); - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE MID(`c`.`ContactName`, IIF(IIF(LEN(`c`.`ContactName`) = 0, 1, LEN(`c`.`ContactName`)) IS NULL, 0, IIF(LEN(`c`.`ContactName`) = 0, 1, LEN(`c`.`ContactName`))), 1) = 's' -"""); - } - - public override async Task String_Contains_MethodCall(bool isAsync) - { - await AssertQuery( - isAsync, - ss => ss.Set().Where(c => c.ContactName.Contains(LocalMethod1())), // case-insensitive - ss => ss.Set().Where( - c => c.ContactName.Contains(LocalMethod1().ToLower()) - || c.ContactName.Contains(LocalMethod1().ToUpper()))); // case-sensitive - - AssertSql( - $""" - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE `c`.`ContactName` LIKE '%M%' - """); - } - - public override async Task String_Join_over_non_nullable_column(bool async) - { - await base.String_Join_over_non_nullable_column(async); - - AssertSql( - """ -SELECT `c1`.`City`, `c0`.`CustomerID` -FROM ( - SELECT `c`.`City` - FROM `Customers` AS `c` - GROUP BY `c`.`City` -) AS `c1` -LEFT JOIN `Customers` AS `c0` ON `c1`.`City` = `c0`.`City` -ORDER BY `c1`.`City` -"""); - } - - public override async Task String_Join_over_nullable_column(bool async) - { - await base.String_Join_over_nullable_column(async); - - AssertSql( - """ -SELECT `c1`.`City`, `c0`.`Region`, `c0`.`CustomerID` -FROM ( - SELECT `c`.`City` - FROM `Customers` AS `c` - GROUP BY `c`.`City` -) AS `c1` -LEFT JOIN `Customers` AS `c0` ON `c1`.`City` = `c0`.`City` -ORDER BY `c1`.`City` -"""); - } - - public override async Task String_Join_with_predicate(bool async) - { - await base.String_Join_with_predicate(async); - - AssertSql( - """ -SELECT `c1`.`City`, `c2`.`CustomerID` -FROM ( - SELECT `c`.`City` - FROM `Customers` AS `c` - GROUP BY `c`.`City` -) AS `c1` -LEFT JOIN ( - SELECT `c0`.`CustomerID`, `c0`.`City` - FROM `Customers` AS `c0` - WHERE IIF(LEN(`c0`.`ContactName`) IS NULL, NULL, CLNG(LEN(`c0`.`ContactName`))) > 10 -) AS `c2` ON `c1`.`City` = `c2`.`City` -ORDER BY `c1`.`City` -"""); - } - - public override async Task String_Join_with_ordering(bool async) - { - await base.String_Join_with_ordering(async); - - AssertSql( - """ -SELECT `c1`.`City`, `c0`.`CustomerID` -FROM ( - SELECT `c`.`City` - FROM `Customers` AS `c` - GROUP BY `c`.`City` -) AS `c1` -LEFT JOIN `Customers` AS `c0` ON `c1`.`City` = `c0`.`City` -ORDER BY `c1`.`City`, `c0`.`CustomerID` DESC -"""); - } - - public override async Task String_Join_non_aggregate(bool async) - { - await base.String_Join_non_aggregate(async); - - AssertSql( - """ -@__foo_0='foo' (Size = 4000) - -SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] -FROM [Customers] AS [c] -WHERE CONCAT_WS(N'|', [c].[CompanyName], COALESCE(@__foo_0, N''), N'', N'bar') = N'Around the Horn|foo||bar' -"""); - } - - public override async Task String_Concat(bool async) - { - await base.String_Concat(async); - - AssertSql( - """ -SELECT `c1`.`City`, `c0`.`CustomerID` -FROM ( - SELECT `c`.`City` - FROM `Customers` AS `c` - GROUP BY `c`.`City` -) AS `c1` -LEFT JOIN `Customers` AS `c0` ON `c1`.`City` = `c0`.`City` -ORDER BY `c1`.`City` -"""); - } - - public override async Task String_Compare_simple_zero(bool isAsync) - { - await base.String_Compare_simple_zero(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <> 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` > 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` > 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= 'AROUT' -"""); - } - - public override async Task String_Compare_simple_one(bool isAsync) - { - await base.String_Compare_simple_one(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` > 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` < 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` >= 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` >= 'AROUT' -"""); - } - - public override async Task String_compare_with_parameter(bool isAsync) - { - await base.String_compare_with_parameter(isAsync); - - AssertSql( -$""" -@__customer_CustomerID_0='AROUT' (Size = 5) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` > {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} -""", - // - $""" -@__customer_CustomerID_0='AROUT' (Size = 5) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` < {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} -""", - // - $""" -@__customer_CustomerID_0='AROUT' (Size = 5) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} -""", - // - $""" -@__customer_CustomerID_0='AROUT' (Size = 5) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} -""", - // - $""" -@__customer_CustomerID_0='AROUT' (Size = 5) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` >= {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} -""", - // - $""" -@__customer_CustomerID_0='AROUT' (Size = 5) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` >= {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} -"""); - } - - public override async Task String_Compare_simple_more_than_one(bool isAsync) - { - await base.String_Compare_simple_more_than_one(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE IIF(`c`.`CustomerID` = 'ALFKI', 0, IIF(`c`.`CustomerID` > 'ALFKI', 1, IIF(`c`.`CustomerID` < 'ALFKI', -1, NULL))) = 42 -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE IIF(`c`.`CustomerID` = 'ALFKI', 0, IIF(`c`.`CustomerID` > 'ALFKI', 1, IIF(`c`.`CustomerID` < 'ALFKI', -1, NULL))) > 42 -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE 42 > IIF(`c`.`CustomerID` = 'ALFKI', 0, IIF(`c`.`CustomerID` > 'ALFKI', 1, IIF(`c`.`CustomerID` < 'ALFKI', -1, NULL))) -"""); - } - - public override async Task String_Compare_nested(bool isAsync) - { - await base.String_Compare_nested(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = ('M' & `c`.`CustomerID`) -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <> UCASE(`c`.`CustomerID`) -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` > REPLACE('ALFKI', 'ALF', `c`.`CustomerID`) -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= ('M' & `c`.`CustomerID`) -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` > UCASE(`c`.`CustomerID`) -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` < REPLACE('ALFKI', 'ALF', `c`.`CustomerID`) -"""); - } - - public override async Task String_Compare_multi_predicate(bool isAsync) - { - await base.String_Compare_multi_predicate(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` >= 'ALFKI' AND `c`.`CustomerID` < 'CACTU' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactTitle` = 'Owner' AND (`c`.`Country` <> 'USA' OR `c`.`Country` IS NULL) -"""); - } - - public override async Task String_Compare_to_simple_zero(bool isAsync) - { - await base.String_Compare_to_simple_zero(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <> 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` > 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` > 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= 'AROUT' -"""); - } - - public override async Task String_Compare_to_simple_one(bool isAsync) - { - await base.String_Compare_to_simple_one(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` > 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` < 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` >= 'AROUT' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` >= 'AROUT' -"""); - } - - public override async Task String_compare_to_with_parameter(bool isAsync) - { - await base.String_compare_to_with_parameter(isAsync); - - AssertSql( -$""" -@__customer_CustomerID_0='AROUT' (Size = 5) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` > {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} -""", - // - $""" -@__customer_CustomerID_0='AROUT' (Size = 5) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` < {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} -""", - // - $""" -@__customer_CustomerID_0='AROUT' (Size = 5) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} -""", - // - $""" -@__customer_CustomerID_0='AROUT' (Size = 5) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} -""", - // - $""" -@__customer_CustomerID_0='AROUT' (Size = 5) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` >= {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} -""", - // - $""" -@__customer_CustomerID_0='AROUT' (Size = 5) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` >= {AssertSqlHelper.Parameter("@__customer_CustomerID_0")} -"""); - } - - public override async Task String_Compare_to_simple_more_than_one(bool isAsync) - { - await base.String_Compare_to_simple_more_than_one(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE IIF(`c`.`CustomerID` = 'ALFKI', 0, IIF(`c`.`CustomerID` > 'ALFKI', 1, IIF(`c`.`CustomerID` < 'ALFKI', -1, NULL))) = 42 -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE IIF(`c`.`CustomerID` = 'ALFKI', 0, IIF(`c`.`CustomerID` > 'ALFKI', 1, IIF(`c`.`CustomerID` < 'ALFKI', -1, NULL))) > 42 -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE 42 > IIF(`c`.`CustomerID` = 'ALFKI', 0, IIF(`c`.`CustomerID` > 'ALFKI', 1, IIF(`c`.`CustomerID` < 'ALFKI', -1, NULL))) -"""); - } - - public override async Task String_Compare_to_nested(bool isAsync) - { - await base.String_Compare_to_nested(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <> ('M' & `c`.`CustomerID`) -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = UCASE(`c`.`CustomerID`) -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` > REPLACE('AROUT', 'OUT', `c`.`CustomerID`) -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` <= ('M' & `c`.`CustomerID`) -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` > UCASE(`c`.`CustomerID`) -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` < REPLACE('AROUT', 'OUT', `c`.`CustomerID`) -"""); - } - - public override async Task String_Compare_to_multi_predicate(bool isAsync) - { - await base.String_Compare_to_multi_predicate(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` >= 'ALFKI' AND `c`.`CustomerID` < 'CACTU' -""", - // - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactTitle` = 'Owner' AND (`c`.`Country` <> 'USA' OR `c`.`Country` IS NULL) -"""); - } - - public override async Task DateTime_Compare_to_simple_zero(bool isAsync, bool compareTo) - { - await base.DateTime_Compare_to_simple_zero(isAsync, compareTo); - - AssertSql( - $""" -@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderDate` = CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) -""", - // - $""" -@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderDate` <> CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) OR `o`.`OrderDate` IS NULL -""", - // - $""" -@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderDate` > CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) -""", - // - $""" -@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderDate` <= CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) -""", - // - $""" -@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderDate` > CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) -""", - // - $""" -@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderDate` <= CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) -"""); - } - - public override async Task Int_Compare_to_simple_zero(bool isAsync) - { - await base.Int_Compare_to_simple_zero(isAsync); - - AssertSql( - $""" -@__orderId_0='10250' - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderID` = {AssertSqlHelper.Parameter("@__orderId_0")} -""", - // - $""" -@__orderId_0='10250' - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderID` <> {AssertSqlHelper.Parameter("@__orderId_0")} -""", - // - $""" -@__orderId_0='10250' - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderID` > {AssertSqlHelper.Parameter("@__orderId_0")} -""", - // - $""" -@__orderId_0='10250' - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderID` <= {AssertSqlHelper.Parameter("@__orderId_0")} -""", - // - $""" -@__orderId_0='10250' - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderID` > {AssertSqlHelper.Parameter("@__orderId_0")} -""", - // - $""" -@__orderId_0='10250' - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderID` <= {AssertSqlHelper.Parameter("@__orderId_0")} -"""); - } - - public override async Task Where_math_abs1(bool isAsync) - { - await base.Where_math_abs1(isAsync); - - AssertSql( - $""" - SELECT `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` - FROM `Products` AS `p` - WHERE ABS(`p`.`ProductID`) > 10 - """); - } - - public override async Task Where_math_abs2(bool isAsync) - { - await base.Where_math_abs2(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`UnitPrice` < 7.0 AND ABS(`o`.`Quantity`) > 10 - """); - } - - public override async Task Where_math_abs3(bool isAsync) - { - await base.Where_math_abs3(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`Quantity` < 5 AND ABS(`o`.`UnitPrice`) > 10.0 - """); - } - - public override async Task Where_math_abs_uncorrelated(bool isAsync) - { - await base.Where_math_abs_uncorrelated(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`UnitPrice` < 7.0 AND 10 < `o`.`ProductID` - """); - } - - public override async Task Where_math_ceiling1(bool isAsync) - { - await base.Where_math_ceiling1(isAsync); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`UnitPrice` < 7.0 AND IIF(FIX(CDBL(`o`.`Discount`)) = CDBL(`o`.`Discount`), FIX(CDBL(`o`.`Discount`)), FIX(CDBL(`o`.`Discount`)) + 1.0) > 0.0 -"""); - } - - public override async Task Where_math_ceiling2(bool isAsync) - { - await base.Where_math_ceiling2(isAsync); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`Quantity` < 5 AND IIF(FIX(`o`.`UnitPrice`) = `o`.`UnitPrice`, FIX(`o`.`UnitPrice`), FIX(`o`.`UnitPrice`) + 1.0) > 10.0 -"""); - } - - public override async Task Where_math_floor(bool isAsync) - { - await base.Where_math_floor(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`Quantity` < 5 AND FIX(`o`.`UnitPrice`) > 10.0 - """); - } - - public override async Task Where_math_power(bool isAsync) - { - await base.Where_math_power(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE CDBL(`o`.`Discount`)^3.0 > 0.00499999988824129 - """); - } - - public override async Task Where_math_square(bool async) - { - await base.Where_math_square(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE CDBL(`o`.`Discount`)^2.0 > 0.0500000007450581 -"""); - } - - public override async Task Where_math_round(bool isAsync) - { - await base.Where_math_round(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`Quantity` < 5 AND ROUND(`o`.`UnitPrice`, 0) > 10.0 - """); - } - - public override async Task Sum_over_round_works_correctly_in_projection(bool async) - { - await base.Sum_over_round_works_correctly_in_projection(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, ( - SELECT IIF(SUM(ROUND(`o0`.`UnitPrice`, 2)) IS NULL, 0.0, SUM(ROUND(`o0`.`UnitPrice`, 2))) - FROM `Order Details` AS `o0` - WHERE `o`.`OrderID` = `o0`.`OrderID`) AS `Sum` -FROM `Orders` AS `o` -WHERE `o`.`OrderID` < 10300 -"""); - } - - public override async Task Sum_over_round_works_correctly_in_projection_2(bool async) - { - await base.Sum_over_round_works_correctly_in_projection_2(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, ( - SELECT IIF(SUM(ROUND(`o0`.`UnitPrice` * `o0`.`UnitPrice`, 2)) IS NULL, 0.0, SUM(ROUND(`o0`.`UnitPrice` * `o0`.`UnitPrice`, 2))) - FROM `Order Details` AS `o0` - WHERE `o`.`OrderID` = `o0`.`OrderID`) AS `Sum` -FROM `Orders` AS `o` -WHERE `o`.`OrderID` < 10300 -"""); - } - - public override async Task Sum_over_truncate_works_correctly_in_projection(bool async) - { - await base.Sum_over_truncate_works_correctly_in_projection(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, ( - SELECT IIF(SUM(INT(`o0`.`UnitPrice`)) IS NULL, 0.0, SUM(INT(`o0`.`UnitPrice`))) - FROM `Order Details` AS `o0` - WHERE `o`.`OrderID` = `o0`.`OrderID`) AS `Sum` -FROM `Orders` AS `o` -WHERE `o`.`OrderID` < 10300 -"""); - } - - public override async Task Sum_over_truncate_works_correctly_in_projection_2(bool async) - { - await base.Sum_over_truncate_works_correctly_in_projection_2(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, ( - SELECT IIF(SUM(INT(`o0`.`UnitPrice` * `o0`.`UnitPrice`)) IS NULL, 0.0, SUM(INT(`o0`.`UnitPrice` * `o0`.`UnitPrice`))) - FROM `Order Details` AS `o0` - WHERE `o`.`OrderID` = `o0`.`OrderID`) AS `Sum` -FROM `Orders` AS `o` -WHERE `o`.`OrderID` < 10300 -"""); - } - - public override async Task Select_math_round_int(bool isAsync) - { - await base.Select_math_round_int(isAsync); - - AssertSql( - $""" - SELECT ROUND(CDBL(`o`.`OrderID`), 0) AS `A` - FROM `Orders` AS `o` - WHERE `o`.`OrderID` < 10250 - """); - } - - public override async Task Select_math_truncate_int(bool isAsync) - { - await base.Select_math_truncate_int(isAsync); - - AssertSql( - $""" - SELECT INT(CDBL(`o`.`OrderID`)) AS `A` - FROM `Orders` AS `o` - WHERE `o`.`OrderID` < 10250 - """); - } - - public override async Task Where_math_round2(bool isAsync) - { - await base.Where_math_round2(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE ROUND(`o`.`UnitPrice`, 2) > 100.0 - """); - } - - public override async Task Where_math_truncate(bool isAsync) - { - await base.Where_math_truncate(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`Quantity` < 5 AND INT(`o`.`UnitPrice`) > 10.0 - """); - } - - public override async Task Where_math_exp(bool isAsync) - { - await base.Where_math_exp(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`OrderID` = 11077 AND EXP(CDBL(`o`.`Discount`)) > 1.0 - """); - } - - public override async Task Where_math_log10(bool isAsync) - { - await base.Where_math_log10(isAsync); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND `o`.`Discount` > 0 AND (LOG(CDBL(`o`.`Discount`)) / 2.30258509299405) < 0.0 -"""); - } - - public override async Task Where_math_log(bool isAsync) - { - await base.Where_math_log(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`OrderID` = 11077 AND `o`.`Discount` > 0 AND LOG(CDBL(`o`.`Discount`)) < 0.0 - """); - } - - public override async Task Where_math_log_new_base(bool isAsync) - { - await base.Where_math_log_new_base(isAsync); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND `o`.`Discount` > 0 AND (LOG(CDBL(`o`.`Discount`)) / LOG(7.0)) < -1.0 -"""); - } - - public override async Task Where_math_sqrt(bool isAsync) - { - await base.Where_math_sqrt(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`OrderID` = 11077 AND SQR(CDBL(`o`.`Discount`)) > 0.0 - """); - } - - public override async Task Where_math_acos(bool isAsync) - { - await base.Where_math_acos(isAsync); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND (1.5707963267949 + ATN(-CDBL(`o`.`Discount`) / SQR(-(CDBL(`o`.`Discount`) * CDBL(`o`.`Discount`)) + 1.0))) > 1.0 -"""); - } - - public override async Task Where_math_asin(bool isAsync) - { - await base.Where_math_asin(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`OrderID` = 11077 AND ATN(CDBL(`o`.`Discount`) / SQR(-(CDBL(`o`.`Discount`) * CDBL(`o`.`Discount`)) + 1.0)) > 0.0 - """); - } - - public override async Task Where_math_atan(bool isAsync) - { - await base.Where_math_atan(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`OrderID` = 11077 AND ATN(CDBL(`o`.`Discount`)) > 0.0 - """); - } - - public override async Task Where_math_atan2(bool isAsync) - { - await base.Where_math_atan2(isAsync); - - AssertSql( - """ - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`OrderID` = 11077 AND ATN(CDBL(`o`.`Discount`) / 1.0) > 0.0 - """); - } - - public override async Task Where_math_cos(bool isAsync) - { - await base.Where_math_cos(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`OrderID` = 11077 AND COS(CDBL(`o`.`Discount`)) > 0.0 - """); - } - - public override async Task Where_math_sin(bool isAsync) - { - await base.Where_math_sin(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`OrderID` = 11077 AND SIN(CDBL(`o`.`Discount`)) > 0.0 - """); - } - - public override async Task Where_math_tan(bool isAsync) - { - await base.Where_math_tan(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`OrderID` = 11077 AND TAN(CDBL(`o`.`Discount`)) > 0.0 - """); - } - - public override async Task Where_math_sign(bool isAsync) - { - await base.Where_math_sign(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`OrderID` = 11077 AND SGN(`o`.`Discount`) > 0 - """); - } - - public override async Task Where_math_min(bool async) - { - // Translate Math.Min. - await base.Where_math_min(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND IIF(`o`.`OrderID` < `o`.`ProductID`, `o`.`OrderID`, `o`.`ProductID`) = `o`.`ProductID` -"""); - } - - public override async Task Where_math_min_nested(bool async) - { - await base.Where_math_min_nested(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND IIF(IIF(`o`.`OrderID` < `o`.`ProductID`, `o`.`OrderID`, `o`.`ProductID`) < 99999, IIF(`o`.`OrderID` < `o`.`ProductID`, `o`.`OrderID`, `o`.`ProductID`), 99999) = `o`.`ProductID` -"""); - } - - public override async Task Where_math_min_nested_twice(bool async) - { - await base.Where_math_min_nested_twice(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND IIF(IIF(IIF(99999 < `o`.`OrderID`, 99999, `o`.`OrderID`) < 99998, IIF(99999 < `o`.`OrderID`, 99999, `o`.`OrderID`), 99998) < `o`.`ProductID`, IIF(IIF(99999 < `o`.`OrderID`, 99999, `o`.`OrderID`) < 99998, IIF(99999 < `o`.`OrderID`, 99999, `o`.`OrderID`), 99998), `o`.`ProductID`) = `o`.`ProductID` -"""); - } - - public override async Task Where_math_max(bool async) - { - // Translate Math.Max. - await base.Where_math_max(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND IIF(`o`.`OrderID` > `o`.`ProductID`, `o`.`OrderID`, `o`.`ProductID`) = `o`.`OrderID` -"""); - } - - public override async Task Where_math_max_nested(bool async) - { - await base.Where_math_max_nested(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND IIF(IIF(`o`.`OrderID` > `o`.`ProductID`, `o`.`OrderID`, `o`.`ProductID`) > 1, IIF(`o`.`OrderID` > `o`.`ProductID`, `o`.`OrderID`, `o`.`ProductID`), 1) = `o`.`OrderID` -"""); - } - - public override async Task Where_math_max_nested_twice(bool async) - { - await base.Where_math_max_nested_twice(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND IIF(IIF(IIF(1 > `o`.`OrderID`, 1, `o`.`OrderID`) > 2, IIF(1 > `o`.`OrderID`, 1, `o`.`OrderID`), 2) > `o`.`ProductID`, IIF(IIF(1 > `o`.`OrderID`, 1, `o`.`OrderID`) > 2, IIF(1 > `o`.`OrderID`, 1, `o`.`OrderID`), 2), `o`.`ProductID`) = `o`.`OrderID` -"""); - } - - public override async Task Where_math_degrees(bool async) - { - await base.Where_math_degrees(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND (CDBL(`o`.`Discount`) * (180.0 / 3.14159265358979)) > 0.0 -"""); - } - - public override async Task Where_math_radians(bool async) - { - await base.Where_math_radians(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND (CDBL(`o`.`Discount`) * (3.14159265358979 / 180.0)) > 0.0 -"""); - } - - public override async Task Where_mathf_abs1(bool async) - { - await base.Where_mathf_abs1(async); - - AssertSql( - """ -SELECT `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` -FROM `Products` AS `p` -WHERE ABS(CSNG(`p`.`ProductID`)) > 10 -"""); - } - - public override async Task Where_mathf_ceiling1(bool async) - { - await base.Where_mathf_ceiling1(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`UnitPrice` < 7.0 AND IIF(FIX(`o`.`Discount`) = `o`.`Discount`, FIX(`o`.`Discount`), FIX(`o`.`Discount`) + 1) > 0 -"""); - } - - public override async Task Where_mathf_floor(bool async) - { - await base.Where_mathf_floor(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`Quantity` < 5 AND FIX(CSNG(`o`.`UnitPrice`)) > 10 -"""); - } - - public override async Task Where_mathf_power(bool async) - { - await base.Where_mathf_power(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`Discount`^3 > 0.005 -"""); - } - - public override async Task Where_mathf_square(bool async) - { - await base.Where_mathf_square(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`Discount`^2 > 0.05 -"""); - } - - public override async Task Where_mathf_round2(bool async) - { - await base.Where_mathf_round2(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE CSNG(ROUND(CSNG(`o`.`UnitPrice`), 2)) > 100 -"""); - } - - public override async Task Select_mathf_round(bool async) - { - await base.Select_mathf_round(async); - - AssertSql( - """ -SELECT CSNG(ROUND(CSNG(`o`.`OrderID`), 0)) -FROM `Orders` AS `o` -WHERE `o`.`OrderID` < 10250 -"""); - } - - public override async Task Select_mathf_round2(bool async) - { - await base.Select_mathf_round2(async); - - AssertSql( - """ -SELECT CSNG(ROUND(CSNG(`o`.`UnitPrice`), 2)) -FROM `Order Details` AS `o` -WHERE `o`.`Quantity` < 5 -"""); - } - - public override async Task Where_mathf_truncate(bool async) - { - await base.Where_mathf_truncate(async); - - AssertSql( - """ - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`Quantity` < 5 AND IIF(INT(CSNG(`o`.`UnitPrice`)) IS NULL, NULL, CSNG(INT(CSNG(`o`.`UnitPrice`)))) > 10 - """); - } - - public override async Task Select_mathf_truncate(bool async) - { - await base.Select_mathf_truncate(async); - - AssertSql( - """ - SELECT IIF(INT(CSNG(`o`.`UnitPrice`)) IS NULL, NULL, CSNG(INT(CSNG(`o`.`UnitPrice`)))) - FROM `Order Details` AS `o` - WHERE `o`.`Quantity` < 5 - """); - } - - public override async Task Where_mathf_exp(bool async) - { - await base.Where_mathf_exp(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND EXP(`o`.`Discount`) > 1 -"""); - } - - public override async Task Where_mathf_log10(bool async) - { - await base.Where_mathf_log10(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND `o`.`Discount` > 0 AND (LOG(`o`.`Discount`) / 2.302585) < 0 -"""); - } - - public override async Task Where_mathf_log(bool async) - { - await base.Where_mathf_log(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND `o`.`Discount` > 0 AND LOG(`o`.`Discount`) < 0 -"""); - } - - public override async Task Where_mathf_log_new_base(bool async) - { - await base.Where_mathf_log_new_base(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND `o`.`Discount` > 0 AND (LOG(`o`.`Discount`) / LOG(7)) < -1 -"""); - } - - public override async Task Where_mathf_sqrt(bool async) - { - await base.Where_mathf_sqrt(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND SQR(`o`.`Discount`) > 0 -"""); - } - - public override async Task Where_mathf_acos(bool async) - { - await base.Where_mathf_acos(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND (1.5707963267949 + ATN(-`o`.`Discount` / SQR(-(`o`.`Discount` * `o`.`Discount`) + 1))) > 1.0 -"""); - } - - public override async Task Where_mathf_asin(bool async) - { - await base.Where_mathf_asin(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND ATN(`o`.`Discount` / SQR(-(`o`.`Discount` * `o`.`Discount`) + 1)) > 0 -"""); - } - - public override async Task Where_mathf_atan(bool async) - { - await base.Where_mathf_atan(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND ATN(`o`.`Discount`) > 0 -"""); - } - - public override async Task Where_mathf_atan2(bool async) - { - await base.Where_mathf_atan2(async); - - AssertSql( - """ - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`OrderID` = 11077 AND ATN(`o`.`Discount` / 1) > 0 - """); - } - - public override async Task Where_mathf_cos(bool async) - { - await base.Where_mathf_cos(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND COS(`o`.`Discount`) > 0 -"""); - } - - public override async Task Where_mathf_sin(bool async) - { - await base.Where_mathf_sin(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND SIN(`o`.`Discount`) > 0 -"""); - } - - public override async Task Where_mathf_tan(bool async) - { - await base.Where_mathf_tan(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND TAN(`o`.`Discount`) > 0 -"""); - } - - public override async Task Where_mathf_sign(bool async) - { - await base.Where_mathf_sign(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND SGN(`o`.`Discount`) > 0 -"""); - } - - public override async Task Where_mathf_degrees(bool async) - { - await base.Where_mathf_degrees(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND (`o`.`Discount` * (180 / 3.141593)) > 0 -"""); - } - - public override async Task Where_mathf_radians(bool async) - { - await base.Where_mathf_radians(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` -FROM `Order Details` AS `o` -WHERE `o`.`OrderID` = 11077 AND (`o`.`Discount` * (3.141593 / 180)) > 0 -"""); - } - - public override async Task Where_guid_newguid(bool isAsync) - { - await base.Where_guid_newguid(isAsync); - - //Don't validate SQL. GUID changes on each execution. - /*AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE '{638fa0fe-7a53-418d-958e-431093428c62}' <> '{00000000-0000-0000-0000-000000000000}' -""");*/ - } - - public override async Task Where_string_to_upper(bool isAsync) - { - await base.Where_string_to_upper(isAsync); - - AssertSql( - $""" - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE UCASE(`c`.`CustomerID`) = 'ALFKI' - """); - } - - public override async Task Where_string_to_lower(bool isAsync) - { - await base.Where_string_to_lower(isAsync); - - AssertSql( - $""" - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE LCASE(`c`.`CustomerID`) = 'alfki' - """); - } - - public override async Task Where_functions_nested(bool isAsync) - { - await base.Where_functions_nested(isAsync); - - AssertSql( - """ - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE CDBL(IIF(LEN(`c`.`CustomerID`) IS NULL, NULL, CLNG(LEN(`c`.`CustomerID`))))^2.0 = 25.0 - """); - } - - public override async Task Convert_ToBoolean(bool async) - { - await base.Convert_ToBoolean(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`CustomerID` = 'ALFKI' AND CONVERT(bit, CONVERT(bit, `o`.`OrderID` % 3)) = CAST(1 AS bit) -""", - // - """ -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`CustomerID` = 'ALFKI' AND CONVERT(bit, CONVERT(tinyint, `o`.`OrderID` % 3)) = CAST(1 AS bit) -""", - // - """ -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`CustomerID` = 'ALFKI' AND CONVERT(bit, CONVERT(decimal(18, 2), `o`.`OrderID` % 3)) = CAST(1 AS bit) -""", - // - """ -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`CustomerID` = 'ALFKI' AND CONVERT(bit, CONVERT(float, `o`.`OrderID` % 3)) = CAST(1 AS bit) -""", - // - """ -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`CustomerID` = 'ALFKI' AND CONVERT(bit, CAST(CONVERT(float, `o`.`OrderID` % 3) AS real)) = CAST(1 AS bit) -""", - // - """ -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`CustomerID` = 'ALFKI' AND CONVERT(bit, CONVERT(smallint, `o`.`OrderID` % 3)) = CAST(1 AS bit) -""", - // - """ -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`CustomerID` = 'ALFKI' AND CONVERT(bit, CONVERT(int, `o`.`OrderID` % 3)) = CAST(1 AS bit) -""", - // - """ -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`CustomerID` = 'ALFKI' AND CONVERT(bit, CONVERT(bigint, `o`.`OrderID` % 3)) = CAST(1 AS bit) -"""); - } - - public override async Task Convert_ToByte(bool isAsync) - { - var convertMethods = new List>> - { - o => Convert.ToByte(Convert.ToByte(o.OrderID % 1)) >= 0, - o => Convert.ToByte(Convert.ToDecimal(o.OrderID % 1)) >= 0, - o => Convert.ToByte(Convert.ToDouble(o.OrderID % 1)) >= 0, - o => Convert.ToByte((float)Convert.ToDouble(o.OrderID % 1)) >= 0, - o => Convert.ToByte(Convert.ToInt16(o.OrderID % 1)) >= 0, - o => Convert.ToByte(Convert.ToInt32(o.OrderID % 1)) >= 0, - // o => Convert.ToByte(Convert.ToInt64(o.OrderID % 1)) >= 0, - o => Convert.ToByte(Convert.ToString(o.OrderID % 1)) >= 0 - }; - - foreach (var convertMethod in convertMethods) - { - await AssertQuery( - isAsync, - ss => ss.Set().Where(o => o.CustomerID == "ALFKI") - .Where(convertMethod)); - } - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CBYTE(`o`.`OrderID` MOD 1)) IS NULL, NULL, CBYTE(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CBYTE(`o`.`OrderID` MOD 1)))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CCUR(`o`.`OrderID` MOD 1)) IS NULL, NULL, CBYTE(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CCUR(`o`.`OrderID` MOD 1)))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CBYTE(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CSNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)))) IS NULL, NULL, CBYTE(IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CSNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)))))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CINT(`o`.`OrderID` MOD 1)) IS NULL, NULL, CBYTE(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CINT(`o`.`OrderID` MOD 1)))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CLNG(`o`.`OrderID` MOD 1)) IS NULL, NULL, CBYTE(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CLNG(`o`.`OrderID` MOD 1)))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF((`o`.`OrderID` MOD 1 & '') IS NULL, NULL, CBYTE((`o`.`OrderID` MOD 1 & ''))) >= 0) - """); - } - - public override async Task Convert_ToDecimal(bool isAsync) - { - var convertMethods = new List>> - { - o => Convert.ToDecimal(Convert.ToByte(o.OrderID % 1)) >= 0, - o => Convert.ToDecimal(Convert.ToDecimal(o.OrderID % 1)) >= 0, - o => Convert.ToDecimal(Convert.ToDouble(o.OrderID % 1)) >= 0, - o => Convert.ToDecimal((float)Convert.ToDouble(o.OrderID % 1)) >= 0, - o => Convert.ToDecimal(Convert.ToInt16(o.OrderID % 1)) >= 0, - o => Convert.ToDecimal(Convert.ToInt32(o.OrderID % 1)) >= 0, - // o => Convert.ToDecimal(Convert.ToInt64(o.OrderID % 1)) >= 0, - o => Convert.ToDecimal(Convert.ToString(o.OrderID % 1)) >= 0 - }; - - foreach (var convertMethod in convertMethods) - { - await AssertQuery( - isAsync, - ss => ss.Set().Where(o => o.CustomerID == "ALFKI") - .Where(convertMethod)); - } - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CBYTE(`o`.`OrderID` MOD 1)) IS NULL, NULL, CCUR(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CBYTE(`o`.`OrderID` MOD 1)))) >= 0.0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CCUR(`o`.`OrderID` MOD 1)) IS NULL, NULL, CCUR(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CCUR(`o`.`OrderID` MOD 1)))) >= 0.0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CCUR(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)))) >= 0.0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CSNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)))) IS NULL, NULL, CCUR(IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CSNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)))))) >= 0.0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CINT(`o`.`OrderID` MOD 1)) IS NULL, NULL, CCUR(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CINT(`o`.`OrderID` MOD 1)))) >= 0.0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CLNG(`o`.`OrderID` MOD 1)) IS NULL, NULL, CCUR(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CLNG(`o`.`OrderID` MOD 1)))) >= 0.0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF((`o`.`OrderID` MOD 1 & '') IS NULL, NULL, CCUR((`o`.`OrderID` MOD 1 & ''))) >= 0.0) - """); - } - - public override async Task Convert_ToDouble(bool isAsync) - { - var convertMethods = new List>> - { - o => Convert.ToDouble(Convert.ToByte(o.OrderID % 1)) >= 0, - o => Convert.ToDouble(Convert.ToDecimal(o.OrderID % 1)) >= 0, - o => Convert.ToDouble(Convert.ToDouble(o.OrderID % 1)) >= 0, - o => Convert.ToDouble((float)Convert.ToDouble(o.OrderID % 1)) >= 0, - o => Convert.ToDouble(Convert.ToInt16(o.OrderID % 1)) >= 0, - o => Convert.ToDouble(Convert.ToInt32(o.OrderID % 1)) >= 0, - // o => Convert.ToDouble(Convert.ToInt64(o.OrderID % 1)) >= 0, - o => Convert.ToDouble(Convert.ToString(o.OrderID % 1)) >= 0 - }; - - foreach (var convertMethod in convertMethods) - { - await AssertQuery( - isAsync, - ss => ss.Set().Where(o => o.CustomerID == "ALFKI") - .Where(convertMethod)); - } - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CBYTE(`o`.`OrderID` MOD 1)) IS NULL, NULL, CDBL(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CBYTE(`o`.`OrderID` MOD 1)))) >= 0.0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CCUR(`o`.`OrderID` MOD 1)) IS NULL, NULL, CDBL(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CCUR(`o`.`OrderID` MOD 1)))) >= 0.0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CDBL(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)))) >= 0.0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CSNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)))) IS NULL, NULL, CDBL(IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CSNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)))))) >= 0.0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CINT(`o`.`OrderID` MOD 1)) IS NULL, NULL, CDBL(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CINT(`o`.`OrderID` MOD 1)))) >= 0.0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CLNG(`o`.`OrderID` MOD 1)) IS NULL, NULL, CDBL(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CLNG(`o`.`OrderID` MOD 1)))) >= 0.0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF((`o`.`OrderID` MOD 1 & '') IS NULL, NULL, CDBL((`o`.`OrderID` MOD 1 & ''))) >= 0.0) - """); - } - - public override async Task Convert_ToInt16(bool isAsync) - { - var convertMethods = new List>> - { - o => Convert.ToInt16(Convert.ToByte(o.OrderID % 1)) >= 0, - o => Convert.ToInt16(Convert.ToDecimal(o.OrderID % 1)) >= 0, - o => Convert.ToInt16(Convert.ToDouble(o.OrderID % 1)) >= 0, - o => Convert.ToInt16((float)Convert.ToDouble(o.OrderID % 1)) >= 0, - o => Convert.ToInt16(Convert.ToInt16(o.OrderID % 1)) >= 0, - o => Convert.ToInt16(Convert.ToInt32(o.OrderID % 1)) >= 0, - // o => Convert.ToInt16(Convert.ToInt64(o.OrderID % 1)) >= 0, - o => Convert.ToInt16(Convert.ToString(o.OrderID % 1)) >= 0 - }; - - foreach (var convertMethod in convertMethods) - { - await AssertQuery( - isAsync, - ss => ss.Set().Where(o => o.CustomerID == "ALFKI") - .Where(convertMethod)); - } - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CBYTE(`o`.`OrderID` MOD 1)) IS NULL, NULL, CINT(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CBYTE(`o`.`OrderID` MOD 1)))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CCUR(`o`.`OrderID` MOD 1)) IS NULL, NULL, CINT(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CCUR(`o`.`OrderID` MOD 1)))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CINT(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CSNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)))) IS NULL, NULL, CINT(IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CSNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)))))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CINT(`o`.`OrderID` MOD 1)) IS NULL, NULL, CINT(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CINT(`o`.`OrderID` MOD 1)))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CLNG(`o`.`OrderID` MOD 1)) IS NULL, NULL, CINT(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CLNG(`o`.`OrderID` MOD 1)))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF((`o`.`OrderID` MOD 1 & '') IS NULL, NULL, CINT((`o`.`OrderID` MOD 1 & ''))) >= 0) - """); - } - - public override async Task Convert_ToInt32(bool isAsync) - { - var convertMethods = new List>> - { - o => Convert.ToInt32(Convert.ToByte(o.OrderID % 1)) >= 0, - o => Convert.ToInt32(Convert.ToDecimal(o.OrderID % 1)) >= 0, - o => Convert.ToInt32(Convert.ToDouble(o.OrderID % 1)) >= 0, - o => Convert.ToInt32((float)Convert.ToDouble(o.OrderID % 1)) >= 0, - o => Convert.ToInt32(Convert.ToInt16(o.OrderID % 1)) >= 0, - o => Convert.ToInt32(Convert.ToInt32(o.OrderID % 1)) >= 0, - // o => Convert.ToInt32(Convert.ToInt64(o.OrderID % 1)) >= 0, - o => Convert.ToInt32(Convert.ToString(o.OrderID % 1)) >= 0 - }; - - foreach (var convertMethod in convertMethods) - { - await AssertQuery( - isAsync, - ss => ss.Set().Where(o => o.CustomerID == "ALFKI") - .Where(convertMethod)); - } - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CBYTE(`o`.`OrderID` MOD 1)) IS NULL, NULL, CLNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CBYTE(`o`.`OrderID` MOD 1)))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CCUR(`o`.`OrderID` MOD 1)) IS NULL, NULL, CLNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CCUR(`o`.`OrderID` MOD 1)))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CLNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CSNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)))) IS NULL, NULL, CLNG(IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CSNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)))))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CINT(`o`.`OrderID` MOD 1)) IS NULL, NULL, CLNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CINT(`o`.`OrderID` MOD 1)))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CLNG(`o`.`OrderID` MOD 1)) IS NULL, NULL, CLNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CLNG(`o`.`OrderID` MOD 1)))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (IIF((`o`.`OrderID` MOD 1 & '') IS NULL, NULL, CLNG((`o`.`OrderID` MOD 1 & ''))) >= 0) - """); - } - - [ConditionalTheory(Skip = "Int64 support has not been implemented yet.")] - public override async Task Convert_ToInt64(bool isAsync) - { - await base.Convert_ToInt64(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (CONVERT(bigint, IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CBYTE(`o`.`OrderID` MOD 1))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (CONVERT(bigint, IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CCUR(`o`.`OrderID` MOD 1))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (CONVERT(bigint, IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (CONVERT(bigint, IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CSNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1))))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (CONVERT(bigint, IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CINT(`o`.`OrderID` MOD 1))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (CONVERT(bigint, IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CLNG(`o`.`OrderID` MOD 1))) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (CONVERT(bigint, CONVERT(bigint, `o`.`OrderID` MOD 1)) >= 0) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (CONVERT(bigint, CONVERT(nvarchar(max), `o`.`OrderID` MOD 1)) >= 0) - """); - } - - public override async Task Convert_ToString(bool isAsync) - { - var convertMethods = new List>> - { - o => Convert.ToString(Convert.ToByte(o.OrderID % 1)) != "10", - o => Convert.ToString(Convert.ToDecimal(o.OrderID % 1)) != "10", - o => Convert.ToString(Convert.ToDouble(o.OrderID % 1)) != "10", - o => Convert.ToString((float)Convert.ToDouble(o.OrderID % 1)) != "10", - o => Convert.ToString(Convert.ToInt16(o.OrderID % 1)) != "10", - o => Convert.ToString(Convert.ToInt32(o.OrderID % 1)) != "10", - // o => Convert.ToString(Convert.ToInt64(o.OrderID % 1)) != "10", - o => Convert.ToString(Convert.ToString(o.OrderID % 1)) != "10", - o => Convert.ToString(o.OrderDate.Value).Contains("1997") || Convert.ToString(o.OrderDate.Value).Contains("1998") - }; - - foreach (var convertMethod in convertMethods) - { - await AssertQuery( - isAsync, - ss => ss.Set().Where(o => o.CustomerID == "ALFKI") - .Where(convertMethod)); - } - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (((IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CBYTE(`o`.`OrderID` MOD 1)) & '') <> '10') OR (IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CBYTE(`o`.`OrderID` MOD 1)) & '') IS NULL) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (((IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CCUR(`o`.`OrderID` MOD 1)) & '') <> '10') OR (IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CCUR(`o`.`OrderID` MOD 1)) & '') IS NULL) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (((IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) & '') <> '10') OR (IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) & '') IS NULL) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND ((CONVERT(nvarchar(max), IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CSNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1))))) <> '10') OR CONVERT(nvarchar(max), IIF(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1)) IS NULL, NULL, CSNG(IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CDBL(`o`.`OrderID` MOD 1))))) IS NULL) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (((IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CINT(`o`.`OrderID` MOD 1)) & '') <> '10') OR (IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CINT(`o`.`OrderID` MOD 1)) & '') IS NULL) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (((IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CLNG(`o`.`OrderID` MOD 1)) & '') <> '10') OR (IIF(`o`.`OrderID` MOD 1 IS NULL, NULL, CLNG(`o`.`OrderID` MOD 1)) & '') IS NULL) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (((CONVERT(bigint, `o`.`OrderID` MOD 1) & '') <> '10') OR (CONVERT(bigint, `o`.`OrderID` MOD 1) & '') IS NULL) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND (((CONVERT(nvarchar(max), `o`.`OrderID` MOD 1) & '') <> '10') OR (CONVERT(nvarchar(max), `o`.`OrderID` MOD 1) & '') IS NULL) - """, - // - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`CustomerID` = 'ALFKI') AND ((CHARINDEX('1997', CONVERT(nvarchar(max), `o`.`OrderDate`)) > 0) OR (CHARINDEX('1998', CONVERT(nvarchar(max), `o`.`OrderDate`)) > 0)) - """); - } - - public override async Task Indexof_with_emptystring(bool async) - { - await base.Indexof_with_emptystring(async); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE IIF(`c`.`Region` IS NOT NULL, 0, NULL) = 0 -"""); - } - - public override async Task Indexof_with_one_constant_arg(bool async) - { - await base.Indexof_with_one_constant_arg(async); + await base.Client_evaluation_of_uncorrelated_method_call(async); AssertSql( """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE (INSTR(1, `c`.`ContactName`, 'a', 1) - 1) = 1 -"""); - } - - public override async Task Indexof_with_one_parameter_arg(bool async) - { - await base.Indexof_with_one_parameter_arg(async); - AssertSql( - $""" -@__pattern_0='a' (Size = 30) -@__pattern_0='a' (Size = 30) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE (INSTR(1, `c`.`ContactName`, {AssertSqlHelper.Parameter("@__pattern_0")}, 1) - IIF({AssertSqlHelper.Parameter("@__pattern_0")} = '', 0, 1)) = 1 +SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` +FROM `Order Details` AS `o` +WHERE `o`.`UnitPrice` < 7.0 AND 10 < `o`.`ProductID` """); } - public override async Task Indexof_with_constant_starting_position(bool async) + public override async Task Sum_over_round_works_correctly_in_projection(bool async) { - await base.Indexof_with_constant_starting_position(async); + await base.Sum_over_round_works_correctly_in_projection(async); AssertSql( """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE (INSTR(3, `c`.`ContactName`, 'a', 1) - 1) = 4 -"""); - } - - public override async Task Indexof_with_parameter_starting_position(bool async) - { - await base.Indexof_with_parameter_starting_position(async); - - AssertSql( - $""" -@__start_0='2' - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE (INSTR({AssertSqlHelper.Parameter("@__start_0")} + 1, `c`.`ContactName`, 'a', 1) - 1) = 4 +SELECT `o`.`OrderID`, ( + SELECT IIF(SUM(ROUND(`o0`.`UnitPrice`, 2)) IS NULL, 0.0, SUM(ROUND(`o0`.`UnitPrice`, 2))) + FROM `Order Details` AS `o0` + WHERE `o`.`OrderID` = `o0`.`OrderID`) AS `Sum` +FROM `Orders` AS `o` +WHERE `o`.`OrderID` < 10300 """); } - public override async Task Replace_with_emptystring(bool isAsync) - { - await base.Replace_with_emptystring(isAsync); - - AssertSql( - $""" - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE REPLACE(`c`.`ContactName`, 'ia', '') = 'Mar Anders' - """); - } - - public override async Task Replace_using_property_arguments(bool async) - { - await base.Replace_using_property_arguments(async); - - AssertSql( - """ - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE REPLACE(`c`.`ContactName`, `c`.`ContactName`, `c`.`CustomerID`) = `c`.`CustomerID` - """); - } - - public override async Task Substring_with_one_arg_with_zero_startindex(bool async) + public override async Task Sum_over_round_works_correctly_in_projection_2(bool async) { - await base.Substring_with_one_arg_with_zero_startindex(async); + await base.Sum_over_round_works_correctly_in_projection_2(async); AssertSql( """ -SELECT `c`.`ContactName` -FROM `Customers` AS `c` -WHERE MID(`c`.`CustomerID`, 0 + 1, LEN(`c`.`CustomerID`)) = 'ALFKI' +SELECT `o`.`OrderID`, ( + SELECT IIF(SUM(ROUND(`o0`.`UnitPrice` * `o0`.`UnitPrice`, 2)) IS NULL, 0.0, SUM(ROUND(`o0`.`UnitPrice` * `o0`.`UnitPrice`, 2))) + FROM `Order Details` AS `o0` + WHERE `o`.`OrderID` = `o0`.`OrderID`) AS `Sum` +FROM `Orders` AS `o` +WHERE `o`.`OrderID` < 10300 """); } - public override async Task Substring_with_one_arg_with_constant(bool async) + public override async Task Sum_over_truncate_works_correctly_in_projection(bool async) { - await base.Substring_with_one_arg_with_constant(async); + await base.Sum_over_truncate_works_correctly_in_projection(async); AssertSql( """ -SELECT `c`.`ContactName` -FROM `Customers` AS `c` -WHERE MID(`c`.`CustomerID`, 1 + 1, LEN(`c`.`CustomerID`)) = 'LFKI' -"""); - } - - public override async Task Substring_with_one_arg_with_closure(bool async) - { - await base.Substring_with_one_arg_with_closure(async); - - AssertSql( - $""" -@__start_0='2' - -SELECT `c`.`ContactName` -FROM `Customers` AS `c` -WHERE MID(`c`.`CustomerID`, {AssertSqlHelper.Parameter("@__start_0")} + 1, LEN(`c`.`CustomerID`)) = 'FKI' +SELECT `o`.`OrderID`, ( + SELECT IIF(SUM(INT(`o0`.`UnitPrice`)) IS NULL, 0.0, SUM(INT(`o0`.`UnitPrice`))) + FROM `Order Details` AS `o0` + WHERE `o`.`OrderID` = `o0`.`OrderID`) AS `Sum` +FROM `Orders` AS `o` +WHERE `o`.`OrderID` < 10300 """); } - public override async Task Substring_with_two_args_with_zero_startindex(bool async) - { - await base.Substring_with_two_args_with_zero_startindex(async); - - AssertSql( - """ - SELECT MID(`c`.`ContactName`, 0 + 1, 3) - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = 'ALFKI' - """); - } - - public override async Task Substring_with_two_args_with_zero_length(bool async) - { - await base.Substring_with_two_args_with_zero_length(async); - - AssertSql( - """ - SELECT MID(`c`.`ContactName`, 2 + 1, 0) - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = 'ALFKI' - """); - } - - public override async Task Substring_with_two_args_with_constant(bool async) + public override async Task Sum_over_truncate_works_correctly_in_projection_2(bool async) { - await base.Substring_with_two_args_with_constant(async); + await base.Sum_over_truncate_works_correctly_in_projection_2(async); AssertSql( """ - SELECT MID(`c`.`ContactName`, 1 + 1, 3) - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = 'ALFKI' - """); - } - - public override async Task Substring_with_two_args_with_closure(bool async) - { - await base.Substring_with_two_args_with_closure(async); - - AssertSql( - $""" - @__start_0='2' - - SELECT MID(`c`.`ContactName`, {AssertSqlHelper.Parameter("@__start_0")} + 1, 3) - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = 'ALFKI' - """); +SELECT `o`.`OrderID`, ( + SELECT IIF(SUM(INT(`o0`.`UnitPrice` * `o0`.`UnitPrice`)) IS NULL, 0.0, SUM(INT(`o0`.`UnitPrice` * `o0`.`UnitPrice`))) + FROM `Order Details` AS `o0` + WHERE `o`.`OrderID` = `o0`.`OrderID`) AS `Sum` +FROM `Orders` AS `o` +WHERE `o`.`OrderID` < 10300 +"""); } - public override async Task Substring_with_two_args_with_Index_of(bool async) + public override async Task Where_functions_nested(bool isAsync) { - await base.Substring_with_two_args_with_Index_of(async); + await base.Where_functions_nested(isAsync); AssertSql( """ - SELECT MID(`c`.`ContactName`, (INSTR(1, `c`.`ContactName`, 'a', 1) - 1) + 1, 3) + SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = 'ALFKI' + WHERE CDBL(IIF(LEN(`c`.`CustomerID`) IS NULL, NULL, CLNG(LEN(`c`.`CustomerID`))))^2.0 = 25.0 """); } - public override async Task IsNullOrEmpty_in_predicate(bool isAsync) - { - await base.IsNullOrEmpty_in_predicate(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`Region` IS NULL OR (`c`.`Region` LIKE '') -"""); - } - - public override async Task IsNullOrEmpty_in_projection(bool async) - { - await base.IsNullOrEmpty_in_projection(async); - - AssertSql( - """ -SELECT `c`.`CustomerID` AS `Id`, IIF(`c`.`Region` IS NULL OR (`c`.`Region` LIKE ''), TRUE, FALSE) AS `Value` -FROM `Customers` AS `c` -"""); - } - - public override async Task IsNullOrEmpty_negated_in_predicate(bool async) - { - await base.IsNullOrEmpty_negated_in_predicate(async); - - AssertSql( -""" -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`Region` IS NOT NULL AND `c`.`Region` NOT LIKE '' -"""); - } - - public override async Task IsNullOrEmpty_negated_in_projection(bool async) - { - await base.IsNullOrEmpty_negated_in_projection(async); - - AssertSql( -""" -SELECT `c`.`CustomerID` AS `Id`, IIF(`c`.`Region` IS NOT NULL AND `c`.`Region` NOT LIKE '', TRUE, FALSE) AS `Value` -FROM `Customers` AS `c` -"""); - } - - public override async Task IsNullOrWhiteSpace_in_predicate(bool isAsync) - { - await base.IsNullOrWhiteSpace_in_predicate(isAsync); - - AssertSql( -""" -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`Region` IS NULL OR `c`.`Region` = '' -"""); - } - - public override async Task IsNullOrWhiteSpace_in_predicate_on_non_nullable_column(bool isAsync) - { - await base.IsNullOrWhiteSpace_in_predicate_on_non_nullable_column(isAsync); - - AssertSql( - $""" - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = '' - """); - } - - public override async Task TrimStart_without_arguments_in_predicate(bool isAsync) - { - await base.TrimStart_without_arguments_in_predicate(isAsync); - - AssertSql( - $""" - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE LTRIM(`c`.`ContactTitle`) = 'Owner' - """); - } - - [ConditionalTheory(Skip = "Issue#17328")] - public override Task TrimStart_with_char_argument_in_predicate(bool isAsync) - => base.TrimStart_with_char_argument_in_predicate(isAsync); - - [ConditionalTheory(Skip = "Issue#17328")] - public override Task TrimStart_with_char_array_argument_in_predicate(bool isAsync) - => base.TrimStart_with_char_array_argument_in_predicate(isAsync); - - public override async Task TrimEnd_without_arguments_in_predicate(bool isAsync) - { - await base.TrimEnd_without_arguments_in_predicate(isAsync); - - AssertSql( - $""" - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE RTRIM(`c`.`ContactTitle`) = 'Owner' - """); - } - - [ConditionalTheory(Skip = "Issue#17328")] - public override Task TrimEnd_with_char_argument_in_predicate(bool isAsync) - => base.TrimEnd_with_char_argument_in_predicate(isAsync); - - [ConditionalTheory(Skip = "Issue#17328")] - public override Task TrimEnd_with_char_array_argument_in_predicate(bool isAsync) - => base.TrimEnd_with_char_array_argument_in_predicate(isAsync); - - public override async Task Trim_without_argument_in_predicate(bool isAsync) - { - await base.Trim_without_argument_in_predicate(isAsync); - - AssertSql( - $""" - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE TRIM(`c`.`ContactTitle`) = 'Owner' - """); - } - - [ConditionalTheory(Skip = "Issue#17328")] - public override Task Trim_with_char_argument_in_predicate(bool isAsync) - => base.Trim_with_char_argument_in_predicate(isAsync); - - [ConditionalTheory(Skip = "Issue#17328")] - public override Task Trim_with_char_array_argument_in_predicate(bool isAsync) - => base.Trim_with_char_array_argument_in_predicate(isAsync); - - public override async Task Order_by_length_twice(bool isAsync) + public override async Task Order_by_length_twice(bool isAsync) { await base.Order_by_length_twice(isAsync); @@ -2703,30 +141,18 @@ ORDER BY IIF(LEN(`c`.`CustomerID`) IS NULL, NULL, CLNG(LEN(`c`.`CustomerID`))), """); } - public override async Task Static_string_equals_in_predicate(bool isAsync) - { - await base.Static_string_equals_in_predicate(isAsync); - - AssertSql( - $""" - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = 'ANATR' - """); - } - public override async Task Static_equals_nullable_datetime_compared_to_non_nullable(bool isAsync) { await base.Static_equals_nullable_datetime_compared_to_non_nullable(isAsync); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__arg_0='1996-07-04T00:00:00.0000000' (DbType = DateTime)")} - - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE `o`.`OrderDate` = CDATE({AssertSqlHelper.Parameter("@__arg_0")}) - """); + """ +@arg='1996-07-04T00:00:00.0000000' (DbType = DateTime) + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderDate` = CDATE(@arg) +"""); } public override async Task Static_equals_int_compared_to_long(bool isAsync) @@ -2741,143 +167,7 @@ public override async Task Static_equals_int_compared_to_long(bool isAsync) """); } - public override async Task Where_DateOnly_FromDateTime(bool async) - { - await base.Where_DateOnly_FromDateTime(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderDate` IS NOT NULL AND `o`.`OrderDate` = #1996-09-16# -"""); - } - - public override async Task Projecting_Math_Truncate_and_ordering_by_it_twice(bool isAsync) - { - await base.Projecting_Math_Truncate_and_ordering_by_it_twice(isAsync); - - // issue #16038 - // AssertSql( - // $@"SELECT ROUND(IIF(`o`.`OrderID` IS NULL, NULL, CDBL(`o`.`OrderID`)), 0, 1) AS `A` - //FROM `Orders` AS `o` - //WHERE `o`.`OrderID` < 10250 - //ORDER BY `A`"); - } - - public override async Task Projecting_Math_Truncate_and_ordering_by_it_twice2(bool isAsync) - { - await base.Projecting_Math_Truncate_and_ordering_by_it_twice2(isAsync); - - // issue #16038 - // AssertSql( - // $@"SELECT ROUND(IIF(`o`.`OrderID` IS NULL, NULL, CDBL(`o`.`OrderID`)), 0, 1) AS `A` - //FROM `Orders` AS `o` - //WHERE `o`.`OrderID` < 10250 - //ORDER BY `A` DESC"); - } - - public override async Task Projecting_Math_Truncate_and_ordering_by_it_twice3(bool isAsync) - { - await base.Projecting_Math_Truncate_and_ordering_by_it_twice3(isAsync); - - // issue #16038 - // AssertSql( - // $@"SELECT ROUND(IIF(`o`.`OrderID` IS NULL, NULL, CDBL(`o`.`OrderID`)), 0, 1) AS `A` - //FROM `Orders` AS `o` - //WHERE `o`.`OrderID` < 10250 - //ORDER BY `A` DESC"); - } - - public override Task Regex_IsMatch_MethodCall(bool async) - => AssertTranslationFailed(() => base.Regex_IsMatch_MethodCall(async)); - - public override Task Regex_IsMatch_MethodCall_constant_input(bool async) - => AssertTranslationFailed(() => base.Regex_IsMatch_MethodCall_constant_input(async)); - - public override Task Datetime_subtraction_TotalDays(bool async) - => AssertTranslationFailed(() => base.Datetime_subtraction_TotalDays(async)); - - public override async Task Select_ToString_IndexOf(bool async) - { - await base.Select_ToString_IndexOf(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE (INSTR(1, (`o`.`OrderID` & ''), '123', 1) - 1) = -1 -"""); - } - - public override async Task Select_IndexOf_ToString(bool async) - { - await base.Select_IndexOf_ToString(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE (INSTR(1, '123', (`o`.`OrderID` & ''), 1) - IIF((`o`.`OrderID` & '') = '', 0, 1)) = -1 -"""); - } - - public override async Task String_Contains_in_projection(bool async) - { - await base.String_Contains_in_projection(async); - - AssertSql( - """ -SELECT `c`.`CustomerID` AS `Id`, IIF(`c`.`ContactName` IS NOT NULL AND (INSTR(1, `c`.`CompanyName`, `c`.`ContactName`, 1) > 0 OR (`c`.`ContactName` LIKE '')), TRUE, FALSE) AS `Value` -FROM `Customers` AS `c` -"""); - } - - public override async Task String_Contains_negated_in_predicate(bool async) - { - await base.String_Contains_negated_in_predicate(async); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`ContactName` IS NULL OR (INSTR(1, `c`.`CompanyName`, `c`.`ContactName`, 1) <= 0 AND `c`.`ContactName` NOT LIKE '') -"""); - } - - public override async Task String_Contains_negated_in_projection(bool async) - { - await base.String_Contains_negated_in_projection(async); - - AssertSql( - """ -SELECT `c`.`CustomerID` AS `Id`, IIF(`c`.`ContactName` IS NULL OR (INSTR(1, `c`.`CompanyName`, `c`.`ContactName`, 1) <= 0 AND `c`.`ContactName` NOT LIKE ''), TRUE, FALSE) AS `Value` -FROM `Customers` AS `c` -"""); - } - - public override async Task String_Contains_with_StringComparison_Ordinal(bool async) - { - await base.String_Contains_with_StringComparison_Ordinal(async); - - AssertSql(); - } - - public override async Task String_Contains_with_StringComparison_OrdinalIgnoreCase(bool async) - { - await base.String_Contains_with_StringComparison_OrdinalIgnoreCase(async); - - AssertSql(); - } - - public override async Task String_Contains_with_StringComparison_unsupported(bool async) - { - await base.String_Contains_with_StringComparison_unsupported(async); - - AssertSql(); - } - - [ConditionalTheory] + [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual async Task StandardDeviation(bool async) { diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs index c7248e3c..d889fb24 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs @@ -741,12 +741,12 @@ public override async Task GroupBy_param_Select_Sum_Min_Key_Max_Avg(bool isAsync await base.GroupBy_param_Select_Sum_Min_Key_Max_Avg(isAsync); AssertSql( - $""" -@__a_0='2' + """ +@a='2' SELECT IIF(SUM(`o0`.`OrderID`) IS NULL, 0, SUM(`o0`.`OrderID`)) AS `Sum`, MIN(`o0`.`OrderID`) AS `Min`, `o0`.`Key`, MAX(`o0`.`OrderID`) AS `Max`, AVG(CDBL(`o0`.`OrderID`)) AS `Avg` FROM ( - SELECT `o`.`OrderID`, CLNG({AssertSqlHelper.Parameter("@__a_0")}) AS `Key` + SELECT `o`.`OrderID`, CLNG(@a) AS `Key` FROM `Orders` AS `o` ) AS `o0` GROUP BY `o0`.`Key` @@ -758,12 +758,12 @@ public override async Task GroupBy_param_with_element_selector_Select_Sum(bool i await base.GroupBy_param_with_element_selector_Select_Sum(isAsync); AssertSql( - $""" -@__a_0='2' + """ +@a='2' SELECT IIF(SUM(`o0`.`OrderID`) IS NULL, 0, SUM(`o0`.`OrderID`)) AS `Sum` FROM ( - SELECT `o`.`OrderID`, CLNG({AssertSqlHelper.Parameter("@__a_0")}) AS `Key` + SELECT `o`.`OrderID`, CLNG(@a) AS `Key` FROM `Orders` AS `o` ) AS `o0` GROUP BY `o0`.`Key` @@ -775,12 +775,12 @@ public override async Task GroupBy_param_with_element_selector_Select_Sum2(bool await base.GroupBy_param_with_element_selector_Select_Sum2(isAsync); AssertSql( - $""" -@__a_0='2' + """ +@a='2' SELECT IIF(SUM(`o0`.`OrderID`) IS NULL, 0, SUM(`o0`.`OrderID`)) AS `Sum` FROM ( - SELECT `o`.`OrderID`, CLNG({AssertSqlHelper.Parameter("@__a_0")}) AS `Key` + SELECT `o`.`OrderID`, CLNG(@a) AS `Key` FROM `Orders` AS `o` ) AS `o0` GROUP BY `o0`.`Key` @@ -792,12 +792,12 @@ public override async Task GroupBy_param_with_element_selector_Select_Sum3(bool await base.GroupBy_param_with_element_selector_Select_Sum3(isAsync); AssertSql( - $""" -@__a_0='2' + """ +@a='2' SELECT IIF(SUM(`o0`.`OrderID`) IS NULL, 0, SUM(`o0`.`OrderID`)) AS `Sum` FROM ( - SELECT `o`.`OrderID`, CLNG({AssertSqlHelper.Parameter("@__a_0")}) AS `Key` + SELECT `o`.`OrderID`, CLNG(@a) AS `Key` FROM `Orders` AS `o` ) AS `o0` GROUP BY `o0`.`Key` @@ -809,12 +809,12 @@ public override async Task GroupBy_param_with_element_selector_Select_Sum_Min_Ke await base.GroupBy_param_with_element_selector_Select_Sum_Min_Key_Max_Avg(isAsync); AssertSql( - $""" -@__a_0='2' + """ +@a='2' SELECT IIF(SUM(`o0`.`OrderID`) IS NULL, 0, SUM(`o0`.`OrderID`)) AS `Sum`, `o0`.`Key` FROM ( - SELECT `o`.`OrderID`, CLNG({AssertSqlHelper.Parameter("@__a_0")}) AS `Key` + SELECT `o`.`OrderID`, CLNG(@a) AS `Key` FROM `Orders` AS `o` ) AS `o0` GROUP BY `o0`.`Key` @@ -1147,7 +1147,7 @@ public override async Task OrderBy_Take_GroupBy_Aggregate(bool isAsync) """ SELECT MIN(`o0`.`OrderID`) FROM ( - SELECT TOP 500 `o`.`OrderID`, `o`.`CustomerID` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0` @@ -1165,9 +1165,9 @@ SELECT MAX(`o0`.`OrderID`) FROM ( SELECT `o2`.`OrderID`, `o2`.`CustomerID` FROM ( - SELECT TOP 500 `o1`.`OrderID`, `o1`.`CustomerID` + SELECT TOP @p0 `o1`.`OrderID`, `o1`.`CustomerID` FROM ( - SELECT TOP 580 `o`.`OrderID`, `o`.`CustomerID` + SELECT TOP @p + @p0 `o`.`OrderID`, `o`.`CustomerID` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o1` @@ -1256,7 +1256,7 @@ public override async Task Join_complex_GroupBy_Aggregate(bool isAsync) """ SELECT `c0`.`CustomerID` AS `Key`, AVG(CDBL(`o0`.`OrderID`)) AS `Count` FROM ( - SELECT TOP 100 `o`.`OrderID`, `o`.`CustomerID` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID` FROM `Orders` AS `o` WHERE `o`.`OrderID` < 10400 ORDER BY `o`.`OrderDate` @@ -1264,9 +1264,9 @@ ORDER BY `o`.`OrderDate` INNER JOIN ( SELECT `c2`.`CustomerID` FROM ( - SELECT TOP 50 `c1`.`CustomerID`, `c1`.`City` + SELECT TOP @p1 `c1`.`CustomerID`, `c1`.`City` FROM ( - SELECT TOP 60 `c`.`CustomerID`, `c`.`City` + SELECT TOP @p0 + @p1 `c`.`CustomerID`, `c`.`City` FROM `Customers` AS `c` WHERE `c`.`CustomerID` NOT IN ('DRACD', 'FOLKO') ORDER BY `c`.`City` @@ -1368,9 +1368,9 @@ public override async Task GroupJoin_complex_GroupBy_Aggregate(bool isAsync) FROM ( SELECT `c2`.`CustomerID` FROM ( - SELECT TOP 50 `c1`.`CustomerID`, `c1`.`City` + SELECT TOP @p0 `c1`.`CustomerID`, `c1`.`City` FROM ( - SELECT TOP 60 `c`.`CustomerID`, `c`.`City` + SELECT TOP @p + @p0 `c`.`CustomerID`, `c`.`City` FROM `Customers` AS `c` WHERE `c`.`CustomerID` NOT IN ('DRACD', 'FOLKO') ORDER BY `c`.`City` @@ -1380,7 +1380,7 @@ ORDER BY `c1`.`City` DESC ORDER BY `c2`.`City` ) AS `c0` INNER JOIN ( - SELECT TOP 100 `o`.`OrderID`, `o`.`CustomerID` + SELECT TOP @p1 `o`.`OrderID`, `o`.`CustomerID` FROM `Orders` AS `o` WHERE `o`.`OrderID` < 10400 ORDER BY `o`.`OrderDate` @@ -2469,9 +2469,9 @@ public override async Task GroupBy_group_Distinct_Select_Distinct_aggregate(bool AssertSql( """ -SELECT [o].[CustomerID] AS [Key], MAX(DISTINCT ([o].[OrderDate])) AS [Max] -FROM [Orders] AS [o] -GROUP BY [o].[CustomerID] +SELECT `o`.`CustomerID` AS `Key`, MAX(`o`.`OrderDate`) AS `Max` +FROM `Orders` AS `o` +GROUP BY `o`.`CustomerID` """); } @@ -2481,11 +2481,9 @@ public override async Task GroupBy_group_Where_Select_Distinct_aggregate(bool as AssertSql( """ -SELECT [o].[CustomerID] AS [Key], MAX(DISTINCT (CASE - WHEN [o].[OrderDate] IS NOT NULL THEN [o].[OrderDate] -END)) AS [Max] -FROM [Orders] AS [o] -GROUP BY [o].[CustomerID] +SELECT `o`.`CustomerID` AS `Key`, MAX(IIF(`o`.`OrderDate` IS NOT NULL, `o`.`OrderDate`, NULL)) AS `Max` +FROM `Orders` AS `o` +GROUP BY `o`.`CustomerID` """); } @@ -3003,9 +3001,9 @@ public override async Task GroupBy_aggregate_from_right_side_of_join(bool async) """ SELECT `s0`.`CustomerID`, `s0`.`Address`, `s0`.`City`, `s0`.`CompanyName`, `s0`.`ContactName`, `s0`.`ContactTitle`, `s0`.`Country`, `s0`.`Fax`, `s0`.`Phone`, `s0`.`PostalCode`, `s0`.`Region`, `s0`.`Max` FROM ( - SELECT TOP 10 `s`.`CustomerID`, `s`.`Address`, `s`.`City`, `s`.`CompanyName`, `s`.`ContactName`, `s`.`ContactTitle`, `s`.`Country`, `s`.`Fax`, `s`.`Phone`, `s`.`PostalCode`, `s`.`Region`, `s`.`Max` + SELECT TOP @p `s`.`CustomerID`, `s`.`Address`, `s`.`City`, `s`.`CompanyName`, `s`.`ContactName`, `s`.`ContactTitle`, `s`.`Country`, `s`.`Fax`, `s`.`Phone`, `s`.`PostalCode`, `s`.`Region`, `s`.`Max` FROM ( - SELECT TOP 20 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o0`.`Max` + SELECT TOP @p + @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o0`.`Max` FROM `Customers` AS `c` INNER JOIN ( SELECT `o`.`CustomerID` AS `Key`, MAX(`o`.`OrderDate`) AS `Max` @@ -3749,6 +3747,20 @@ FROM [Orders] AS [o0] """); } + public override async Task Final_GroupBy_TagWith(bool async) + { + await base.Final_GroupBy_TagWith(async); + + AssertSql( + """ +-- foo + +SELECT `c`.`City`, `c`.`CustomerID`, `c`.`Address`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +ORDER BY `c`.`City` +"""); + } + public override async Task GroupBy_Where_with_grouping_result(bool async) { await base.GroupBy_Where_with_grouping_result(async); diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs index 47cfcb67..0d79a3b8 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs @@ -43,7 +43,7 @@ public override async Task Include_duplicate_reference3(bool async) FROM ( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o1`, @@ -52,7 +52,7 @@ ORDER BY `o`.`OrderID` FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`OrderID` ) AS `o3` @@ -404,7 +404,7 @@ public override async Task Include_duplicate_reference2(bool async) FROM ( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o1`, @@ -413,7 +413,7 @@ ORDER BY `o`.`OrderID` FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`OrderID` ) AS `o3` @@ -435,7 +435,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as """ SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactTitle` ) AS `c0` @@ -543,7 +543,7 @@ public override async Task Multi_level_includes_are_applied_with_skip(bool async FROM ( SELECT TOP 1 `c0`.`CustomerID` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p + 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'A%' ORDER BY `c`.`CustomerID` @@ -626,9 +626,9 @@ public override async Task Include_where_skip_take_projection(bool async) """ SELECT `o0`.`CustomerID` FROM ( - SELECT TOP 2 `o2`.`OrderID`, `o2`.`ProductID` + SELECT TOP @p0 `o2`.`OrderID`, `o2`.`ProductID` FROM ( - SELECT TOP 3 `o`.`OrderID`, `o`.`ProductID` + SELECT TOP @p + @p0 `o`.`OrderID`, `o`.`ProductID` FROM `Order Details` AS `o` WHERE `o`.`Quantity` = 10 ORDER BY `o`.`OrderID`, `o`.`ProductID` @@ -693,7 +693,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as """ SELECT `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` FROM ( - SELECT TOP 5 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, @@ -755,7 +755,7 @@ public override async Task Include_collection_take_no_order_by(bool async) """ SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` @@ -943,7 +943,7 @@ public override async Task Include_with_take(bool async) """ SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactName` DESC ) AS `c0` @@ -1057,7 +1057,7 @@ public override async Task Include_duplicate_reference(bool async) FROM (( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`CustomerID`, `o`.`OrderID` ) AS `o1`, @@ -1066,7 +1066,7 @@ public override async Task Include_duplicate_reference(bool async) FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`CustomerID`, `o0`.`OrderID` ) AS `o3` @@ -1468,7 +1468,7 @@ public override async Task Include_collection_orderby_take(bool async) """ SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 5 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` @@ -1864,6 +1864,21 @@ public override async Task Include_collection_with_left_join_clause_with_filter( """); } + public override async Task Include_collection_with_right_join_clause_with_filter(bool async) + { + await base.Include_collection_with_right_join_clause_with_filter(async); + + AssertSql( + """ +SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] +FROM [Customers] AS [c] +RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] +LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] +WHERE [c].[CustomerID] LIKE N'F%' +ORDER BY [c].[CustomerID], [o].[OrderID] +"""); + } + public override async Task Include_multiple_references_then_include_multi_level_reverse(bool async) { await base.Include_multiple_references_then_include_multi_level_reverse(async); diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs index 2ad6d813..b58f19c7 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs @@ -133,7 +133,7 @@ public override async Task Include_collection_take_no_order_by(bool async) """ SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` @@ -356,7 +356,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as """ SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactTitle` ) AS `c0` @@ -563,6 +563,21 @@ public override async Task Include_collection_with_left_join_clause_with_filter( """); } + public override async Task Include_collection_with_right_join_clause_with_filter(bool async) + { + await base.Include_collection_with_right_join_clause_with_filter(async); + + AssertSql( + """ +SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] +FROM [Customers] AS [c] +RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] +LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] +WHERE [c].[CustomerID] LIKE N'F%' +ORDER BY [c].[CustomerID], [o].[OrderID] +"""); + } + public override async Task Include_collection_with_cross_join_clause_with_filter(bool async) { await base.Include_collection_with_cross_join_clause_with_filter(async); @@ -767,7 +782,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as """ SELECT `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` FROM ( - SELECT TOP 5 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, @@ -786,9 +801,9 @@ public override async Task Include_where_skip_take_projection(bool async) """ SELECT `o0`.`CustomerID` FROM ( - SELECT TOP 2 `o2`.`OrderID`, `o2`.`ProductID` + SELECT TOP @p0 `o2`.`OrderID`, `o2`.`ProductID` FROM ( - SELECT TOP 3 `o`.`OrderID`, `o`.`ProductID` + SELECT TOP @p + @p0 `o`.`OrderID`, `o`.`ProductID` FROM `Order Details` AS `o` WHERE `o`.`Quantity` = 10 ORDER BY `o`.`OrderID`, `o`.`ProductID` @@ -874,7 +889,7 @@ public override async Task Include_duplicate_reference(bool async) FROM (( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`CustomerID`, `o`.`OrderID` ) AS `o1`, @@ -883,7 +898,7 @@ public override async Task Include_duplicate_reference(bool async) FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`CustomerID`, `o0`.`OrderID` ) AS `o3` @@ -911,7 +926,7 @@ public override async Task Include_duplicate_reference2(bool async) FROM ( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o1`, @@ -920,7 +935,7 @@ ORDER BY `o`.`OrderID` FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`OrderID` ) AS `o3` @@ -947,7 +962,7 @@ public override async Task Include_duplicate_reference3(bool async) FROM ( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o1`, @@ -956,7 +971,7 @@ ORDER BY `o`.`OrderID` FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`OrderID` ) AS `o3` @@ -1089,7 +1104,7 @@ public override async Task Include_with_take(bool async) """ SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactName` DESC ) AS `c0` @@ -1645,7 +1660,7 @@ public override async Task Multi_level_includes_are_applied_with_skip(bool async FROM ( SELECT TOP 1 `c0`.`CustomerID` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p + 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'A%' ORDER BY `c`.`CustomerID` @@ -1877,7 +1892,7 @@ public override async Task Include_collection_orderby_take(bool async) """ SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 5 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindJoinQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindJoinQueryJetTest.cs index 2df01d64..ada8d713 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindJoinQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindJoinQueryJetTest.cs @@ -104,7 +104,7 @@ public override async Task Join_customers_orders_with_subquery_with_take(bool is SELECT `c`.`ContactName`, `o0`.`OrderID` FROM `Customers` AS `c` INNER JOIN ( - SELECT TOP 5 `o`.`OrderID`, `o`.`CustomerID` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` @@ -134,7 +134,7 @@ public override async Task Join_customers_orders_with_subquery_anonymous_propert SELECT `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Customers` AS `c` INNER JOIN ( - SELECT TOP 5 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` @@ -168,7 +168,7 @@ public override async Task Join_customers_orders_with_subquery_predicate_with_ta SELECT `c`.`ContactName`, `o0`.`OrderID` FROM `Customers` AS `c` INNER JOIN ( - SELECT TOP 5 `o`.`OrderID`, `o`.`CustomerID` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID` FROM `Orders` AS `o` WHERE `o`.`OrderID` > 0 ORDER BY `o`.`OrderID` @@ -233,6 +233,30 @@ public override async Task Join_same_collection_force_alias_uniquefication(bool """); } + public override async Task LeftJoin(bool async) + { + await base.LeftJoin(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Customers` AS `c` +LEFT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` +"""); + } + + public override async Task RightJoin(bool async) + { + await base.RightJoin(async); + + AssertSql( + """ +SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Customers] AS [c] +RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] +"""); + } + public override async Task GroupJoin_simple(bool isAsync) { await base.GroupJoin_simple(isAsync); @@ -293,7 +317,7 @@ public override async Task GroupJoin_simple_subquery(bool isAsync) SELECT `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Customers` AS `c` INNER JOIN ( - SELECT TOP 4 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` @@ -398,7 +422,7 @@ public override async Task GroupJoin_DefaultIfEmpty3(bool isAsync) """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 1 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` @@ -550,7 +574,7 @@ public override async Task GroupJoin_Subquery_with_Take_Then_SelectMany_Where(bo INNER JOIN ( SELECT `o0`.`OrderID`, `o0`.`CustomerID` FROM ( - SELECT TOP 100 `o`.`OrderID`, `o`.`CustomerID` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0` @@ -559,6 +583,55 @@ ORDER BY `o`.`OrderID` """); } + public override async Task GroupJoin_aggregate_anonymous_key_selectors(bool async) + { + await base.GroupJoin_aggregate_anonymous_key_selectors(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, ( + SELECT IIF(SUM(IIF(LEN(`o`.`CustomerID`) IS NULL, NULL, CLNG(LEN(`o`.`CustomerID`)))) IS NULL, 0, SUM(IIF(LEN(`o`.`CustomerID`) IS NULL, NULL, CLNG(LEN(`o`.`CustomerID`))))) + FROM `Orders` AS `o` + WHERE `c`.`City` IS NOT NULL AND `c`.`CustomerID` = `o`.`CustomerID` AND `c`.`City` = 'London') AS `Sum` +FROM `Customers` AS `c` +"""); + } + + public override async Task GroupJoin_aggregate_anonymous_key_selectors2(bool async) + { + await base.GroupJoin_aggregate_anonymous_key_selectors2(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, ( + SELECT IIF(SUM(IIF(LEN(`o`.`CustomerID`) IS NULL, NULL, CLNG(LEN(`o`.`CustomerID`)))) IS NULL, 0, SUM(IIF(LEN(`o`.`CustomerID`) IS NULL, NULL, CLNG(LEN(`o`.`CustomerID`))))) + FROM `Orders` AS `o` + WHERE `c`.`CustomerID` = `o`.`CustomerID` AND 1996 = DATEPART('yyyy', `o`.`OrderDate`)) AS `Sum` +FROM `Customers` AS `c` +"""); + } + + public override async Task GroupJoin_aggregate_anonymous_key_selectors_one_argument(bool async) + { + await base.GroupJoin_aggregate_anonymous_key_selectors_one_argument(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, ( + SELECT IIF(SUM(IIF(LEN(`o`.`CustomerID`) IS NULL, NULL, CLNG(LEN(`o`.`CustomerID`)))) IS NULL, 0, SUM(IIF(LEN(`o`.`CustomerID`) IS NULL, NULL, CLNG(LEN(`o`.`CustomerID`))))) + FROM `Orders` AS `o` + WHERE `c`.`CustomerID` = `o`.`CustomerID`) AS `Sum` +FROM `Customers` AS `c` +"""); + } + + public override async Task GroupJoin_aggregate_nested_anonymous_key_selectors(bool async) + { + await base.GroupJoin_aggregate_nested_anonymous_key_selectors(async); + + AssertSql(); + } + public override async Task Inner_join_with_tautology_predicate_converts_to_cross_join(bool async) { await base.Inner_join_with_tautology_predicate_converts_to_cross_join(async); @@ -567,12 +640,12 @@ public override async Task Inner_join_with_tautology_predicate_converts_to_cross """ SELECT `c0`.`CustomerID`, `o0`.`OrderID` FROM ( - SELECT TOP 10 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0`, ( - SELECT TOP 10 `o`.`OrderID` + SELECT TOP @p `o`.`OrderID` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0` @@ -940,7 +1013,7 @@ public override async Task GroupJoin_customers_employees_subquery_shadow_take(bo SELECT `e0`.`Title`, `e0`.`EmployeeID` AS `Id` FROM `Customers` AS `c` INNER JOIN ( - SELECT TOP 5 `e`.`EmployeeID`, `e`.`City`, `e`.`Title` + SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Title` FROM `Employees` AS `e` ORDER BY `e`.`City` ) AS `e0` ON `c`.`City` = `e0`.`City` @@ -977,20 +1050,11 @@ ORDER BY [o].[OrderID] """); } - public override async Task GroupJoin_on_true_equal_true(bool async) + public override async Task Join_with_key_selectors_being_nested_anonymous_objects(bool async) { - await base.GroupJoin_on_true_equal_true(async); + await base.Join_with_key_selectors_being_nested_anonymous_objects(async); - AssertSql( - """ -SELECT [c].[CustomerID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] -FROM [Customers] AS [c] -OUTER APPLY ( - SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] - FROM [Orders] AS [o] -) AS [o0] -ORDER BY [c].[CustomerID] -"""); + AssertSql(); } private void AssertSql(params string[] expected) diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindKeylessEntitiesQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindKeylessEntitiesQueryJetTest.cs index c07cf0ee..1f16e9cc 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindKeylessEntitiesQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindKeylessEntitiesQueryJetTest.cs @@ -180,8 +180,8 @@ public override async Task Collection_correlated_with_keyless_entity_in_predicat await base.Collection_correlated_with_keyless_entity_in_predicate_works(async); AssertSql( -""" -SELECT TOP 2 `m`.`City`, `m`.`ContactName` + """ +SELECT TOP @p `m`.`City`, `m`.`ContactName` FROM ( SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] ) AS `m` @@ -257,7 +257,7 @@ public override async Task Count_over_keyless_entity_with_pushdown(bool async) """ SELECT COUNT(*) FROM ( - SELECT TOP 10 1 + SELECT TOP @p 1 FROM ( SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] ) AS `m` @@ -274,7 +274,7 @@ public override async Task Count_over_keyless_entity_with_pushdown_empty_project """ SELECT COUNT(*) FROM ( - SELECT TOP 10 1 + SELECT TOP @p 1 FROM ( SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] ) AS `m` diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs index b8f6d7fa..c32cd8ce 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs @@ -77,7 +77,7 @@ public override async Task Lifting_when_subquery_nested_order_by_anonymous(bool INNER JOIN ( SELECT DISTINCT `c1`.`CustomerID` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, @@ -98,7 +98,7 @@ public override async Task Lifting_when_subquery_nested_order_by_simple(bool isA INNER JOIN ( SELECT DISTINCT `c1`.`CustomerID` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, @@ -153,13 +153,13 @@ public override async Task Local_dictionary(bool isAsync) await base.Local_dictionary(isAsync); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='ALFKI' (Size = 5)")} - - SELECT TOP 2 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__p_0")} - """); + """ +@p='ALFKI' (Size = 5) + +SELECT TOP 2 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = @p +"""); } public override async Task Entity_equality_self(bool isAsync) @@ -178,13 +178,13 @@ public override async Task Entity_equality_local(bool isAsync) await base.Entity_equality_local(isAsync); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__entity_equality_local_0_CustomerID='ANATR' (Size = 5)")} - - SELECT `c`.`CustomerID` - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__entity_equality_local_0_CustomerID")} - """); + """ +@entity_equality_local_CustomerID='ANATR' (Size = 5) + +SELECT `c`.`CustomerID` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = @entity_equality_local_CustomerID +"""); } public override async Task Entity_equality_local_composite_key(bool isAsync) @@ -192,14 +192,14 @@ public override async Task Entity_equality_local_composite_key(bool isAsync) await base.Entity_equality_local_composite_key(isAsync); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__entity_equality_local_0_OrderID='10248' (Nullable = true)")} - {AssertSqlHelper.Declaration("@__entity_equality_local_0_ProductID='11' (Nullable = true)")} - - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`OrderID` = {AssertSqlHelper.Parameter("@__entity_equality_local_0_OrderID")} AND `o`.`ProductID` = {AssertSqlHelper.Parameter("@__entity_equality_local_0_ProductID")} - """); + """ +@entity_equality_local_OrderID='10248' (Nullable = true) +@entity_equality_local_ProductID='11' (Nullable = true) + +SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` +FROM `Order Details` AS `o` +WHERE `o`.`OrderID` = @entity_equality_local_OrderID AND `o`.`ProductID` = @entity_equality_local_ProductID +"""); } public override async Task Entity_equality_local_double_check(bool isAsync) @@ -207,14 +207,14 @@ public override async Task Entity_equality_local_double_check(bool isAsync) await base.Entity_equality_local_double_check(isAsync); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__entity_equality_local_0_CustomerID='ANATR' (Size = 5)")} - {AssertSqlHelper.Declaration("@__entity_equality_local_0_CustomerID='ANATR' (Size = 5)")} - - SELECT `c`.`CustomerID` - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__entity_equality_local_0_CustomerID")} AND {AssertSqlHelper.Parameter("@__entity_equality_local_0_CustomerID")} = `c`.`CustomerID` - """); + """ +@entity_equality_local_CustomerID='ANATR' (Size = 5) +@entity_equality_local_CustomerID='ANATR' (Size = 5) + +SELECT `c`.`CustomerID` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = @entity_equality_local_CustomerID AND @entity_equality_local_CustomerID = `c`.`CustomerID` +"""); } public override async Task Join_with_entity_equality_local_on_both_sources(bool isAsync) @@ -222,18 +222,18 @@ public override async Task Join_with_entity_equality_local_on_both_sources(bool await base.Join_with_entity_equality_local_on_both_sources(isAsync); AssertSql( - $""" -@__entity_equality_local_0_CustomerID='ANATR' (Size = 5) -@__entity_equality_local_0_CustomerID='ANATR' (Size = 5) + """ +@entity_equality_local_CustomerID='ANATR' (Size = 5) +@entity_equality_local_CustomerID='ANATR' (Size = 5) SELECT `c`.`CustomerID` FROM `Customers` AS `c` INNER JOIN ( SELECT `c0`.`CustomerID` FROM `Customers` AS `c0` - WHERE `c0`.`CustomerID` = {AssertSqlHelper.Parameter("@__entity_equality_local_0_CustomerID")} + WHERE `c0`.`CustomerID` = @entity_equality_local_CustomerID ) AS `c1` ON `c`.`CustomerID` = `c1`.`CustomerID` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__entity_equality_local_0_CustomerID")} +WHERE `c`.`CustomerID` = @entity_equality_local_CustomerID """); } @@ -544,7 +544,7 @@ public override async Task Where_query_composition_is_null(bool isAsync) """ SELECT `e1`.`EmployeeID`, `e1`.`City`, `e1`.`Country`, `e1`.`FirstName`, `e1`.`ReportsTo`, `e1`.`Title` FROM ( - SELECT TOP 3 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` + SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` ) AS `e1` @@ -564,9 +564,9 @@ public override async Task Where_query_composition_is_not_null(bool isAsync) """ SELECT `e1`.`EmployeeID`, `e1`.`City`, `e1`.`Country`, `e1`.`FirstName`, `e1`.`ReportsTo`, `e1`.`Title` FROM ( - SELECT TOP 3 `e2`.`EmployeeID`, `e2`.`City`, `e2`.`Country`, `e2`.`FirstName`, `e2`.`ReportsTo`, `e2`.`Title` + SELECT TOP @p0 `e2`.`EmployeeID`, `e2`.`City`, `e2`.`Country`, `e2`.`FirstName`, `e2`.`ReportsTo`, `e2`.`Title` FROM ( - SELECT TOP 7 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` + SELECT TOP @p + @p0 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` ) AS `e2` @@ -769,7 +769,7 @@ public override async Task Where_query_composition2(bool isAsync) """ SELECT `e1`.`EmployeeID`, `e1`.`City`, `e1`.`Country`, `e1`.`FirstName`, `e1`.`ReportsTo`, `e1`.`Title` FROM ( - SELECT TOP 3 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` + SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` ) AS `e1` WHERE `e1`.`FirstName` = ( @@ -856,17 +856,17 @@ public override async Task Select_Where_Subquery_Deep_Single(bool isAsync) await base.Select_Where_Subquery_Deep_Single(isAsync); AssertSql( - $""" - SELECT TOP 2 `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE `o`.`OrderID` = 10344 AND ( - SELECT TOP 1 ( - SELECT TOP 1 `c`.`City` - FROM `Customers` AS `c` - WHERE `o0`.`CustomerID` = `c`.`CustomerID`) - FROM `Orders` AS `o0` - WHERE `o`.`OrderID` = `o0`.`OrderID`) = 'Seattle' - """); + """ +SELECT TOP @p `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` +FROM `Order Details` AS `o` +WHERE `o`.`OrderID` = 10344 AND ( + SELECT TOP 1 ( + SELECT TOP 1 `c`.`City` + FROM `Customers` AS `c` + WHERE `o0`.`CustomerID` = `c`.`CustomerID`) + FROM `Orders` AS `o0` + WHERE `o`.`OrderID` = `o0`.`OrderID`) = 'Seattle' +"""); } public override async Task Select_Where_Subquery_Deep_First(bool isAsync) @@ -874,17 +874,17 @@ public override async Task Select_Where_Subquery_Deep_First(bool isAsync) await base.Select_Where_Subquery_Deep_First(isAsync); AssertSql( - $""" - SELECT TOP 2 `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM `Order Details` AS `o` - WHERE ( - SELECT TOP 1 ( - SELECT TOP 1 `c`.`City` - FROM `Customers` AS `c` - WHERE `o0`.`CustomerID` = `c`.`CustomerID`) - FROM `Orders` AS `o0` - WHERE `o`.`OrderID` = `o0`.`OrderID`) = 'Seattle' - """); + """ +SELECT TOP @p `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` +FROM `Order Details` AS `o` +WHERE ( + SELECT TOP 1 ( + SELECT TOP 1 `c`.`City` + FROM `Customers` AS `c` + WHERE `o0`.`CustomerID` = `c`.`CustomerID`) + FROM `Orders` AS `o0` + WHERE `o`.`OrderID` = `o0`.`OrderID`) = 'Seattle' +"""); } public override async Task Select_Where_Subquery_Equality(bool isAsync) @@ -895,7 +895,7 @@ public override async Task Select_Where_Subquery_Equality(bool isAsync) """ SELECT `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 1 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o3` @@ -937,7 +937,7 @@ public override async Task Where_subquery_anon(bool isAsync) """ SELECT `e0`.`EmployeeID`, `e0`.`City`, `e0`.`Country`, `e0`.`FirstName`, `e0`.`ReportsTo`, `e0`.`Title`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM ( - SELECT TOP 3 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` + SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` ) AS `e0`, @@ -959,7 +959,7 @@ public override async Task Where_subquery_anon_nested(bool isAsync) """ SELECT `e0`.`EmployeeID`, `e0`.`City`, `e0`.`Country`, `e0`.`FirstName`, `e0`.`ReportsTo`, `e0`.`Title`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` FROM ( - SELECT TOP 3 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` + SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` ) AS `e0`, @@ -1121,9 +1121,9 @@ public override async Task Skip_Take(bool isAsync) """ SELECT `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` FROM ( - SELECT TOP 10 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` + SELECT TOP @p0 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` FROM ( - SELECT TOP 15 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p + @p0 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactName` ) AS `c0` @@ -1141,9 +1141,9 @@ public override async Task Join_Customers_Orders_Skip_Take(bool isAsync) """ SELECT `s0`.`ContactName`, `s0`.`OrderID` FROM ( - SELECT TOP 5 `s`.`ContactName`, `s`.`OrderID` + SELECT TOP @p0 `s`.`ContactName`, `s`.`OrderID` FROM ( - SELECT TOP 15 `c`.`ContactName`, `o`.`OrderID` + SELECT TOP @p + @p0 `c`.`ContactName`, `o`.`OrderID` FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` ORDER BY `o`.`OrderID` @@ -1162,9 +1162,9 @@ public override async Task Join_Customers_Orders_Skip_Take_followed_by_constant_ """ SELECT `s0`.`c` FROM ( - SELECT TOP 5 `s`.`c`, `s`.`OrderID` + SELECT TOP @p0 `s`.`c`, `s`.`OrderID` FROM ( - SELECT TOP 15 'Foo' AS `c`, `o`.`OrderID` + SELECT TOP @p + @p0 'Foo' AS `c`, `o`.`OrderID` FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` ORDER BY `o`.`OrderID` @@ -1183,9 +1183,9 @@ public override async Task Join_Customers_Orders_Projection_With_String_Concat_S """ SELECT `s0`.`Contact`, `s0`.`OrderID` FROM ( - SELECT TOP 5 `s`.`Contact`, `s`.`OrderID` + SELECT TOP @p0 `s`.`Contact`, `s`.`OrderID` FROM ( - SELECT TOP 15 (IIF(`c`.`ContactName` IS NULL, '', `c`.`ContactName`) & ' ') & IIF(`c`.`ContactTitle` IS NULL, '', `c`.`ContactTitle`) AS `Contact`, `o`.`OrderID` + SELECT TOP @p + @p0 (IIF(`c`.`ContactName` IS NULL, '', `c`.`ContactName`) & ' ') & IIF(`c`.`ContactTitle` IS NULL, '', `c`.`ContactTitle`) AS `Contact`, `o`.`OrderID` FROM `Customers` AS `c` INNER JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` ORDER BY `o`.`OrderID` @@ -1204,9 +1204,9 @@ public override async Task Join_Customers_Orders_Orders_Skip_Take_Same_Propertie """ SELECT `s0`.`OrderID`, `s0`.`CustomerIDA`, `s0`.`CustomerIDB`, `s0`.`ContactNameA`, `s0`.`ContactNameB` FROM ( - SELECT TOP 5 `s`.`OrderID`, `s`.`CustomerIDA`, `s`.`CustomerIDB`, `s`.`ContactNameA`, `s`.`ContactNameB` + SELECT TOP @p0 `s`.`OrderID`, `s`.`CustomerIDA`, `s`.`CustomerIDB`, `s`.`ContactNameA`, `s`.`ContactNameB` FROM ( - SELECT TOP 15 `o`.`OrderID`, `c`.`CustomerID` AS `CustomerIDA`, `c0`.`CustomerID` AS `CustomerIDB`, `c`.`ContactName` AS `ContactNameA`, `c0`.`ContactName` AS `ContactNameB` + SELECT TOP @p + @p0 `o`.`OrderID`, `c`.`CustomerID` AS `CustomerIDA`, `c0`.`CustomerID` AS `CustomerIDB`, `c`.`ContactName` AS `ContactNameA`, `c0`.`ContactName` AS `ContactNameB` FROM (`Orders` AS `o` INNER JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID`) INNER JOIN `Customers` AS `c0` ON `o`.`CustomerID` = `c0`.`CustomerID` @@ -1337,7 +1337,7 @@ SELECT COUNT(*) FROM ( SELECT DISTINCT `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM ( - SELECT TOP 5 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ) AS `o0` ) AS `o1` @@ -1354,7 +1354,7 @@ SELECT COUNT(*) FROM ( SELECT DISTINCT `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM ( - SELECT TOP 5 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` WHERE `o`.`CustomerID` = 'FRANK' ) AS `o0` @@ -1400,10 +1400,10 @@ public override async Task Queryable_simple_anonymous_projection_subquery(bool i await base.Queryable_simple_anonymous_projection_subquery(isAsync); AssertSql( - $""" - SELECT TOP 91 `c`.`City` - FROM `Customers` AS `c` - """); + """ +SELECT TOP @p `c`.`City` +FROM `Customers` AS `c` +"""); } public override async Task Queryable_simple_anonymous_subquery(bool isAsync) @@ -1411,10 +1411,10 @@ public override async Task Queryable_simple_anonymous_subquery(bool isAsync) await base.Queryable_simple_anonymous_subquery(isAsync); AssertSql( - $""" - SELECT TOP 91 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - """); + """ +SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +"""); } public override async Task Take_simple(bool isAsync) @@ -1422,11 +1422,11 @@ public override async Task Take_simple(bool isAsync) await base.Take_simple(isAsync); AssertSql( - $""" - SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - ORDER BY `c`.`CustomerID` - """); + """ +SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +ORDER BY `c`.`CustomerID` +"""); } public override async Task Take_simple_parameterized(bool isAsync) @@ -1434,11 +1434,11 @@ public override async Task Take_simple_parameterized(bool isAsync) await base.Take_simple_parameterized(isAsync); AssertSql( - $""" - SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - ORDER BY `c`.`CustomerID` - """); + """ +SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +ORDER BY `c`.`CustomerID` +"""); } public override async Task Take_simple_projection(bool isAsync) @@ -1446,11 +1446,11 @@ public override async Task Take_simple_projection(bool isAsync) await base.Take_simple_projection(isAsync); AssertSql( - $""" - SELECT TOP 10 `c`.`City` - FROM `Customers` AS `c` - ORDER BY `c`.`CustomerID` - """); + """ +SELECT TOP @p `c`.`City` +FROM `Customers` AS `c` +ORDER BY `c`.`CustomerID` +"""); } public override async Task Take_subquery_projection(bool isAsync) @@ -1458,11 +1458,11 @@ public override async Task Take_subquery_projection(bool isAsync) await base.Take_subquery_projection(isAsync); AssertSql( - $""" - SELECT TOP 2 `c`.`City` - FROM `Customers` AS `c` - ORDER BY `c`.`CustomerID` - """); + """ +SELECT TOP @p `c`.`City` +FROM `Customers` AS `c` +ORDER BY `c`.`CustomerID` +"""); } public override async Task OrderBy_Take_Count(bool isAsync) @@ -1473,7 +1473,7 @@ public override async Task OrderBy_Take_Count(bool isAsync) """ SELECT COUNT(*) FROM ( - SELECT TOP 5 1 + SELECT TOP @p 1 FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0` @@ -1488,7 +1488,7 @@ public override async Task Take_OrderBy_Count(bool isAsync) """ SELECT COUNT(*) FROM ( - SELECT TOP 5 1 + SELECT TOP @p 1 FROM `Orders` AS `o` ) AS `o0` """); @@ -1802,14 +1802,14 @@ public override async Task Where_select_many_or_with_parameter(bool isAsync) await base.Where_select_many_or_with_parameter(isAsync); AssertSql( -$""" -@__london_0='London' (Size = 15) -@__lisboa_1='Lisboa' (Size = 15) + """ +@london='London' (Size = 15) +@lisboa='Lisboa' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Customers` AS `c`, `Employees` AS `e` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__london_0")} OR `c`.`City` = 'Berlin' OR `c`.`City` = 'Seattle' OR `c`.`City` = {AssertSqlHelper.Parameter("@__lisboa_1")} +WHERE `c`.`City` = @london OR `c`.`City` = 'Berlin' OR `c`.`City` = 'Seattle' OR `c`.`City` = @lisboa """); } @@ -1821,7 +1821,7 @@ public override async Task SelectMany_simple_subquery(bool isAsync) """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `e0`.`EmployeeID`, `e0`.`City`, `e0`.`Country`, `e0`.`FirstName`, `e0`.`ReportsTo`, `e0`.`Title` FROM ( - SELECT TOP 9 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` + SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` ) AS `e0`, `Customers` AS `c` @@ -2218,9 +2218,9 @@ public override async Task Distinct_Skip_Take(bool isAsync) """ SELECT `c2`.`CustomerID`, `c2`.`Address`, `c2`.`City`, `c2`.`CompanyName`, `c2`.`ContactName`, `c2`.`ContactTitle`, `c2`.`Country`, `c2`.`Fax`, `c2`.`Phone`, `c2`.`PostalCode`, `c2`.`Region` FROM ( - SELECT TOP 10 `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` + SELECT TOP @p0 `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` FROM ( - SELECT TOP 15 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` + SELECT TOP @p + @p0 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` FROM ( SELECT DISTINCT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` @@ -2261,9 +2261,9 @@ public override async Task Skip_Take_Distinct(bool isAsync) FROM ( SELECT `c2`.`CustomerID`, `c2`.`Address`, `c2`.`City`, `c2`.`CompanyName`, `c2`.`ContactName`, `c2`.`ContactTitle`, `c2`.`Country`, `c2`.`Fax`, `c2`.`Phone`, `c2`.`PostalCode`, `c2`.`Region` FROM ( - SELECT TOP 10 `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` + SELECT TOP @p0 `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` FROM ( - SELECT TOP 15 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p + @p0 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactName` ) AS `c1` @@ -2283,9 +2283,9 @@ public override async Task Skip_Take_Any(bool isAsync) SELECT IIF(EXISTS ( SELECT 1 FROM ( - SELECT TOP 10 `c0`.`ContactName` + SELECT TOP @p0 `c0`.`ContactName` FROM ( - SELECT TOP 15 `c`.`ContactName` + SELECT TOP @p + @p0 `c`.`ContactName` FROM `Customers` AS `c` ORDER BY `c`.`ContactName` ) AS `c0` @@ -2307,9 +2307,9 @@ SELECT 1 FROM ( SELECT `c2`.`CustomerID` FROM ( - SELECT TOP 7 `c1`.`CustomerID` + SELECT TOP @p0 `c1`.`CustomerID` FROM ( - SELECT TOP 11 `c`.`CustomerID` + SELECT TOP @p + @p0 `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1` @@ -2331,7 +2331,7 @@ public override async Task Take_All(bool isAsync) SELECT IIF(NOT EXISTS ( SELECT 1 FROM ( - SELECT TOP 4 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` @@ -2351,9 +2351,9 @@ SELECT 1 FROM ( SELECT `c2`.`CustomerID` FROM ( - SELECT TOP 7 `c1`.`CustomerID` + SELECT TOP @p0 `c1`.`CustomerID` FROM ( - SELECT TOP 12 `c`.`CustomerID` + SELECT TOP @p + @p0 `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1` @@ -2375,7 +2375,7 @@ public override async Task Take_Any_with_predicate(bool isAsync) SELECT IIF(EXISTS ( SELECT 1 FROM ( - SELECT TOP 5 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` @@ -2459,7 +2459,7 @@ public override async Task Distinct_Take(bool isAsync) AssertSql( """ -SELECT TOP 5 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` +SELECT TOP @p `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM ( SELECT DISTINCT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` @@ -2476,7 +2476,7 @@ public override async Task Distinct_Take_Count(bool isAsync) """ SELECT COUNT(*) FROM ( - SELECT DISTINCT TOP 5 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT DISTINCT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ) AS `o0` """); @@ -2858,6 +2858,41 @@ ORDER BY IIF(`c`.`Region` IS NULL, 'ZZ', `c`.`Region`), `c`.`CustomerID` """); } + public override async Task Coalesce_Correct_Multiple_Same_TypeMapping(bool async) + { + await base.Coalesce_Correct_Multiple_Same_TypeMapping(async); + + AssertSql( + """ +SELECT IIF((IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) + 1) IS NULL, IIF((IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) + 2) IS NULL, IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) + 3, IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) + 2), IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) + 1) +FROM `Employees` AS `e` +ORDER BY `e`.`EmployeeID` +"""); + } + + public override async Task Coalesce_Correct_TypeMapping_Double(bool async) + { + await base.Coalesce_Correct_TypeMapping_Double(async); + + AssertSql( + """ +SELECT COALESCE([e].[ReportsTo], 2.25) +FROM [Employees] AS [e] +"""); + } + + public override async Task Coalesce_Correct_TypeMapping_String(bool async) + { + await base.Coalesce_Correct_TypeMapping_String(async); + + AssertSql( + """ +SELECT IIF(`c`.`Region` IS NULL, 'no region specified', `c`.`Region`) +FROM `Customers` AS `c` +ORDER BY `c`.`CustomerID` +"""); + } + public override async Task Null_Coalesce_Short_Circuit(bool isAsync) { await base.Null_Coalesce_Short_Circuit(isAsync); @@ -3042,78 +3077,18 @@ ORDER BY IIF(`c`.`Region` IS NULL, 'ZZ', `c`.`Region`) """); } - public override async Task DateTime_parse_is_inlined(bool isAsync) - { - await base.DateTime_parse_is_inlined(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE `o`.`OrderDate` > #1998-01-01 12:00:00# - """); - } - - public override async Task DateTime_parse_is_parameterized_when_from_closure(bool isAsync) - { - await base.DateTime_parse_is_parameterized_when_from_closure(isAsync); - - AssertSql( - $""" - {AssertSqlHelper.Declaration("@__Parse_0='1998-01-01T12:00:00.0000000' (Nullable = true) (DbType = DateTime)")} - - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE `o`.`OrderDate` > CDATE({AssertSqlHelper.Parameter("@__Parse_0")}) - """); - } - - public override async Task New_DateTime_is_inlined(bool isAsync) - { - await base.New_DateTime_is_inlined(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE `o`.`OrderDate` > #1998-01-01 12:00:00# - """); - } - - public override async Task New_DateTime_is_parameterized_when_from_closure(bool isAsync) - { - await base.New_DateTime_is_parameterized_when_from_closure(isAsync); - - AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='1998-01-01T12:00:00.0000000' (Nullable = true) (DbType = DateTime)")} - - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE `o`.`OrderDate` > CDATE({AssertSqlHelper.Parameter("@__p_0")}) - """, - // - $""" - {AssertSqlHelper.Declaration("@__p_0='1998-01-01T11:00:00.0000000' (Nullable = true) (DbType = DateTime)")} - - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE `o`.`OrderDate` > CDATE({AssertSqlHelper.Parameter("@__p_0")}) - """); - } - public override async Task Environment_newline_is_funcletized(bool isAsync) { await base.Environment_newline_is_funcletized(isAsync); AssertSql( - $""" -@__NewLine_0_contains='% + """ +@NewLine_contains='% %' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` LIKE {AssertSqlHelper.Parameter("@__NewLine_0_contains")} +WHERE `c`.`CustomerID` LIKE @NewLine_contains """); } @@ -3144,10 +3119,10 @@ public override async Task Concat_parameter_string_int(bool async) await base.Concat_parameter_string_int(async); AssertSql( - $""" -@__parameter_0='-' (Size = 255) + """ +@parameter='-' (Size = 255) -SELECT {AssertSqlHelper.Parameter("@__parameter_0")} & (`o`.`OrderID` & '') +SELECT @parameter & (`o`.`OrderID` & '') FROM `Orders` AS `o` """); } @@ -3187,176 +3162,6 @@ public override async Task String_concat_with_navigation2(bool isAsync) """); } - public override async Task Select_bitwise_or(bool async) - { - await base.Select_bitwise_or(async); - - AssertSql( - """ -SELECT `c`.`CustomerID`, IIF(`c`.`CustomerID` IN ('ALFKI', 'ANATR'), TRUE, FALSE) AS `Value` -FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` -"""); - } - - public override async Task Select_bitwise_or_multiple(bool async) - { - await base.Select_bitwise_or_multiple(async); - - AssertSql( - """ -SELECT `c`.`CustomerID`, IIF(`c`.`CustomerID` IN ('ALFKI', 'ANATR', 'ANTON'), TRUE, FALSE) AS `Value` -FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` -"""); - } - - public override async Task Select_bitwise_and(bool async) - { - await base.Select_bitwise_and(async); - - AssertSql( - """ -SELECT `c`.`CustomerID`, FALSE AS `Value` -FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` -"""); - } - - public override async Task Select_bitwise_and_or(bool async) - { - await base.Select_bitwise_and_or(async); - - AssertSql( - """ -SELECT `c`.`CustomerID`, IIF(`c`.`CustomerID` = 'ANTON', TRUE, FALSE) AS `Value` -FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` -"""); - } - - public override async Task Where_bitwise_or_with_logical_or(bool isAsync) - { - await base.Where_bitwise_or_with_logical_or(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` IN ('ALFKI', 'ANATR', 'ANTON') -"""); - } - - public override async Task Where_bitwise_and_with_logical_and(bool isAsync) - { - await base.Where_bitwise_and_with_logical_and(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE 0 = 1 -"""); - } - - public override async Task Where_bitwise_or_with_logical_and(bool isAsync) - { - await base.Where_bitwise_or_with_logical_and(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` IN ('ALFKI', 'ANATR') AND `c`.`Country` = 'Germany' -"""); - } - - public override async Task Where_bitwise_and_with_logical_or(bool isAsync) - { - await base.Where_bitwise_and_with_logical_or(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = 'ANTON' -"""); - } - - public override async Task Where_bitwise_binary_not(bool isAsync) - { - await base.Where_bitwise_binary_not(isAsync); - - AssertSql( - $""" -@__negatedId_0='-10249' - -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE (BNOT`o`.`OrderID`) = {AssertSqlHelper.Parameter("@__negatedId_0")} -"""); - } - - public override async Task Where_bitwise_binary_and(bool isAsync) - { - await base.Where_bitwise_binary_and(isAsync); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE (`o`.`OrderID` BAND 10248) = 10248 -"""); - } - - public override async Task Where_bitwise_binary_or(bool isAync) - { - await base.Where_bitwise_binary_or(isAync); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE (`o`.`OrderID` BOR 10248) = 10248 -"""); - } - - public override async Task Where_bitwise_binary_xor(bool async) - { - await base.Where_bitwise_binary_xor(async); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE (`o`.`OrderID` BXOR 1) = 10249 -"""); - } - - public override async Task Select_bitwise_or_with_logical_or(bool async) - { - await base.Select_bitwise_or_with_logical_or(async); - - AssertSql( - """ -SELECT `c`.`CustomerID`, IIF(`c`.`CustomerID` IN ('ALFKI', 'ANATR', 'ANTON'), TRUE, FALSE) AS `Value` -FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` -"""); - } - - public override async Task Select_bitwise_and_with_logical_and(bool async) - { - await base.Select_bitwise_and_with_logical_and(async); - - AssertSql( - """ -SELECT `c`.`CustomerID`, FALSE AS `Value` -FROM `Customers` AS `c` -ORDER BY `c`.`CustomerID` -"""); - } - public override async Task Handle_materialization_properly_when_more_than_two_query_sources_are_involved(bool isAsync) { await base.Handle_materialization_properly_when_more_than_two_query_sources_are_involved(isAsync); @@ -3376,16 +3181,16 @@ public override async Task Parameter_extraction_short_circuits_1(bool isAsync) await base.Parameter_extraction_short_circuits_1(isAsync); AssertSql( -$""" -@__dateFilter_Value_Month_0='7' -@__dateFilter_Value_Year_1='1996' + """ +@dateFilter_Value_Month='7' +@dateFilter_Value_Year='1996' SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`OrderID` < 10400 AND `o`.`OrderDate` IS NOT NULL AND DATEPART('m', `o`.`OrderDate`) = {AssertSqlHelper.Parameter("@__dateFilter_Value_Month_0")} AND DATEPART('yyyy', `o`.`OrderDate`) = {AssertSqlHelper.Parameter("@__dateFilter_Value_Year_1")} +WHERE `o`.`OrderID` < 10400 AND `o`.`OrderDate` IS NOT NULL AND DATEPART('m', `o`.`OrderDate`) = @dateFilter_Value_Month AND DATEPART('yyyy', `o`.`OrderDate`) = @dateFilter_Value_Year """, -// -""" + // + """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` WHERE `o`.`OrderID` < 10400 @@ -3397,16 +3202,16 @@ public override async Task Parameter_extraction_short_circuits_2(bool isAsync) await base.Parameter_extraction_short_circuits_2(isAsync); AssertSql( -$""" -@__dateFilter_Value_Month_0='7' -@__dateFilter_Value_Year_1='1996' + """ +@dateFilter_Value_Month='7' +@dateFilter_Value_Year='1996' SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`OrderID` < 10400 AND `o`.`OrderDate` IS NOT NULL AND DATEPART('m', `o`.`OrderDate`) = {AssertSqlHelper.Parameter("@__dateFilter_Value_Month_0")} AND DATEPART('yyyy', `o`.`OrderDate`) = {AssertSqlHelper.Parameter("@__dateFilter_Value_Year_1")} +WHERE `o`.`OrderID` < 10400 AND `o`.`OrderDate` IS NOT NULL AND DATEPART('m', `o`.`OrderDate`) = @dateFilter_Value_Month AND DATEPART('yyyy', `o`.`OrderDate`) = @dateFilter_Value_Year """, -// -""" + // + """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` WHERE 0 = 1 @@ -3418,16 +3223,16 @@ public override async Task Parameter_extraction_short_circuits_3(bool isAsync) await base.Parameter_extraction_short_circuits_3(isAsync); AssertSql( -$""" -@__dateFilter_Value_Month_0='7' -@__dateFilter_Value_Year_1='1996' + """ +@dateFilter_Value_Month='7' +@dateFilter_Value_Year='1996' SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`OrderID` < 10400 OR (`o`.`OrderDate` IS NOT NULL AND DATEPART('m', `o`.`OrderDate`) = {AssertSqlHelper.Parameter("@__dateFilter_Value_Month_0")} AND DATEPART('yyyy', `o`.`OrderDate`) = {AssertSqlHelper.Parameter("@__dateFilter_Value_Year_1")}) +WHERE `o`.`OrderID` < 10400 OR (`o`.`OrderDate` IS NOT NULL AND DATEPART('m', `o`.`OrderDate`) = @dateFilter_Value_Month AND DATEPART('yyyy', `o`.`OrderDate`) = @dateFilter_Value_Year) """, -// -""" + // + """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` """); @@ -3449,7 +3254,7 @@ SELECT TOP 1 `c`.`City` FROM `Customers` AS `c` WHERE `c`.`CustomerID` = `o0`.`CustomerID`) AS `c` FROM ( - SELECT TOP 3 `o`.`OrderID`, `o`.`CustomerID` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0` @@ -3474,7 +3279,7 @@ SELECT TOP 1 `c`.`City` FROM `Customers` AS `c` WHERE `c`.`CustomerID` = `o0`.`CustomerID`) AS `c` FROM ( - SELECT TOP 3 `o`.`OrderID`, `o`.`CustomerID` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0` @@ -3663,12 +3468,12 @@ public override async Task Select_expression_references_are_updated_correctly_wi await base.Select_expression_references_are_updated_correctly_with_subquery(isAsync); AssertSql( -$""" -@__nextYear_0='2017' + """ +@nextYear='2017' SELECT DISTINCT DATEPART('yyyy', `o`.`OrderDate`) FROM `Orders` AS `o` -WHERE `o`.`OrderDate` IS NOT NULL AND DATEPART('yyyy', `o`.`OrderDate`) < {AssertSqlHelper.Parameter("@__nextYear_0")} +WHERE `o`.`OrderDate` IS NOT NULL AND DATEPART('yyyy', `o`.`OrderDate`) < @nextYear """); } @@ -3788,9 +3593,9 @@ public override async Task OrderBy_skip_take(bool isAsync) """ SELECT `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` FROM ( - SELECT TOP 8 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` + SELECT TOP @p0 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` FROM ( - SELECT TOP 13 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p + @p0 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactTitle`, `c`.`ContactName` ) AS `c0` @@ -3913,9 +3718,9 @@ public override async Task OrderBy_skip_take_distinct(bool isAsync) FROM ( SELECT `c2`.`CustomerID`, `c2`.`Address`, `c2`.`City`, `c2`.`CompanyName`, `c2`.`ContactName`, `c2`.`ContactTitle`, `c2`.`Country`, `c2`.`Fax`, `c2`.`Phone`, `c2`.`PostalCode`, `c2`.`Region` FROM ( - SELECT TOP 15 `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` + SELECT TOP @p0 `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` FROM ( - SELECT TOP 20 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p + @p0 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactTitle`, `c`.`ContactName` ) AS `c1` @@ -3934,7 +3739,7 @@ public override async Task OrderBy_coalesce_take_distinct(bool isAsync) """ SELECT DISTINCT `p0`.`ProductID`, `p0`.`Discontinued`, `p0`.`ProductName`, `p0`.`SupplierID`, `p0`.`UnitPrice`, `p0`.`UnitsInStock` FROM ( - SELECT TOP 15 `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` + SELECT TOP @p `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM `Products` AS `p` ORDER BY IIF(`p`.`UnitPrice` IS NULL, 0.0, `p`.`UnitPrice`) ) AS `p0` @@ -3951,9 +3756,9 @@ public override async Task OrderBy_coalesce_skip_take_distinct(bool isAsync) FROM ( SELECT `p2`.`ProductID`, `p2`.`Discontinued`, `p2`.`ProductName`, `p2`.`SupplierID`, `p2`.`UnitPrice`, `p2`.`UnitsInStock` FROM ( - SELECT TOP 15 `p1`.`ProductID`, `p1`.`Discontinued`, `p1`.`ProductName`, `p1`.`SupplierID`, `p1`.`UnitPrice`, `p1`.`UnitsInStock`, `p1`.`c` + SELECT TOP @p0 `p1`.`ProductID`, `p1`.`Discontinued`, `p1`.`ProductName`, `p1`.`SupplierID`, `p1`.`UnitPrice`, `p1`.`UnitsInStock`, `p1`.`c` FROM ( - SELECT TOP 20 `p3`.`ProductID`, `p3`.`Discontinued`, `p3`.`ProductName`, `p3`.`SupplierID`, `p3`.`UnitPrice`, `p3`.`UnitsInStock`, `p3`.`c` + SELECT TOP @p + @p0 `p3`.`ProductID`, `p3`.`Discontinued`, `p3`.`ProductName`, `p3`.`SupplierID`, `p3`.`UnitPrice`, `p3`.`UnitsInStock`, `p3`.`c` FROM ( SELECT `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, IIF(`p`.`UnitPrice` IS NULL, 0.0, `p`.`UnitPrice`) AS `c` FROM `Products` AS `p` @@ -3973,13 +3778,13 @@ public override async Task OrderBy_coalesce_skip_take_distinct_take(bool isAsync AssertSql( """ -SELECT DISTINCT TOP 5 `p0`.`ProductID`, `p0`.`Discontinued`, `p0`.`ProductName`, `p0`.`SupplierID`, `p0`.`UnitPrice`, `p0`.`UnitsInStock` +SELECT DISTINCT TOP @p `p0`.`ProductID`, `p0`.`Discontinued`, `p0`.`ProductName`, `p0`.`SupplierID`, `p0`.`UnitPrice`, `p0`.`UnitsInStock` FROM ( SELECT `p2`.`ProductID`, `p2`.`Discontinued`, `p2`.`ProductName`, `p2`.`SupplierID`, `p2`.`UnitPrice`, `p2`.`UnitsInStock` FROM ( - SELECT TOP 15 `p1`.`ProductID`, `p1`.`Discontinued`, `p1`.`ProductName`, `p1`.`SupplierID`, `p1`.`UnitPrice`, `p1`.`UnitsInStock`, `p1`.`c` + SELECT TOP @p0 `p1`.`ProductID`, `p1`.`Discontinued`, `p1`.`ProductName`, `p1`.`SupplierID`, `p1`.`UnitPrice`, `p1`.`UnitsInStock`, `p1`.`c` FROM ( - SELECT TOP 20 `p3`.`ProductID`, `p3`.`Discontinued`, `p3`.`ProductName`, `p3`.`SupplierID`, `p3`.`UnitPrice`, `p3`.`UnitsInStock`, `p3`.`c` + SELECT TOP @p + @p0 `p3`.`ProductID`, `p3`.`Discontinued`, `p3`.`ProductName`, `p3`.`SupplierID`, `p3`.`UnitPrice`, `p3`.`UnitsInStock`, `p3`.`c` FROM ( SELECT `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, IIF(`p`.`UnitPrice` IS NULL, 0.0, `p`.`UnitPrice`) AS `c` FROM `Products` AS `p` @@ -3999,15 +3804,15 @@ public override async Task OrderBy_skip_take_distinct_orderby_take(bool isAsync) AssertSql( """ -SELECT TOP 8 `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` +SELECT TOP @p1 `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` FROM ( SELECT DISTINCT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` FROM ( SELECT `c3`.`CustomerID`, `c3`.`Address`, `c3`.`City`, `c3`.`CompanyName`, `c3`.`ContactName`, `c3`.`ContactTitle`, `c3`.`Country`, `c3`.`Fax`, `c3`.`Phone`, `c3`.`PostalCode`, `c3`.`Region` FROM ( - SELECT TOP 15 `c2`.`CustomerID`, `c2`.`Address`, `c2`.`City`, `c2`.`CompanyName`, `c2`.`ContactName`, `c2`.`ContactTitle`, `c2`.`Country`, `c2`.`Fax`, `c2`.`Phone`, `c2`.`PostalCode`, `c2`.`Region` + SELECT TOP @p0 `c2`.`CustomerID`, `c2`.`Address`, `c2`.`City`, `c2`.`CompanyName`, `c2`.`ContactName`, `c2`.`ContactTitle`, `c2`.`Country`, `c2`.`Fax`, `c2`.`Phone`, `c2`.`PostalCode`, `c2`.`Region` FROM ( - SELECT TOP 20 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p + @p0 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactTitle`, `c`.`ContactName` ) AS `c2` @@ -4394,9 +4199,9 @@ public override async Task Include_with_orderby_skip_preserves_ordering(bool isA """ SELECT `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 5 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` + SELECT TOP @p0 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` FROM ( - SELECT TOP 45 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p + @p0 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` WHERE `c`.`CustomerID` NOT IN ('VAFFE', 'DRACD') ORDER BY `c`.`City`, `c`.`CustomerID` @@ -4460,7 +4265,7 @@ public override async Task Select_take_average(bool isAsync) """ SELECT AVG(CDBL(`o0`.`OrderID`)) FROM ( - SELECT TOP 10 `o`.`OrderID` + SELECT TOP @p `o`.`OrderID` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0` @@ -4475,7 +4280,7 @@ public override async Task Select_take_count(bool isAsync) """ SELECT COUNT(*) FROM ( - SELECT TOP 7 1 + SELECT TOP @p 1 FROM `Customers` AS `c` ) AS `c0` """); @@ -4489,7 +4294,7 @@ public override async Task Select_orderBy_take_count(bool isAsync) """ SELECT COUNT(*) FROM ( - SELECT TOP 7 1 + SELECT TOP @p 1 FROM `Customers` AS `c` ORDER BY `c`.`Country` ) AS `c0` @@ -4504,7 +4309,7 @@ public override async Task Select_take_long_count(bool isAsync) """ SELECT COUNT(*) FROM ( - SELECT TOP 7 1 + SELECT TOP @p 1 FROM `Customers` AS `c` ) AS `c0` """); @@ -4518,7 +4323,7 @@ public override async Task Select_orderBy_take_long_count(bool isAsync) """ SELECT COUNT(*) FROM ( - SELECT TOP 7 1 + SELECT TOP @p 1 FROM `Customers` AS `c` ORDER BY `c`.`Country` ) AS `c0` @@ -4533,7 +4338,7 @@ public override async Task Select_take_max(bool isAsync) """ SELECT MAX(`o0`.`OrderID`) FROM ( - SELECT TOP 10 `o`.`OrderID` + SELECT TOP @p `o`.`OrderID` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0` @@ -4548,7 +4353,7 @@ public override async Task Select_take_min(bool isAsync) """ SELECT MIN(`o0`.`OrderID`) FROM ( - SELECT TOP 10 `o`.`OrderID` + SELECT TOP @p `o`.`OrderID` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0` @@ -4563,7 +4368,7 @@ public override async Task Select_take_sum(bool isAsync) """ SELECT IIF(SUM(`o0`.`OrderID`) IS NULL, 0, SUM(`o0`.`OrderID`)) FROM ( - SELECT TOP 10 `o`.`OrderID` + SELECT TOP @p `o`.`OrderID` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0` @@ -4762,11 +4567,8 @@ public override async Task Select_distinct_max(bool isAsync) AssertSql( """ -SELECT MAX(`o0`.`OrderID`) -FROM ( - SELECT DISTINCT `o`.`OrderID` - FROM `Orders` AS `o` -) AS `o0` +SELECT MAX(`o`.`OrderID`) +FROM `Orders` AS `o` """); } @@ -4776,11 +4578,8 @@ public override async Task Select_distinct_min(bool isAsync) AssertSql( """ -SELECT MIN(`o0`.`OrderID`) -FROM ( - SELECT DISTINCT `o`.`OrderID` - FROM `Orders` AS `o` -) AS `o0` +SELECT MIN(`o`.`OrderID`) +FROM `Orders` AS `o` """); } @@ -4803,12 +4602,12 @@ public override async Task Comparing_to_fixed_string_parameter(bool isAsync) await base.Comparing_to_fixed_string_parameter(isAsync); AssertSql( - $""" -@__prefix_0_startswith='A%' (Size = 5) + """ +@prefix_startswith='A%' (Size = 5) SELECT `c`.`CustomerID` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` LIKE {AssertSqlHelper.Parameter("@__prefix_0_startswith")} +WHERE `c`.`CustomerID` LIKE @prefix_startswith """); } @@ -5066,9 +4865,9 @@ public override async Task OrderBy_Dto_projection_skip_take(bool isAsync) """ SELECT `c1`.`Id` FROM ( - SELECT TOP 10 `c0`.`Id` + SELECT TOP @p0 `c0`.`Id` FROM ( - SELECT TOP 15 `c`.`CustomerID` AS `Id` + SELECT TOP @p + @p0 `c`.`CustomerID` AS `Id` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` @@ -5086,7 +4885,7 @@ public override async Task Join_take_count_works(bool isAsync) """ SELECT COUNT(*) FROM ( - SELECT TOP 5 1 + SELECT TOP @p 1 FROM `Orders` AS `o` INNER JOIN ( SELECT `c`.`CustomerID` @@ -5293,9 +5092,9 @@ public override async Task OrderBy_object_type_server_evals(bool isAsync) """ SELECT `s0`.`OrderID`, `s0`.`CustomerID`, `s0`.`EmployeeID`, `s0`.`OrderDate` FROM ( - SELECT TOP 20 `s`.`OrderID`, `s`.`CustomerID`, `s`.`EmployeeID`, `s`.`OrderDate`, `s`.`CustomerID0`, `s`.`City` + SELECT TOP @p0 `s`.`OrderID`, `s`.`CustomerID`, `s`.`EmployeeID`, `s`.`OrderDate`, `s`.`CustomerID0`, `s`.`City` FROM ( - SELECT TOP 20 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c`.`CustomerID` AS `CustomerID0`, `c`.`City` + SELECT TOP @p + @p0 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c`.`CustomerID` AS `CustomerID0`, `c`.`City` FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` ORDER BY `o`.`OrderID`, `o`.`OrderDate`, `c`.`CustomerID`, `c`.`City` @@ -5438,7 +5237,7 @@ public override async Task Projection_take_projection(bool async) """ SELECT `c`.`City` FROM ( - SELECT TOP 10 `o`.`OrderID`, `o`.`CustomerID` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID` FROM `Orders` AS `o` WHERE `o`.`OrderID` < 10300 ORDER BY `o`.`OrderID` @@ -5456,9 +5255,9 @@ public override async Task Projection_skip_take_projection(bool async) """ SELECT `c`.`City` FROM ( - SELECT TOP 10 `o1`.`OrderID`, `o1`.`CustomerID` + SELECT TOP @p0 `o1`.`OrderID`, `o1`.`CustomerID` FROM ( - SELECT TOP 15 `o`.`OrderID`, `o`.`CustomerID` + SELECT TOP @p + @p0 `o`.`OrderID`, `o`.`CustomerID` FROM `Orders` AS `o` WHERE `o`.`OrderID` < 10300 ORDER BY `o`.`OrderID` @@ -5499,7 +5298,7 @@ public override async Task Collection_projection_take(bool async) """ SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o0`.`OrderID`, `o0`.`ProductID`, `o0`.`Discount`, `o0`.`Quantity`, `o0`.`UnitPrice` FROM ( - SELECT TOP 10 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` WHERE `o`.`OrderID` < 10300 ORDER BY `o`.`OrderID` @@ -5517,9 +5316,9 @@ public override async Task Collection_projection_skip_take(bool async) """ SELECT `o2`.`OrderID`, `o2`.`CustomerID`, `o2`.`EmployeeID`, `o2`.`OrderDate`, `o0`.`OrderID`, `o0`.`ProductID`, `o0`.`Discount`, `o0`.`Quantity`, `o0`.`UnitPrice` FROM ( - SELECT TOP 10 `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate` + SELECT TOP @p0 `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate` FROM ( - SELECT TOP 15 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p + @p0 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` WHERE `o`.`OrderID` < 10300 ORDER BY `o`.`OrderID` @@ -5640,12 +5439,12 @@ public override async Task Entity_equality_with_null_coalesce_client_side(bool a await base.Entity_equality_with_null_coalesce_client_side(async); AssertSql( - $""" -@__entity_equality_a_0_CustomerID='ALFKI' (Size = 5) + """ +@entity_equality_a_CustomerID='ALFKI' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__entity_equality_a_0_CustomerID")} +WHERE `c`.`CustomerID` = @entity_equality_a_CustomerID """); } @@ -5842,17 +5641,17 @@ public override async Task Distinct_followed_by_ordering_on_condition(bool async await base.Distinct_followed_by_ordering_on_condition(async); AssertSql( - $""" -@__searchTerm_0='c' (Size = 15) -@__searchTerm_0='c' (Size = 15) + """ +@searchTerm='c' (Size = 15) +@searchTerm='c' (Size = 15) -SELECT TOP 5 `c0`.`City` +SELECT TOP @p `c0`.`City` FROM ( SELECT DISTINCT `c`.`City` FROM `Customers` AS `c` WHERE `c`.`CustomerID` NOT IN ('VAFFE', 'DRACD') ) AS `c0` -ORDER BY INSTR(1, `c0`.`City`, {AssertSqlHelper.Parameter("@__searchTerm_0")}, 1) - IIF({AssertSqlHelper.Parameter("@__searchTerm_0")} = '', 0, 1), `c0`.`City` +ORDER BY INSTR(1, `c0`.`City`, @searchTerm, 1) - IIF(@searchTerm = '', 0, 1), `c0`.`City` """); } @@ -6001,9 +5800,9 @@ ORDER BY `c1`.`CustomerID` """ SELECT `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` FROM ( - SELECT TOP 1 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` + SELECT TOP @p `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` FROM ( - SELECT TOP 2 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p + @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` @@ -6204,17 +6003,17 @@ public override async Task SelectMany_primitive_select_subquery(bool async) await base.SelectMany_primitive_select_subquery(async); AssertSql( - $""" + """ SELECT IIF(EXISTS ( SELECT 1 FROM `Employees` AS `e`), TRUE, FALSE) FROM (SELECT COUNT(*) FROM `#Dual`) """, // - $""" -@__Any_0='True' + """ +@Any='True' -SELECT CBOOL({AssertSqlHelper.Parameter("@__Any_0")}) +SELECT CBOOL(@Any) FROM `Employees` AS `e`, `Employees` AS `e0` """); @@ -6266,7 +6065,7 @@ public override async Task Take_Distinct(bool async) """ SELECT DISTINCT `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM ( - SELECT TOP 5 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0` @@ -6417,20 +6216,20 @@ public override async Task Where_Property_shadow_closure(bool async) await base.Where_Property_shadow_closure(async); AssertSql( - $""" -@__value_0='Sales Representative' (Size = 30) + """ +@value='Sales Representative' (Size = 30) SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` -WHERE `e`.`Title` = {AssertSqlHelper.Parameter("@__value_0")} +WHERE `e`.`Title` = @value """, // - $""" -@__value_0='Steven' (Size = 10) + """ +@value='Steven' (Size = 10) SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` -WHERE `e`.`FirstName` = {AssertSqlHelper.Parameter("@__value_0")} +WHERE `e`.`FirstName` = @value """); } @@ -6537,12 +6336,12 @@ public override async Task Where_Property_when_shadow_unconstrained_generic_meth await base.Where_Property_when_shadow_unconstrained_generic_method(async); AssertSql( - $""" -@__value_0='Sales Representative' (Size = 30) + """ +@value='Sales Representative' (Size = 30) SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` -WHERE `e`.`Title` = {AssertSqlHelper.Parameter("@__value_0")} +WHERE `e`.`Title` = @value """); } @@ -6646,22 +6445,22 @@ public override async Task Where_subquery_expression(bool async) FROM `Orders` AS `o` """, // - $""" -@__firstOrder_OrderID_0='10248' + """ +@firstOrder_OrderID='10248' SELECT IIF(EXISTS ( SELECT 1 FROM `Orders` AS `o` - WHERE `o`.`OrderID` = {AssertSqlHelper.Parameter("@__firstOrder_OrderID_0")}), TRUE, FALSE) + WHERE `o`.`OrderID` = @firstOrder_OrderID), TRUE, FALSE) FROM (SELECT COUNT(*) FROM `#Dual`) """, // - $""" -@__Any_0='True' + """ +@Any='True' SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE {AssertSqlHelper.Parameter("@__Any_0")} = TRUE +WHERE @Any = TRUE """); } @@ -6704,15 +6503,15 @@ public override async Task Where_subquery_expression_same_parametername(bool asy ORDER BY `o`.`OrderID` """, // - $""" -@__firstOrder_OrderID_0='10248' + """ +@firstOrder_OrderID='10248' SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` WHERE EXISTS ( SELECT 1 FROM `Orders` AS `o0` - WHERE `o0`.`OrderID` = {AssertSqlHelper.Parameter("@__firstOrder_OrderID_0")} AND (`o0`.`CustomerID` = `o`.`CustomerID` OR (`o0`.`CustomerID` IS NULL AND `o`.`CustomerID` IS NULL))) + WHERE `o0`.`OrderID` = @firstOrder_OrderID AND (`o0`.`CustomerID` = `o`.`CustomerID` OR (`o0`.`CustomerID` IS NULL AND `o`.`CustomerID` IS NULL))) """); } @@ -6844,48 +6643,6 @@ public override async Task Using_string_Equals_with_StringComparison_throws_info AssertSql(); } - public override async Task Random_next_is_not_funcletized_1(bool async) - { - await base.Random_next_is_not_funcletized_1(async); - - AssertSql(); - } - - public override async Task Random_next_is_not_funcletized_2(bool async) - { - await base.Random_next_is_not_funcletized_2(async); - - AssertSql(); - } - - public override async Task Random_next_is_not_funcletized_3(bool async) - { - await base.Random_next_is_not_funcletized_3(async); - - AssertSql(); - } - - public override async Task Random_next_is_not_funcletized_4(bool async) - { - await base.Random_next_is_not_funcletized_4(async); - - AssertSql(); - } - - public override async Task Random_next_is_not_funcletized_5(bool async) - { - await base.Random_next_is_not_funcletized_5(async); - - AssertSql(); - } - - public override async Task Random_next_is_not_funcletized_6(bool async) - { - await base.Random_next_is_not_funcletized_6(async); - - AssertSql(); - } - public override async Task SelectMany_after_client_method(bool async) { await base.SelectMany_after_client_method(async); @@ -7321,11 +7078,11 @@ public override async Task Contains_over_concatenated_column_and_parameter(bool AssertSql( """ -@__someVariable_0='SomeVariable' (Size = 255) +@someVariable='SomeVariable' (Size = 255) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` & @__someVariable_0 IN ('ALFKISomeVariable', 'ANATRSomeVariable', 'ALFKIX') +WHERE `c`.`CustomerID` & @someVariable IN ('ALFKISomeVariable', 'ANATRSomeVariable', 'ALFKIX') """); } @@ -7335,11 +7092,11 @@ public override async Task Contains_over_concatenated_parameter_and_constant(boo AssertSql( """ -@__Contains_0='True' +@Contains='True' SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE @__Contains_0 = TRUE +WHERE @Contains = TRUE """); } @@ -7357,11 +7114,11 @@ public override async Task Static_member_access_gets_parameterized_within_larger AssertSql( """ -@__p_0='ALFKI' (Size = 5) +@p='ALFKI' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = @__p_0 +WHERE `c`.`CustomerID` = @p """); } @@ -7405,6 +7162,69 @@ SELECT TOP 1 `o`.`OrderID` """); } + public override async Task Where_nanosecond_and_microsecond_component(bool async) + { + await base.Where_nanosecond_and_microsecond_component(async); + + AssertSql(""" +SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE (DATEPART(nanosecond, [o].[OrderDate]) % 1000 <> 0 OR [o].[OrderDate] IS NULL) AND (DATEPART(microsecond, [o].[OrderDate]) % 1000 <> 0 OR [o].[OrderDate] IS NULL) +"""); + } + + public override async Task Ternary_Not_Null_Contains(bool async) + { + await base.Ternary_Not_Null_Contains(async); + + AssertSql( + """ +SELECT TOP 1 (`o`.`OrderID` & '') & '' +FROM `Orders` AS `o` +WHERE (`o`.`OrderID` & '') & '' LIKE '%1%' +ORDER BY `o`.`OrderID` +"""); + } + + public override async Task Ternary_Not_Null_endsWith_Non_Numeric_First_Part(bool async) + { + await base.Ternary_Not_Null_endsWith_Non_Numeric_First_Part(async); + + AssertSql( + """ +SELECT TOP 1 ('' & (`o`.`OrderID` & '')) & '' +FROM `Orders` AS `o` +WHERE ('' & (`o`.`OrderID` & '')) & '' LIKE '%1' +ORDER BY `o`.`OrderID` +"""); + } + + public override async Task Ternary_Null_Equals_Non_Numeric_First_Part(bool async) + { + await base.Ternary_Null_Equals_Non_Numeric_First_Part(async); + + AssertSql( + """ +SELECT TOP 1 ('' & (`o`.`OrderID` & '')) & '' +FROM `Orders` AS `o` +WHERE (('' & (`o`.`OrderID` & '')) & '') = '1' +ORDER BY `o`.`OrderID` +"""); + } + + public override async Task Ternary_Null_StartsWith(bool async) + { + await base.Ternary_Null_StartsWith(async); + + AssertSql( + """ +SELECT TOP 1 (`o`.`OrderID` & '') & '' +FROM `Orders` AS `o` +WHERE (`o`.`OrderID` & '') & '' LIKE '1%' +ORDER BY `o`.`OrderID` +"""); + } + public override async Task Column_access_inside_subquery_predicate(bool async) { await base.Column_access_inside_subquery_predicate(async); @@ -7431,6 +7251,25 @@ public override async Task Cast_to_object_over_parameter_directly_in_lambda(bool """); } + public override async Task Late_subquery_pushdown(bool async) + { + await base.Late_subquery_pushdown(async); + + AssertSql( + """ +SELECT `o`.`CustomerID` +FROM `Orders` AS `o` +WHERE EXISTS ( + SELECT 1 + FROM ( + SELECT TOP 100 `o0`.`CustomerID` + FROM `Orders` AS `o0` + ORDER BY `o0`.`CustomerID` + ) AS `o1` + WHERE `o1`.`CustomerID` = `o`.`CustomerID` OR (`o1`.`CustomerID` IS NULL AND `o`.`CustomerID` IS NULL)) +"""); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected.Select(s => s.Trim()).ToArray()); diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindNavigationsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindNavigationsQueryJetTest.cs index ae3e22af..1eb88c7f 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindNavigationsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindNavigationsQueryJetTest.cs @@ -54,14 +54,14 @@ public override async Task Select_Where_Navigation_Deep(bool isAsync) await base.Select_Where_Navigation_Deep(isAsync); AssertSql( - $""" - SELECT TOP 1 `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` - FROM (`Order Details` AS `o` - INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) - LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` - WHERE `c`.`City` = 'Seattle' - ORDER BY `o`.`OrderID`, `o`.`ProductID` - """); + """ +SELECT TOP @p `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice` +FROM (`Order Details` AS `o` +INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) +LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` +WHERE `c`.`City` = 'Seattle' +ORDER BY `o`.`OrderID`, `o`.`ProductID` +"""); } public override async Task Take_Select_Navigation(bool isAsync) @@ -96,7 +96,7 @@ public override async Task Select_collection_FirstOrDefault_project_single_colum AssertSql( """ -SELECT TOP 2 ( +SELECT TOP @p ( SELECT TOP 1 `o`.`CustomerID` FROM `Orders` AS `o` WHERE `c`.`CustomerID` = `o`.`CustomerID` @@ -112,7 +112,7 @@ public override async Task Select_collection_FirstOrDefault_project_single_colum AssertSql( """ -SELECT TOP 2 ( +SELECT TOP @p ( SELECT TOP 1 `o`.`CustomerID` FROM `Orders` AS `o` WHERE `c`.`CustomerID` = `o`.`CustomerID` @@ -982,7 +982,7 @@ SELECT TOP 1 `o1`.`OrderID` WHERE `o0`.`OrderID` = `o1`.`OrderID` ORDER BY `o1`.`OrderID`, `o1`.`ProductID`)) AS `OrderDetail`, `c`.`City` FROM ( - SELECT TOP 3 `o`.`OrderID`, `o`.`CustomerID` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0` diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryFiltersQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryFiltersQueryJetTest.cs index 0142fa61..0bd06dfc 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryFiltersQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryFiltersQueryJetTest.cs @@ -30,12 +30,12 @@ public override async Task Count_query(bool async) await base.Count_query(async); AssertSql( - $""" -@__ef_filter__TenantPrefix_0_startswith='B%' (Size = 40) + """ +@ef_filter__TenantPrefix_startswith='B%' (Size = 40) SELECT COUNT(*) FROM `Customers` AS `c` -WHERE `c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")} +WHERE `c`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith """); } @@ -44,12 +44,12 @@ public override async Task Materialized_query(bool async) await base.Materialized_query(async); AssertSql( - $""" -@__ef_filter__TenantPrefix_0_startswith='B%' (Size = 40) + """ +@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` FROM `Customers` AS `c` -WHERE `c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")} +WHERE `c`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith """); } @@ -58,13 +58,13 @@ public override async Task Find(bool async) await base.Find(async); AssertSql( - $""" -@__ef_filter__TenantPrefix_0_startswith='B%' (Size = 40) -@__p_0='ALFKI' (Size = 5) + """ +@ef_filter__TenantPrefix_startswith='B%' (Size = 40) +@p='ALFKI' (Size = 5) SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE (`c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")}) AND `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE (`c`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith) AND `c`.`CustomerID` = @p """); } @@ -73,12 +73,12 @@ public override async Task Materialized_query_parameter(bool async) await base.Materialized_query_parameter(async); AssertSql( - $""" -@__ef_filter__TenantPrefix_0_startswith='F%' (Size = 40) + """ +@ef_filter__TenantPrefix_startswith='F%' (Size = 40) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")} +WHERE `c`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith """); } @@ -87,20 +87,20 @@ public override async Task Materialized_query_parameter_new_context(bool async) await base.Materialized_query_parameter_new_context(async); AssertSql( - $""" -@__ef_filter__TenantPrefix_0_startswith='B%' (Size = 40) + """ +@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` FROM `Customers` AS `c` -WHERE `c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")} +WHERE `c`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith """, // - $""" -@__ef_filter__TenantPrefix_0_startswith='T%' (Size = 40) + """ +@ef_filter__TenantPrefix_startswith='T%' (Size = 40) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")} +WHERE `c`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith """); } @@ -109,12 +109,12 @@ public override async Task Projection_query_parameter(bool async) await base.Projection_query_parameter(async); AssertSql( - $""" -@__ef_filter__TenantPrefix_0_startswith='F%' (Size = 40) + """ +@ef_filter__TenantPrefix_startswith='F%' (Size = 40) SELECT `c`.`CustomerID` FROM `Customers` AS `c` -WHERE `c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")} +WHERE `c`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith """); } @@ -123,12 +123,12 @@ public override async Task Projection_query(bool async) await base.Projection_query(async); AssertSql( - $""" -@__ef_filter__TenantPrefix_0_startswith='B%' (Size = 40) + """ +@ef_filter__TenantPrefix_startswith='B%' (Size = 40) SELECT `c`.`CustomerID` FROM `Customers` AS `c` -WHERE `c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")} +WHERE `c`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith """); } @@ -137,9 +137,9 @@ public override async Task Include_query(bool async) await base.Include_query(async); AssertSql( - $""" -@__ef_filter__TenantPrefix_0_startswith='B%' (Size = 40) -@__ef_filter__TenantPrefix_0_startswith='B%' (Size = 40) + """ +@ef_filter__TenantPrefix_startswith='B%' (Size = 40) +@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` FROM `Customers` AS `c` @@ -149,11 +149,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT `c0`.`CustomerID`, `c0`.`CompanyName` FROM `Customers` AS `c0` - WHERE `c0`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")} + WHERE `c0`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith ) AS `c1` ON `o`.`CustomerID` = `c1`.`CustomerID` WHERE `c1`.`CustomerID` IS NOT NULL AND `c1`.`CompanyName` IS NOT NULL ) AS `s` ON `c`.`CustomerID` = `s`.`CustomerID` -WHERE `c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")} +WHERE `c`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith ORDER BY `c`.`CustomerID`, `s`.`OrderID` """); } @@ -176,15 +176,15 @@ public override async Task Included_many_to_one_query(bool async) await base.Included_many_to_one_query(async); AssertSql( - $""" -@__ef_filter__TenantPrefix_0_startswith='B%' (Size = 40) + """ +@ef_filter__TenantPrefix_startswith='B%' (Size = 40) SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` FROM `Orders` AS `o` LEFT JOIN ( SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` - WHERE `c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")} + WHERE `c`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith ) AS `c0` ON `o`.`CustomerID` = `c0`.`CustomerID` WHERE `c0`.`CustomerID` IS NOT NULL AND `c0`.`CompanyName` IS NOT NULL """); @@ -195,9 +195,9 @@ public override async Task Project_reference_that_itself_has_query_filter_with_a await base.Project_reference_that_itself_has_query_filter_with_another_reference(async); AssertSql( - $""" -@__ef_filter__TenantPrefix_1_startswith='B%' (Size = 40) -@__ef_filter___quantity_0='50' + """ +@ef_filter__TenantPrefix_startswith='B%' (Size = 40) +@ef_filter___quantity='50' SELECT `s`.`OrderID`, `s`.`CustomerID`, `s`.`EmployeeID`, `s`.`OrderDate` FROM `Order Details` AS `o` @@ -207,11 +207,11 @@ INNER JOIN ( LEFT JOIN ( SELECT `c`.`CustomerID`, `c`.`CompanyName` FROM `Customers` AS `c` - WHERE `c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_1_startswith")} + WHERE `c`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith ) AS `c0` ON `o0`.`CustomerID` = `c0`.`CustomerID` WHERE `c0`.`CustomerID` IS NOT NULL AND `c0`.`CompanyName` IS NOT NULL ) AS `s` ON `o`.`OrderID` = `s`.`OrderID` -WHERE `o`.`Quantity` > {AssertSqlHelper.Parameter("@__ef_filter___quantity_0")} +WHERE `o`.`Quantity` > @ef_filter___quantity """); } @@ -259,14 +259,14 @@ public void FromSql_is_composed() } AssertSql( - $""" -@__ef_filter__TenantPrefix_0_startswith='B%' (Size = 40) + """ +@ef_filter__TenantPrefix_startswith='B%' (Size = 40) SELECT `m`.`CustomerID`, `m`.`Address`, `m`.`City`, `m`.`CompanyName`, `m`.`ContactName`, `m`.`ContactTitle`, `m`.`Country`, `m`.`Fax`, `m`.`Phone`, `m`.`PostalCode`, `m`.`Region` FROM ( select * from Customers ) AS `m` -WHERE `m`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")} +WHERE `m`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith """); } @@ -281,8 +281,8 @@ public void FromSql_is_composed_when_filter_has_navigation() } AssertSql( - $""" -@__ef_filter__TenantPrefix_0_startswith='B%' (Size = 40) + """ +@ef_filter__TenantPrefix_startswith='B%' (Size = 40) SELECT `m`.`OrderID`, `m`.`CustomerID`, `m`.`EmployeeID`, `m`.`OrderDate` FROM ( @@ -291,7 +291,7 @@ public void FromSql_is_composed_when_filter_has_navigation() LEFT JOIN ( SELECT `c`.`CustomerID`, `c`.`CompanyName` FROM `Customers` AS `c` - WHERE `c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")} + WHERE `c`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith ) AS `c0` ON `m`.`CustomerID` = `c0`.`CustomerID` WHERE `c0`.`CustomerID` IS NOT NULL AND `c0`.`CompanyName` IS NOT NULL """); @@ -302,22 +302,22 @@ public override void Compiled_query() base.Compiled_query(); AssertSql( - $""" -@__ef_filter__TenantPrefix_0_startswith='B%' (Size = 40) -@__customerID='BERGS' (Size = 5) + """ +@ef_filter__TenantPrefix_startswith='B%' (Size = 40) +@customerID='BERGS' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE (`c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")}) AND `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} +WHERE (`c`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith) AND `c`.`CustomerID` = @customerID """, // - $""" -@__ef_filter__TenantPrefix_0_startswith='B%' (Size = 40) -@__customerID='BLAUS' (Size = 5) + """ +@ef_filter__TenantPrefix_startswith='B%' (Size = 40) +@customerID='BLAUS' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE (`c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")}) AND `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} +WHERE (`c`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith) AND `c`.`CustomerID` = @customerID """); } @@ -326,15 +326,15 @@ public override async Task Entity_Equality(bool async) await base.Entity_Equality(async); AssertSql( - $""" -@__ef_filter__TenantPrefix_0_startswith='B%' (Size = 40) + """ +@ef_filter__TenantPrefix_startswith='B%' (Size = 40) SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` LEFT JOIN ( SELECT `c`.`CustomerID`, `c`.`CompanyName` FROM `Customers` AS `c` - WHERE `c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")} + WHERE `c`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith ) AS `c0` ON `o`.`CustomerID` = `c0`.`CustomerID` WHERE `c0`.`CustomerID` IS NOT NULL AND `c0`.`CompanyName` IS NOT NULL """); @@ -352,15 +352,15 @@ public override async Task Included_many_to_one_query2(bool async) await base.Included_many_to_one_query2(async); AssertSql( - $""" -@__ef_filter__TenantPrefix_0_startswith='B%' (Size = 40) + """ +@ef_filter__TenantPrefix_startswith='B%' (Size = 40) SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` FROM `Orders` AS `o` LEFT JOIN ( SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` - WHERE `c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")} + WHERE `c`.`CompanyName` LIKE @ef_filter__TenantPrefix_startswith ) AS `c0` ON `o`.`CustomerID` = `c0`.`CustomerID` WHERE `c0`.`CustomerID` IS NOT NULL AND `c0`.`CompanyName` IS NOT NULL """); diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryTaggingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryTaggingQueryJetTest.cs index ef8b6140..b884437f 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryTaggingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryTaggingQueryJetTest.cs @@ -27,6 +27,8 @@ public override void Single_query_tag() AssertSql( """ +-- Yanni + SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` @@ -39,6 +41,9 @@ public override void Single_query_multiple_tags() AssertSql( """ +-- Yanni +-- Enya + SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` @@ -51,6 +56,9 @@ public override void Tags_on_subquery() AssertSql( """ +-- Yanni +-- Laurel + SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c`, ( @@ -68,6 +76,8 @@ public override void Duplicate_tags() AssertSql( """ +-- Yanni + SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` @@ -80,6 +90,8 @@ public override void Tag_on_include_query() AssertSql( """ +-- Yanni + SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` @@ -97,6 +109,8 @@ public override void Tag_on_scalar_query() AssertSql( """ +-- Yanni + SELECT TOP 1 `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` @@ -109,6 +123,10 @@ public override void Single_query_multiline_tag() AssertSql( """ +-- Yanni +-- AND +-- Laurel + SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` @@ -121,6 +139,14 @@ public override void Single_query_multiple_multiline_tag() AssertSql( """ +-- Yanni +-- AND +-- Laurel +-- Yet +-- Another +-- Multiline +-- Tag + SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` @@ -133,6 +159,12 @@ public override void Single_query_multiline_tag_with_empty_lines() AssertSql( """ +-- Yanni +-- +-- AND +-- +-- Laurel + SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs index 55d3fd71..6d8c37cc 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs @@ -55,7 +55,7 @@ public override async Task Projection_when_arithmetic_mixed(bool isAsync) """ SELECT CLNG(`e0`.`EmployeeID`) + CLNG(`o0`.`OrderID`) AS `Add`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, 42 AS `Literal`, `e0`.`EmployeeID`, `e0`.`City`, `e0`.`Country`, `e0`.`FirstName`, `e0`.`ReportsTo`, `e0`.`Title` FROM ( - SELECT TOP 10 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0`, @@ -160,10 +160,10 @@ public override async Task Select_bool_closure_with_order_parameter_with_cast_to await base.Select_bool_closure_with_order_parameter_with_cast_to_nullable(isAsync); AssertSql( - $""" -@__boolean_0='False' + """ +@boolean='False' -SELECT CBOOL({AssertSqlHelper.Parameter("@__boolean_0")}) +SELECT CBOOL(@boolean) FROM `Customers` AS `c` """); } @@ -272,10 +272,10 @@ public override async Task Select_local(bool isAsync) await base.Select_local(isAsync); AssertSql( - $""" -@__x_0='10' + """ +@x='10' -SELECT CLNG({AssertSqlHelper.Parameter("@__x_0")}) +SELECT CLNG(@x) FROM `Customers` AS `c` """); } @@ -286,9 +286,9 @@ public override async Task Select_scalar_primitive_after_take(bool isAsync) AssertSql( """ - SELECT TOP 9 `e`.`EmployeeID` - FROM `Employees` AS `e` - """); +SELECT TOP @p `e`.`EmployeeID` +FROM `Employees` AS `e` +"""); } public override async Task Select_project_filter(bool isAsync) @@ -821,13 +821,13 @@ public override async Task Project_single_element_from_collection_with_OrderBy_D await base.Project_single_element_from_collection_with_OrderBy_Distinct_and_FirstOrDefault(isAsync); AssertSql( - $""" - SELECT ( - SELECT DISTINCT TOP 1 `o`.`CustomerID` - FROM `Orders` AS `o` - WHERE `c`.`CustomerID` = `o`.`CustomerID`) - FROM `Customers` AS `c` - """); + """ +SELECT ( + SELECT TOP 1 `o`.`CustomerID` + FROM `Orders` AS `o` + WHERE `c`.`CustomerID` = `o`.`CustomerID`) +FROM `Customers` AS `c` +"""); } [ConditionalTheory(Skip = "`SELECT (SELECT TOP 1) FROM` is not supported by Jet.")] @@ -922,7 +922,14 @@ await base isAsync); AssertSql( - $@""); + """ +SELECT ( + SELECT TOP 1 IIF(LEN(`o`.`CustomerID`) IS NULL, NULL, CLNG(LEN(`o`.`CustomerID`))) + FROM `Orders` AS `o` + WHERE `c`.`CustomerID` = `o`.`CustomerID` + ORDER BY `o`.`OrderID`, `o`.`OrderDate` DESC) +FROM `Customers` AS `c` +"""); } [ConditionalTheory(Skip = "`SELECT (SELECT TOP 1) FROM` is not supported by Jet.")] @@ -1347,6 +1354,61 @@ WHERE CAST(LEN([c].[CustomerID]) AS int) >= CAST(LEN([o].[CustomerID]) AS int) """); } + public override async Task SelectMany_with_multiple_Take(bool async) + { + await base.SelectMany_with_multiple_Take(async); + + AssertSql( + """ +SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate] +FROM [Customers] AS [c] +INNER JOIN ( + SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] + FROM ( + SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o].[CustomerID] ORDER BY [o].[OrderID]) AS [row] + FROM [Orders] AS [o] + ) AS [o0] + WHERE [o0].[row] <= 3 +) AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] +"""); + } + + /*public override async Task SelectMany_with_nested_DefaultIfEmpty(bool async) + { + await base.SelectMany_with_nested_DefaultIfEmpty(async); + + AssertSql( + """ +SELECT [s].[OrderID], [s].[ProductID], [s].[Discount], [s].[Quantity], [s].[UnitPrice] +FROM [Customers] AS [c] +INNER JOIN ( + SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [o].[CustomerID] + FROM [Orders] AS [o] + LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] + WHERE 0 = 1 +) AS [s] ON [c].[CustomerID] = [s].[CustomerID] +"""); + }*/ + + public override async Task Select_with_multiple_Take(bool async) + { + await base.Select_with_multiple_Take(async); + + AssertSql( + """ +@p0='3' +@p='5' + +SELECT TOP(@p0) [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] +FROM ( + SELECT TOP(@p) [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] + FROM [Customers] AS [c] + ORDER BY [c].[CustomerID] +) AS [c0] +ORDER BY [c0].[CustomerID] +"""); + } + public override async Task FirstOrDefault_over_empty_collection_of_value_type_returns_correct_results(bool isAsync) { await base.FirstOrDefault_over_empty_collection_of_value_type_returns_correct_results(isAsync); @@ -1721,7 +1783,7 @@ public override async Task Reverse_in_subquery_via_pushdown(bool async) FROM ( SELECT DISTINCT `e0`.`EmployeeID`, `e0`.`City`, `e0`.`Country`, `e0`.`FirstName`, `e0`.`ReportsTo`, `e0`.`Title` FROM ( - SELECT TOP 5 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` + SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` DESC ) AS `e0` @@ -1737,7 +1799,7 @@ public override async Task Reverse_after_orderBy_and_take(bool async) """ SELECT `e0`.`EmployeeID`, `e0`.`City` FROM ( - SELECT TOP 5 `e`.`EmployeeID`, `e`.`City` + SELECT TOP @p `e`.`EmployeeID`, `e`.`City` FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` ) AS `e0` @@ -1766,7 +1828,7 @@ public override async Task Reverse_in_join_outer_with_take(bool async) """ SELECT `c0`.`CustomerID`, `o`.`OrderID` FROM ( - SELECT TOP 20 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` @@ -2018,7 +2080,7 @@ public override async Task Projection_take_projection_doesnt_project_intermitten AssertSql( """ -SELECT TOP 10 (`c`.`CustomerID` & ' ') & IIF(`c`.`City` IS NULL, '', `c`.`City`) AS `Aggregate` +SELECT TOP @p (`c`.`CustomerID` & ' ') & IIF(`c`.`City` IS NULL, '', `c`.`City`) AS `Aggregate` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` """); @@ -2060,7 +2122,7 @@ public override async Task Projection_take_predicate_projection(bool async) """ SELECT (`c0`.`CustomerID` & ' ') & IIF(`c0`.`City` IS NULL, '', `c0`.`City`) AS `Aggregate` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`City` + SELECT TOP @p `c`.`CustomerID`, `c`.`City` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` @@ -2473,7 +2535,7 @@ public override async Task Projection_when_arithmetic_mixed_subqueries(bool asyn """ SELECT CLNG(`e0`.`EmployeeID`) + CLNG(`o0`.`OrderID`) AS `Add`, `e0`.`Square`, `e0`.`EmployeeID`, `e0`.`City`, `e0`.`Country`, `e0`.`FirstName`, `e0`.`ReportsTo`, `e0`.`Title`, 42 AS `Literal`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `o0`.`OrderID` MOD 2 AS `Mod` FROM ( - SELECT TOP 3 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o0`, diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSetOperationsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSetOperationsQueryJetTest.cs index 5990ccd7..b142bfdb 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSetOperationsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSetOperationsQueryJetTest.cs @@ -101,9 +101,9 @@ public override async Task Union_OrderBy_Skip_Take(bool isAsync) """ SELECT `u1`.`CustomerID`, `u1`.`Address`, `u1`.`City`, `u1`.`CompanyName`, `u1`.`ContactName`, `u1`.`ContactTitle`, `u1`.`Country`, `u1`.`Fax`, `u1`.`Phone`, `u1`.`PostalCode`, `u1`.`Region` FROM ( - SELECT TOP 1 `u0`.`CustomerID`, `u0`.`Address`, `u0`.`City`, `u0`.`CompanyName`, `u0`.`ContactName`, `u0`.`ContactTitle`, `u0`.`Country`, `u0`.`Fax`, `u0`.`Phone`, `u0`.`PostalCode`, `u0`.`Region` + SELECT TOP @p `u0`.`CustomerID`, `u0`.`Address`, `u0`.`City`, `u0`.`CompanyName`, `u0`.`ContactName`, `u0`.`ContactTitle`, `u0`.`Country`, `u0`.`Fax`, `u0`.`Phone`, `u0`.`PostalCode`, `u0`.`Region` FROM ( - SELECT TOP 2 `u`.`CustomerID`, `u`.`Address`, `u`.`City`, `u`.`CompanyName`, `u`.`ContactName`, `u`.`ContactTitle`, `u`.`Country`, `u`.`Fax`, `u`.`Phone`, `u`.`PostalCode`, `u`.`Region` + SELECT TOP @p + @p `u`.`CustomerID`, `u`.`Address`, `u`.`City`, `u`.`CompanyName`, `u`.`ContactName`, `u`.`ContactTitle`, `u`.`Country`, `u`.`Fax`, `u`.`Phone`, `u`.`PostalCode`, `u`.`Region` FROM ( SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` @@ -220,11 +220,11 @@ public override async Task Union_Take_Union_Take(bool isAsync) """ SELECT `u2`.`CustomerID`, `u2`.`Address`, `u2`.`City`, `u2`.`CompanyName`, `u2`.`ContactName`, `u2`.`ContactTitle`, `u2`.`Country`, `u2`.`Fax`, `u2`.`Phone`, `u2`.`PostalCode`, `u2`.`Region` FROM ( - SELECT TOP 1 `u1`.`CustomerID`, `u1`.`Address`, `u1`.`City`, `u1`.`CompanyName`, `u1`.`ContactName`, `u1`.`ContactTitle`, `u1`.`Country`, `u1`.`Fax`, `u1`.`Phone`, `u1`.`PostalCode`, `u1`.`Region` + SELECT TOP @p `u1`.`CustomerID`, `u1`.`Address`, `u1`.`City`, `u1`.`CompanyName`, `u1`.`ContactName`, `u1`.`ContactTitle`, `u1`.`Country`, `u1`.`Fax`, `u1`.`Phone`, `u1`.`PostalCode`, `u1`.`Region` FROM ( SELECT `u0`.`CustomerID`, `u0`.`Address`, `u0`.`City`, `u0`.`CompanyName`, `u0`.`ContactName`, `u0`.`ContactTitle`, `u0`.`Country`, `u0`.`Fax`, `u0`.`Phone`, `u0`.`PostalCode`, `u0`.`Region` FROM ( - SELECT TOP 1 `u`.`CustomerID`, `u`.`Address`, `u`.`City`, `u`.`CompanyName`, `u`.`ContactName`, `u`.`ContactTitle`, `u`.`Country`, `u`.`Fax`, `u`.`Phone`, `u`.`PostalCode`, `u`.`Region` + SELECT TOP @p `u`.`CustomerID`, `u`.`Address`, `u`.`City`, `u`.`CompanyName`, `u`.`ContactName`, `u`.`ContactTitle`, `u`.`Country`, `u`.`Fax`, `u`.`Phone`, `u`.`PostalCode`, `u`.`Region` FROM ( SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` @@ -345,9 +345,9 @@ public override async Task Select_Union_different_fields_in_anonymous_with_subqu """ SELECT `u0`.`Foo`, `u0`.`CustomerID`, `u0`.`Address`, `u0`.`City`, `u0`.`CompanyName`, `u0`.`ContactName`, `u0`.`ContactTitle`, `u0`.`Country`, `u0`.`Fax`, `u0`.`Phone`, `u0`.`PostalCode`, `u0`.`Region` FROM ( - SELECT TOP 10 `u1`.`Foo`, `u1`.`CustomerID`, `u1`.`Address`, `u1`.`City`, `u1`.`CompanyName`, `u1`.`ContactName`, `u1`.`ContactTitle`, `u1`.`Country`, `u1`.`Fax`, `u1`.`Phone`, `u1`.`PostalCode`, `u1`.`Region` + SELECT TOP @p0 `u1`.`Foo`, `u1`.`CustomerID`, `u1`.`Address`, `u1`.`City`, `u1`.`CompanyName`, `u1`.`ContactName`, `u1`.`ContactTitle`, `u1`.`Country`, `u1`.`Fax`, `u1`.`Phone`, `u1`.`PostalCode`, `u1`.`Region` FROM ( - SELECT TOP 11 `u`.`Foo`, `u`.`CustomerID`, `u`.`Address`, `u`.`City`, `u`.`CompanyName`, `u`.`ContactName`, `u`.`ContactTitle`, `u`.`Country`, `u`.`Fax`, `u`.`Phone`, `u`.`PostalCode`, `u`.`Region` + SELECT TOP @p + @p0 `u`.`Foo`, `u`.`CustomerID`, `u`.`Address`, `u`.`City`, `u`.`CompanyName`, `u`.`ContactName`, `u`.`ContactTitle`, `u`.`Country`, `u`.`Fax`, `u`.`Phone`, `u`.`PostalCode`, `u`.`Region` FROM ( SELECT `c`.`City` AS `Foo`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` @@ -1037,7 +1037,7 @@ public override async Task Union_over_OrderBy_Take1(bool async) """ SELECT `o1`.`OrderID` FROM ( - SELECT TOP 5 `o`.`OrderID` + SELECT TOP @p `o`.`OrderID` FROM `Orders` AS `o` ORDER BY `o`.`OrderDate` ) AS `o1` @@ -1072,7 +1072,7 @@ public override async Task Union_over_OrderBy_Take2(bool async) UNION SELECT `o1`.`OrderID` FROM ( - SELECT TOP 5 `o0`.`OrderID` + SELECT TOP @p `o0`.`OrderID` FROM `Orders` AS `o0` ORDER BY `o0`.`OrderDate` ) AS `o1` @@ -1101,14 +1101,14 @@ public override async Task OrderBy_Take_Union(bool isAsync) """ SELECT `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` FROM ( - SELECT TOP 1 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactName` ) AS `c1` UNION SELECT `c2`.`CustomerID`, `c2`.`Address`, `c2`.`City`, `c2`.`CompanyName`, `c2`.`ContactName`, `c2`.`ContactTitle`, `c2`.`Country`, `c2`.`Fax`, `c2`.`Phone`, `c2`.`PostalCode`, `c2`.`Region` FROM ( - SELECT TOP 1 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` + SELECT TOP @p `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` FROM `Customers` AS `c0` ORDER BY `c0`.`ContactName` ) AS `c2` diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryJetTest.cs index 6165fbc5..8437ca4f 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryJetTest.cs @@ -82,6 +82,7 @@ ORDER BY `o`.`OrderID` SELECT TOP 1 `o`.`OrderID` FROM `Orders` AS `o` WHERE `o`.`OrderID` = 10248 + ORDER BY `o`.`OrderID` ) AS `o1` INNER 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` @@ -177,7 +178,7 @@ SELECT TOP 1 `o`.`OrderDate` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'W%' ) AS `c2` - ORDER BY `c2`.`c` DESC + ORDER BY `c2`.`c` DESC, `c2`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` ORDER BY `c0`.`c` DESC, `c0`.`CustomerID` @@ -213,7 +214,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as """ SELECT `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` FROM ( - SELECT TOP 5 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, @@ -232,7 +233,7 @@ public override async Task Multi_level_includes_are_applied_with_skip(bool async FROM ( SELECT TOP 1 `c0`.`CustomerID` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p + 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'A%' ORDER BY `c`.`CustomerID` @@ -247,7 +248,7 @@ ORDER BY `c1`.`CustomerID` FROM ( SELECT TOP 1 `c0`.`CustomerID` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p + 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'A%' ORDER BY `c`.`CustomerID` @@ -263,7 +264,7 @@ ORDER BY `c0`.`CustomerID` DESC FROM (( SELECT TOP 1 `c0`.`CustomerID` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p + 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'A%' ORDER BY `c`.`CustomerID` @@ -312,16 +313,16 @@ public override async Task Include_duplicate_collection_result_operator(bool asy AssertSql( """ -SELECT TOP 1 `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region`, `c2`.`CustomerID`, `c2`.`Address`, `c2`.`City`, `c2`.`CompanyName`, `c2`.`ContactName`, `c2`.`ContactTitle`, `c2`.`Country`, `c2`.`Fax`, `c2`.`Phone`, `c2`.`PostalCode`, `c2`.`Region` +SELECT TOP @p0 `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region`, `c2`.`CustomerID`, `c2`.`Address`, `c2`.`City`, `c2`.`CompanyName`, `c2`.`ContactName`, `c2`.`ContactTitle`, `c2`.`Country`, `c2`.`Fax`, `c2`.`Phone`, `c2`.`PostalCode`, `c2`.`Region` FROM ( - SELECT TOP 2 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, ( SELECT TOP 2 `c3`.`CustomerID`, `c3`.`Address`, `c3`.`City`, `c3`.`CompanyName`, `c3`.`ContactName`, `c3`.`ContactTitle`, `c3`.`Country`, `c3`.`Fax`, `c3`.`Phone`, `c3`.`PostalCode`, `c3`.`Region` FROM ( - SELECT TOP 4 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` + SELECT TOP 2 + 2 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` FROM `Customers` AS `c0` ORDER BY `c0`.`CustomerID` ) AS `c3` @@ -333,22 +334,22 @@ ORDER BY `c3`.`CustomerID` DESC """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `s`.`CustomerID`, `s`.`CustomerID0` FROM ( - SELECT TOP 1 `c1`.`CustomerID`, `c2`.`CustomerID` AS `CustomerID0` + SELECT TOP @p0 `c1`.`CustomerID`, `c2`.`CustomerID` AS `CustomerID0` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, ( SELECT TOP 2 `c3`.`CustomerID` FROM ( - SELECT TOP 4 `c0`.`CustomerID` + SELECT TOP 2 + 2 `c0`.`CustomerID` FROM `Customers` AS `c0` ORDER BY `c0`.`CustomerID` ) AS `c3` ORDER BY `c3`.`CustomerID` DESC ) AS `c2` - ORDER BY `c1`.`CustomerID` + ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID` ) AS `s` INNER JOIN `Orders` AS `o` ON `s`.`CustomerID` = `o`.`CustomerID` ORDER BY `s`.`CustomerID`, `s`.`CustomerID0` @@ -357,22 +358,22 @@ ORDER BY `c1`.`CustomerID` """ SELECT `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `s0`.`CustomerID`, `s0`.`CustomerID0` FROM ( - SELECT TOP 1 `c1`.`CustomerID`, `c2`.`CustomerID` AS `CustomerID0` + SELECT TOP @p0 `c1`.`CustomerID`, `c2`.`CustomerID` AS `CustomerID0` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, ( SELECT TOP 2 `c3`.`CustomerID` FROM ( - SELECT TOP 4 `c0`.`CustomerID` + SELECT TOP 2 + 2 `c0`.`CustomerID` FROM `Customers` AS `c0` ORDER BY `c0`.`CustomerID` ) AS `c3` ORDER BY `c3`.`CustomerID` DESC ) AS `c2` - ORDER BY `c1`.`CustomerID` + ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID` ) AS `s0` INNER JOIN `Orders` AS `o0` ON `s0`.`CustomerID0` = `o0`.`CustomerID` ORDER BY `s0`.`CustomerID`, `s0`.`CustomerID0` @@ -410,7 +411,7 @@ public override async Task Include_duplicate_reference(bool async) FROM (( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`CustomerID`, `o`.`OrderID` ) AS `o1`, @@ -419,7 +420,7 @@ public override async Task Include_duplicate_reference(bool async) FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`CustomerID`, `o0`.`OrderID` ) AS `o3` @@ -503,7 +504,7 @@ public override async Task Include_collection_with_multiple_conditional_order_by AssertSql( """ -SELECT TOP 5 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c`.`CustomerID` +SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c`.`CustomerID` FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` ORDER BY NOT (IIF(`o`.`OrderID` > 0, TRUE, FALSE)), IIF(`c`.`CustomerID` IS NOT NULL, `c`.`City`, ''), `o`.`OrderID`, `c`.`CustomerID` @@ -512,13 +513,13 @@ ORDER BY NOT (IIF(`o`.`OrderID` > 0, TRUE, FALSE)), IIF(`c`.`CustomerID` IS NOT """ SELECT `o0`.`OrderID`, `o0`.`ProductID`, `o0`.`Discount`, `o0`.`Quantity`, `o0`.`UnitPrice`, `s`.`OrderID`, `s`.`CustomerID` FROM ( - SELECT TOP 5 `s0`.`OrderID`, `s0`.`CustomerID`, `s0`.`c`, `s0`.`c0` + SELECT TOP @p `s0`.`OrderID`, `s0`.`CustomerID`, `s0`.`c`, `s0`.`c0` FROM ( SELECT `o`.`OrderID`, `c`.`CustomerID`, IIF(`o`.`OrderID` > 0, TRUE, FALSE) AS `c`, IIF(`c`.`CustomerID` IS NOT NULL, `c`.`City`, '') AS `c0` FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` ) AS `s0` - ORDER BY NOT (`s0`.`c`), `s0`.`c0` + ORDER BY NOT (`s0`.`c`), `s0`.`c0`, `s0`.`OrderID`, `s0`.`CustomerID` ) AS `s` INNER JOIN `Order Details` AS `o0` ON `s`.`OrderID` = `o0`.`OrderID` ORDER BY NOT (`s`.`c`), `s`.`c0`, `s`.`OrderID`, `s`.`CustomerID` @@ -533,9 +534,9 @@ public override async Task Include_where_skip_take_projection(bool async) """ SELECT `o0`.`CustomerID` FROM ( - SELECT TOP 2 `o2`.`OrderID`, `o2`.`ProductID` + SELECT TOP @p0 `o2`.`OrderID`, `o2`.`ProductID` FROM ( - SELECT TOP 3 `o`.`OrderID`, `o`.`ProductID` + SELECT TOP @p + @p0 `o`.`OrderID`, `o`.`ProductID` FROM `Order Details` AS `o` WHERE `o`.`Quantity` = 10 ORDER BY `o`.`OrderID`, `o`.`ProductID` @@ -720,7 +721,7 @@ public override async Task Include_collection_order_by_non_key_with_first_or_def FROM ( SELECT TOP 1 `c`.`CustomerID`, `c`.`CompanyName` FROM `Customers` AS `c` - ORDER BY `c`.`CompanyName` DESC + ORDER BY `c`.`CompanyName` DESC, `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` @@ -937,7 +938,7 @@ public override async Task Include_collection_with_last(bool async) FROM ( SELECT TOP 1 `c`.`CustomerID`, `c`.`CompanyName` FROM `Customers` AS `c` - ORDER BY `c`.`CompanyName` DESC + ORDER BY `c`.`CompanyName` DESC, `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` @@ -1082,6 +1083,7 @@ ORDER BY `c`.`CustomerID` SELECT TOP 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` = 'ALFKI' + ORDER BY `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`CustomerID` @@ -1152,6 +1154,7 @@ ORDER BY `c`.`CustomerID` SELECT TOP 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` = 'ALFKI' + ORDER BY `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`CustomerID` @@ -1240,7 +1243,7 @@ public override async Task Include_duplicate_reference2(bool async) FROM ( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o1`, @@ -1249,7 +1252,7 @@ ORDER BY `o`.`OrderID` FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`OrderID` ) AS `o3` @@ -1298,7 +1301,7 @@ public override async Task Include_duplicate_reference3(bool async) FROM ( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o1`, @@ -1307,7 +1310,7 @@ ORDER BY `o`.`OrderID` FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`OrderID` ) AS `o3` @@ -1376,7 +1379,7 @@ SELECT TOP 1 `o`.`OrderDate` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'W%' ) AS `c2` - ORDER BY `c2`.`c` DESC + ORDER BY `c2`.`c` DESC, `c2`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` ORDER BY `c0`.`c` DESC, `c0`.`CustomerID`, `o0`.`OrderID` @@ -1395,7 +1398,7 @@ SELECT TOP 1 `o`.`OrderDate` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'W%' ) AS `c3` - ORDER BY `c3`.`c` DESC + ORDER BY `c3`.`c` DESC, `c3`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID`) LEFT JOIN `Order Details` AS `o1` ON `o0`.`OrderID` = `o1`.`OrderID` @@ -1622,6 +1625,7 @@ ORDER BY `c`.`CustomerID` FROM ( SELECT TOP 1 `c`.`CustomerID` FROM `Customers` AS `c` + ORDER BY `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`CustomerID` @@ -1830,7 +1834,7 @@ public override async Task Repro9735(bool async) AssertSql( """ -SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c`.`CustomerID` +SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c`.`CustomerID` FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` ORDER BY NOT (IIF(`c`.`CustomerID` IS NOT NULL, TRUE, FALSE)), IIF(`c`.`CustomerID` IS NOT NULL, `c`.`CustomerID`, ''), `o`.`OrderID`, `c`.`CustomerID` @@ -1839,13 +1843,13 @@ ORDER BY NOT (IIF(`c`.`CustomerID` IS NOT NULL, TRUE, FALSE)), IIF(`c`.`Customer """ SELECT `o0`.`OrderID`, `o0`.`ProductID`, `o0`.`Discount`, `o0`.`Quantity`, `o0`.`UnitPrice`, `s`.`OrderID`, `s`.`CustomerID` FROM ( - SELECT TOP 2 `s0`.`OrderID`, `s0`.`CustomerID`, `s0`.`c`, `s0`.`c0` + SELECT TOP @p `s0`.`OrderID`, `s0`.`CustomerID`, `s0`.`c`, `s0`.`c0` FROM ( SELECT `o`.`OrderID`, `c`.`CustomerID`, IIF(`c`.`CustomerID` IS NOT NULL, TRUE, FALSE) AS `c`, IIF(`c`.`CustomerID` IS NOT NULL, `c`.`CustomerID`, '') AS `c0` FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` ) AS `s0` - ORDER BY NOT (`s0`.`c`), `s0`.`c0` + ORDER BY NOT (`s0`.`c`), `s0`.`c0`, `s0`.`OrderID`, `s0`.`CustomerID` ) AS `s` INNER JOIN `Order Details` AS `o0` ON `s`.`OrderID` = `o0`.`OrderID` ORDER BY NOT (`s`.`c`), `s`.`c0`, `s`.`OrderID`, `s`.`CustomerID` @@ -2054,7 +2058,7 @@ public override async Task Include_collection_take_no_order_by(bool async) AssertSql( """ -SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` """, @@ -2062,8 +2066,9 @@ ORDER BY `c`.`CustomerID` """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c0`.`CustomerID` FROM ( - SELECT TOP 10 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` + ORDER BY `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`CustomerID` @@ -2108,6 +2113,29 @@ public override async Task Include_collection_with_left_join_clause_with_filter( """); } + public override async Task Include_collection_with_right_join_clause_with_filter(bool async) + { + await base.Include_collection_with_right_join_clause_with_filter(async); + + AssertSql( + """ +SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID] +FROM [Customers] AS [c] +RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] +WHERE [c].[CustomerID] LIKE N'F%' +ORDER BY [c].[CustomerID], [o].[OrderID] +""", + // + """ +SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [c].[CustomerID], [o].[OrderID] +FROM [Customers] AS [c] +RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] +INNER JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] +WHERE [c].[CustomerID] LIKE N'F%' +ORDER BY [c].[CustomerID], [o].[OrderID] +"""); + } + public override async Task Include_reference_distinct_is_server_evaluated(bool async) { await base.Include_reference_distinct_is_server_evaluated(async); @@ -2194,16 +2222,16 @@ public override async Task Include_duplicate_collection_result_operator2(bool as AssertSql( """ -SELECT TOP 1 `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region`, `c2`.`CustomerID`, `c2`.`Address`, `c2`.`City`, `c2`.`CompanyName`, `c2`.`ContactName`, `c2`.`ContactTitle`, `c2`.`Country`, `c2`.`Fax`, `c2`.`Phone`, `c2`.`PostalCode`, `c2`.`Region` +SELECT TOP @p0 `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region`, `c2`.`CustomerID`, `c2`.`Address`, `c2`.`City`, `c2`.`CompanyName`, `c2`.`ContactName`, `c2`.`ContactTitle`, `c2`.`Country`, `c2`.`Fax`, `c2`.`Phone`, `c2`.`PostalCode`, `c2`.`Region` FROM ( - SELECT TOP 2 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, ( SELECT TOP 2 `c3`.`CustomerID`, `c3`.`Address`, `c3`.`City`, `c3`.`CompanyName`, `c3`.`ContactName`, `c3`.`ContactTitle`, `c3`.`Country`, `c3`.`Fax`, `c3`.`Phone`, `c3`.`PostalCode`, `c3`.`Region` FROM ( - SELECT TOP 4 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` + SELECT TOP 2 + 2 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` FROM `Customers` AS `c0` ORDER BY `c0`.`CustomerID` ) AS `c3` @@ -2215,22 +2243,22 @@ ORDER BY `c3`.`CustomerID` DESC """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `s`.`CustomerID`, `s`.`CustomerID0` FROM ( - SELECT TOP 1 `c1`.`CustomerID`, `c2`.`CustomerID` AS `CustomerID0` + SELECT TOP @p0 `c1`.`CustomerID`, `c2`.`CustomerID` AS `CustomerID0` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, ( SELECT TOP 2 `c3`.`CustomerID` FROM ( - SELECT TOP 4 `c0`.`CustomerID` + SELECT TOP 2 + 2 `c0`.`CustomerID` FROM `Customers` AS `c0` ORDER BY `c0`.`CustomerID` ) AS `c3` ORDER BY `c3`.`CustomerID` DESC ) AS `c2` - ORDER BY `c1`.`CustomerID` + ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID` ) AS `s` INNER JOIN `Orders` AS `o` ON `s`.`CustomerID` = `o`.`CustomerID` ORDER BY `s`.`CustomerID`, `s`.`CustomerID0` @@ -2333,7 +2361,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as AssertSql( """ -SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactTitle`, `c`.`CustomerID` """, @@ -2341,9 +2369,9 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c0`.`CustomerID` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`ContactTitle` + SELECT TOP @p `c`.`CustomerID`, `c`.`ContactTitle` FROM `Customers` AS `c` - ORDER BY `c`.`ContactTitle` + ORDER BY `c`.`ContactTitle`, `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` @@ -2356,7 +2384,7 @@ public override async Task Include_with_take(bool async) AssertSql( """ -SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactName` DESC, `c`.`CustomerID` """, @@ -2364,9 +2392,9 @@ public override async Task Include_with_take(bool async) """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c0`.`CustomerID` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`ContactName` + SELECT TOP @p `c`.`CustomerID`, `c`.`ContactName` FROM `Customers` AS `c` - ORDER BY `c`.`ContactName` DESC + ORDER BY `c`.`ContactName` DESC, `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID` @@ -2472,6 +2500,7 @@ ORDER BY `c`.`CustomerID` SELECT TOP 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` = 'ALFKI' + ORDER BY `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`CustomerID`, `o`.`OrderID` @@ -2483,6 +2512,7 @@ SELECT TOP 1 `c`.`CustomerID` SELECT TOP 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` = 'ALFKI' + ORDER BY `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Order Details` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` @@ -2549,7 +2579,7 @@ public override async Task Include_collection_orderby_take(bool async) AssertSql( """ -SELECT TOP 5 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` """, @@ -2557,7 +2587,7 @@ ORDER BY `c`.`CustomerID` """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c0`.`CustomerID` FROM ( - SELECT TOP 5 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeQueryJetTest.cs index 1da3510e..5e240dbb 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeQueryJetTest.cs @@ -119,7 +119,7 @@ public override async Task Include_collection_with_last(bool async) FROM ( SELECT TOP 1 `c`.`CustomerID`, `c`.`CompanyName` FROM `Customers` AS `c` - ORDER BY `c`.`CompanyName` DESC + ORDER BY `c`.`CompanyName` DESC, `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` @@ -137,7 +137,7 @@ public override async Task Include_collection_take_no_order_by(bool async) AssertSql( """ -SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` """, @@ -145,8 +145,9 @@ ORDER BY `c`.`CustomerID` """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c0`.`CustomerID` FROM ( - SELECT TOP 10 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` + ORDER BY `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`CustomerID` @@ -290,6 +291,7 @@ public override async Task Include_multi_level_reference_and_collection_predicat FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` WHERE `o`.`OrderID` = 10248 + ORDER BY `o`.`OrderID`, `c`.`CustomerID` ) AS `s` INNER JOIN `Orders` AS `o0` ON `s`.`CustomerID` = `o0`.`CustomerID` ORDER BY `s`.`OrderID`, `s`.`CustomerID` @@ -314,6 +316,7 @@ ORDER BY `o`.`OrderID` SELECT TOP 1 `o`.`OrderID` FROM `Orders` AS `o` WHERE `o`.`OrderID` = 10248 + ORDER BY `o`.`OrderID` ) AS `o1` INNER 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` @@ -377,7 +380,7 @@ SELECT TOP 1 `o`.`OrderDate` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'W%' ) AS `c2` - ORDER BY `c2`.`c` DESC + ORDER BY `c2`.`c` DESC, `c2`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` ORDER BY `c0`.`c` DESC, `c0`.`CustomerID` @@ -432,7 +435,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as AssertSql( """ -SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactTitle`, `c`.`CustomerID` """, @@ -440,9 +443,9 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c0`.`CustomerID` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`ContactTitle` + SELECT TOP @p `c`.`CustomerID`, `c`.`ContactTitle` FROM `Customers` AS `c` - ORDER BY `c`.`ContactTitle` + ORDER BY `c`.`ContactTitle`, `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`ContactTitle`, `c0`.`CustomerID` @@ -496,7 +499,7 @@ public override async Task Include_collection_order_by_non_key_with_first_or_def FROM ( SELECT TOP 1 `c`.`CustomerID`, `c`.`CompanyName` FROM `Customers` AS `c` - ORDER BY `c`.`CompanyName` DESC + ORDER BY `c`.`CompanyName` DESC, `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`CompanyName` DESC, `c0`.`CustomerID` @@ -564,6 +567,7 @@ ORDER BY `c`.`CustomerID` SELECT TOP 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` = 'ALFKI' + ORDER BY `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`CustomerID` @@ -733,6 +737,29 @@ public override async Task Include_collection_with_left_join_clause_with_filter( """); } + public override async Task Include_collection_with_right_join_clause_with_filter(bool async) + { + await base.Include_collection_with_right_join_clause_with_filter(async); + + AssertSql( + """ +SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID] +FROM [Customers] AS [c] +RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] +WHERE [c].[CustomerID] LIKE N'F%' +ORDER BY [c].[CustomerID], [o].[OrderID] +""", + // + """ +SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [c].[CustomerID], [o].[OrderID] +FROM [Customers] AS [c] +RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] +INNER JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] +WHERE [c].[CustomerID] LIKE N'F%' +ORDER BY [c].[CustomerID], [o].[OrderID] +"""); + } + public override async Task Include_collection_with_cross_join_clause_with_filter(bool async) { await base.Include_collection_with_cross_join_clause_with_filter(async); @@ -968,16 +995,16 @@ public override async Task Include_duplicate_collection_result_operator(bool asy AssertSql( """ -SELECT TOP 1 `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region`, `c2`.`CustomerID`, `c2`.`Address`, `c2`.`City`, `c2`.`CompanyName`, `c2`.`ContactName`, `c2`.`ContactTitle`, `c2`.`Country`, `c2`.`Fax`, `c2`.`Phone`, `c2`.`PostalCode`, `c2`.`Region` +SELECT TOP @p0 `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region`, `c2`.`CustomerID`, `c2`.`Address`, `c2`.`City`, `c2`.`CompanyName`, `c2`.`ContactName`, `c2`.`ContactTitle`, `c2`.`Country`, `c2`.`Fax`, `c2`.`Phone`, `c2`.`PostalCode`, `c2`.`Region` FROM ( - SELECT TOP 2 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, ( SELECT TOP 2 `c3`.`CustomerID`, `c3`.`Address`, `c3`.`City`, `c3`.`CompanyName`, `c3`.`ContactName`, `c3`.`ContactTitle`, `c3`.`Country`, `c3`.`Fax`, `c3`.`Phone`, `c3`.`PostalCode`, `c3`.`Region` FROM ( - SELECT TOP 4 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` + SELECT TOP 2 + 2 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` FROM `Customers` AS `c0` ORDER BY `c0`.`CustomerID` ) AS `c3` @@ -989,22 +1016,22 @@ ORDER BY `c3`.`CustomerID` DESC """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `s`.`CustomerID`, `s`.`CustomerID0` FROM ( - SELECT TOP 1 `c1`.`CustomerID`, `c2`.`CustomerID` AS `CustomerID0` + SELECT TOP @p0 `c1`.`CustomerID`, `c2`.`CustomerID` AS `CustomerID0` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, ( SELECT TOP 2 `c3`.`CustomerID` FROM ( - SELECT TOP 4 `c0`.`CustomerID` + SELECT TOP 2 + 2 `c0`.`CustomerID` FROM `Customers` AS `c0` ORDER BY `c0`.`CustomerID` ) AS `c3` ORDER BY `c3`.`CustomerID` DESC ) AS `c2` - ORDER BY `c1`.`CustomerID` + ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID` ) AS `s` INNER JOIN `Orders` AS `o` ON `s`.`CustomerID` = `o`.`CustomerID` ORDER BY `s`.`CustomerID`, `s`.`CustomerID0` @@ -1013,22 +1040,22 @@ ORDER BY `c1`.`CustomerID` """ SELECT `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `s0`.`CustomerID`, `s0`.`CustomerID0` FROM ( - SELECT TOP 1 `c1`.`CustomerID`, `c2`.`CustomerID` AS `CustomerID0` + SELECT TOP @p0 `c1`.`CustomerID`, `c2`.`CustomerID` AS `CustomerID0` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, ( SELECT TOP 2 `c3`.`CustomerID` FROM ( - SELECT TOP 4 `c0`.`CustomerID` + SELECT TOP 2 + 2 `c0`.`CustomerID` FROM `Customers` AS `c0` ORDER BY `c0`.`CustomerID` ) AS `c3` ORDER BY `c3`.`CustomerID` DESC ) AS `c2` - ORDER BY `c1`.`CustomerID` + ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID` ) AS `s0` INNER JOIN `Orders` AS `o0` ON `s0`.`CustomerID0` = `o0`.`CustomerID` ORDER BY `s0`.`CustomerID`, `s0`.`CustomerID0` @@ -1099,7 +1126,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as """ SELECT `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` FROM ( - SELECT TOP 5 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, @@ -1116,9 +1143,9 @@ public override async Task Include_where_skip_take_projection(bool async) """ SELECT `o0`.`CustomerID` FROM ( - SELECT TOP 2 `o2`.`OrderID`, `o2`.`ProductID` + SELECT TOP @p0 `o2`.`OrderID`, `o2`.`ProductID` FROM ( - SELECT TOP 3 `o`.`OrderID`, `o`.`ProductID` + SELECT TOP @p + @p0 `o`.`OrderID`, `o`.`ProductID` FROM `Order Details` AS `o` WHERE `o`.`Quantity` = 10 ORDER BY `o`.`OrderID`, `o`.`ProductID` @@ -1136,16 +1163,16 @@ public override async Task Include_duplicate_collection_result_operator2(bool as AssertSql( """ -SELECT TOP 1 `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region`, `c2`.`CustomerID`, `c2`.`Address`, `c2`.`City`, `c2`.`CompanyName`, `c2`.`ContactName`, `c2`.`ContactTitle`, `c2`.`Country`, `c2`.`Fax`, `c2`.`Phone`, `c2`.`PostalCode`, `c2`.`Region` +SELECT TOP @p0 `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region`, `c2`.`CustomerID`, `c2`.`Address`, `c2`.`City`, `c2`.`CompanyName`, `c2`.`ContactName`, `c2`.`ContactTitle`, `c2`.`Country`, `c2`.`Fax`, `c2`.`Phone`, `c2`.`PostalCode`, `c2`.`Region` FROM ( - SELECT TOP 2 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, ( SELECT TOP 2 `c3`.`CustomerID`, `c3`.`Address`, `c3`.`City`, `c3`.`CompanyName`, `c3`.`ContactName`, `c3`.`ContactTitle`, `c3`.`Country`, `c3`.`Fax`, `c3`.`Phone`, `c3`.`PostalCode`, `c3`.`Region` FROM ( - SELECT TOP 4 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` + SELECT TOP 2 + 2 `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region` FROM `Customers` AS `c0` ORDER BY `c0`.`CustomerID` ) AS `c3` @@ -1157,22 +1184,22 @@ ORDER BY `c3`.`CustomerID` DESC """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `s`.`CustomerID`, `s`.`CustomerID0` FROM ( - SELECT TOP 1 `c1`.`CustomerID`, `c2`.`CustomerID` AS `CustomerID0` + SELECT TOP @p0 `c1`.`CustomerID`, `c2`.`CustomerID` AS `CustomerID0` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, ( SELECT TOP 2 `c3`.`CustomerID` FROM ( - SELECT TOP 4 `c0`.`CustomerID` + SELECT TOP 2 + 2 `c0`.`CustomerID` FROM `Customers` AS `c0` ORDER BY `c0`.`CustomerID` ) AS `c3` ORDER BY `c3`.`CustomerID` DESC ) AS `c2` - ORDER BY `c1`.`CustomerID` + ORDER BY `c1`.`CustomerID`, `c2`.`CustomerID` ) AS `s` INNER JOIN `Orders` AS `o` ON `s`.`CustomerID` = `o`.`CustomerID` ORDER BY `s`.`CustomerID`, `s`.`CustomerID0` @@ -1216,7 +1243,7 @@ public override async Task Include_duplicate_reference(bool async) FROM (( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`CustomerID`, `o`.`OrderID` ) AS `o1`, @@ -1225,7 +1252,7 @@ public override async Task Include_duplicate_reference(bool async) FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`CustomerID`, `o0`.`OrderID` ) AS `o3` @@ -1250,7 +1277,7 @@ public override async Task Include_duplicate_reference2(bool async) FROM ( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o1`, @@ -1259,7 +1286,7 @@ ORDER BY `o`.`OrderID` FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`OrderID` ) AS `o3` @@ -1283,7 +1310,7 @@ public override async Task Include_duplicate_reference3(bool async) FROM ( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o1`, @@ -1292,7 +1319,7 @@ ORDER BY `o`.`OrderID` FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`OrderID` ) AS `o3` @@ -1367,6 +1394,7 @@ ORDER BY `c`.`CustomerID` SELECT TOP 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` = 'ALFKI' + ORDER BY `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`CustomerID` @@ -1429,7 +1457,7 @@ public override async Task Include_with_take(bool async) AssertSql( """ -SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactName` DESC, `c`.`CustomerID` """, @@ -1437,9 +1465,9 @@ public override async Task Include_with_take(bool async) """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c0`.`CustomerID` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`ContactName` + SELECT TOP @p `c`.`CustomerID`, `c`.`ContactName` FROM `Customers` AS `c` - ORDER BY `c`.`ContactName` DESC + ORDER BY `c`.`ContactName` DESC, `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`ContactName` DESC, `c0`.`CustomerID` @@ -1481,7 +1509,7 @@ public override async Task Include_collection_with_multiple_conditional_order_by AssertSql( """ -SELECT TOP 5 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c`.`CustomerID` +SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c`.`CustomerID` FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` ORDER BY NOT (IIF(`o`.`OrderID` > 0, TRUE, FALSE)), IIF(`c`.`CustomerID` IS NOT NULL, `c`.`City`, ''), `o`.`OrderID`, `c`.`CustomerID` @@ -1490,13 +1518,13 @@ ORDER BY NOT (IIF(`o`.`OrderID` > 0, TRUE, FALSE)), IIF(`c`.`CustomerID` IS NOT """ SELECT `o0`.`OrderID`, `o0`.`ProductID`, `o0`.`Discount`, `o0`.`Quantity`, `o0`.`UnitPrice`, `s`.`OrderID`, `s`.`CustomerID` FROM ( - SELECT TOP 5 `s0`.`OrderID`, `s0`.`CustomerID`, `s0`.`c`, `s0`.`c0` + SELECT TOP @p `s0`.`OrderID`, `s0`.`CustomerID`, `s0`.`c`, `s0`.`c0` FROM ( SELECT `o`.`OrderID`, `c`.`CustomerID`, IIF(`o`.`OrderID` > 0, TRUE, FALSE) AS `c`, IIF(`c`.`CustomerID` IS NOT NULL, `c`.`City`, '') AS `c0` FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` ) AS `s0` - ORDER BY NOT (`s0`.`c`), `s0`.`c0` + ORDER BY NOT (`s0`.`c`), `s0`.`c0`, `s0`.`OrderID`, `s0`.`CustomerID` ) AS `s` INNER JOIN `Order Details` AS `o0` ON `s`.`OrderID` = `o0`.`OrderID` ORDER BY NOT (`s`.`c`), `s`.`c0`, `s`.`OrderID`, `s`.`CustomerID` @@ -1535,7 +1563,7 @@ SELECT TOP 1 `o`.`OrderDate` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'W%' ) AS `c2` - ORDER BY `c2`.`c` DESC + ORDER BY `c2`.`c` DESC, `c2`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID` ORDER BY `c0`.`c` DESC, `c0`.`CustomerID`, `o0`.`OrderID` @@ -1554,7 +1582,7 @@ SELECT TOP 1 `o`.`OrderDate` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'W%' ) AS `c3` - ORDER BY `c3`.`c` DESC + ORDER BY `c3`.`c` DESC, `c3`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o0` ON `c0`.`CustomerID` = `o0`.`CustomerID`) LEFT JOIN `Order Details` AS `o1` ON `o0`.`OrderID` = `o1`.`OrderID` @@ -2189,7 +2217,7 @@ public override async Task Multi_level_includes_are_applied_with_skip(bool async FROM ( SELECT TOP 1 `c0`.`CustomerID` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p + 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'A%' ORDER BY `c`.`CustomerID` @@ -2204,7 +2232,7 @@ ORDER BY `c1`.`CustomerID` FROM ( SELECT TOP 1 `c0`.`CustomerID` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p + 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'A%' ORDER BY `c`.`CustomerID` @@ -2220,7 +2248,7 @@ ORDER BY `c0`.`CustomerID` DESC FROM (( SELECT TOP 1 `c0`.`CustomerID` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p + 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'A%' ORDER BY `c`.`CustomerID` @@ -2535,6 +2563,7 @@ ORDER BY `c`.`CustomerID` FROM ( SELECT TOP 1 `c`.`CustomerID` FROM `Customers` AS `c` + ORDER BY `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`CustomerID` @@ -2604,7 +2633,7 @@ public override async Task Include_collection_orderby_take(bool async) AssertSql( """ -SELECT TOP 5 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` """, @@ -2612,7 +2641,7 @@ ORDER BY `c`.`CustomerID` """ SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c0`.`CustomerID` FROM ( - SELECT TOP 5 `c`.`CustomerID` + SELECT TOP @p `c`.`CustomerID` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` @@ -2815,6 +2844,7 @@ ORDER BY `c`.`CustomerID` SELECT TOP 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` = 'ALFKI' + ORDER BY `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` ORDER BY `c0`.`CustomerID`, `o`.`OrderID` @@ -2826,6 +2856,7 @@ SELECT TOP 1 `c`.`CustomerID` SELECT TOP 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` = 'ALFKI' + ORDER BY `c`.`CustomerID` ) AS `c0` INNER JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID`) LEFT JOIN `Order Details` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` @@ -2955,7 +2986,7 @@ public override async Task Repro9735(bool async) AssertSql( """ -SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c`.`CustomerID` +SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`, `c`.`CustomerID` FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` ORDER BY NOT (IIF(`c`.`CustomerID` IS NOT NULL, TRUE, FALSE)), IIF(`c`.`CustomerID` IS NOT NULL, `c`.`CustomerID`, ''), `o`.`OrderID`, `c`.`CustomerID` @@ -2964,13 +2995,13 @@ ORDER BY NOT (IIF(`c`.`CustomerID` IS NOT NULL, TRUE, FALSE)), IIF(`c`.`Customer """ SELECT `o0`.`OrderID`, `o0`.`ProductID`, `o0`.`Discount`, `o0`.`Quantity`, `o0`.`UnitPrice`, `s`.`OrderID`, `s`.`CustomerID` FROM ( - SELECT TOP 2 `s0`.`OrderID`, `s0`.`CustomerID`, `s0`.`c`, `s0`.`c0` + SELECT TOP @p `s0`.`OrderID`, `s0`.`CustomerID`, `s0`.`c`, `s0`.`c0` FROM ( SELECT `o`.`OrderID`, `c`.`CustomerID`, IIF(`c`.`CustomerID` IS NOT NULL, TRUE, FALSE) AS `c`, IIF(`c`.`CustomerID` IS NOT NULL, `c`.`CustomerID`, '') AS `c0` FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` ) AS `s0` - ORDER BY NOT (`s0`.`c`), `s0`.`c0` + ORDER BY NOT (`s0`.`c`), `s0`.`c0`, `s0`.`OrderID`, `s0`.`CustomerID` ) AS `s` INNER JOIN `Order Details` AS `o0` ON `s`.`OrderID` = `o0`.`OrderID` ORDER BY NOT (`s`.`c`), `s`.`c0`, `s`.`OrderID`, `s`.`CustomerID` @@ -3010,6 +3041,7 @@ public override async Task Include_multi_level_reference_then_include_collection FROM `Orders` AS `o` LEFT JOIN `Customers` AS `c` ON `o`.`CustomerID` = `c`.`CustomerID` WHERE `o`.`OrderID` = 10248 + ORDER BY `o`.`OrderID`, `c`.`CustomerID` ) AS `s` INNER JOIN `Orders` AS `o0` ON `s`.`CustomerID` = `o0`.`CustomerID` ORDER BY `s`.`OrderID`, `s`.`CustomerID` diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs index 76bdd188..aaaef68f 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs @@ -277,7 +277,7 @@ public override async Task Include_duplicate_reference3(bool async) FROM ( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o1`, @@ -286,7 +286,7 @@ ORDER BY `o`.`OrderID` FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`OrderID` ) AS `o3` @@ -308,7 +308,7 @@ public override async Task Include_collection_order_by_non_key_with_take(bool as """ SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactTitle` ) AS `c0` @@ -346,7 +346,7 @@ public override async Task Include_collection_take_no_order_by(bool async) """ SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ) AS `c0` LEFT JOIN `Orders` AS `o` ON `c0`.`CustomerID` = `o`.`CustomerID` @@ -505,6 +505,21 @@ public override async Task Include_collection_with_left_join_clause_with_filter( """); } + public override async Task Include_collection_with_right_join_clause_with_filter(bool async) + { + await base.Include_collection_with_right_join_clause_with_filter(async); + + AssertSql( + """ +SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] +FROM [Customers] AS [c] +RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] +LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] +WHERE [c].[CustomerID] LIKE N'F%' +ORDER BY [c].[CustomerID], [o].[OrderID] +"""); + } + public override async Task Include_duplicate_collection(bool async) { await base.Include_duplicate_collection(async); @@ -692,7 +707,7 @@ public override async Task Include_duplicate_reference(bool async) FROM (( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`CustomerID`, `o`.`OrderID` ) AS `o1`, @@ -701,7 +716,7 @@ public override async Task Include_duplicate_reference(bool async) FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`CustomerID`, `o0`.`OrderID` ) AS `o3` @@ -867,7 +882,7 @@ public override async Task Include_collection_on_additional_from_clause2(bool as """ SELECT `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region` FROM ( - SELECT TOP 5 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c1`, @@ -1389,7 +1404,7 @@ public override async Task Multi_level_includes_are_applied_with_skip(bool async FROM ( SELECT TOP 1 `c0`.`CustomerID` FROM ( - SELECT TOP 2 `c`.`CustomerID` + SELECT TOP @p + 1 `c`.`CustomerID` FROM `Customers` AS `c` WHERE `c`.`CustomerID` LIKE 'A%' ORDER BY `c`.`CustomerID` @@ -1639,7 +1654,7 @@ public override async Task Include_collection_orderby_take(bool async) """ SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 5 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`CustomerID` ) AS `c0` @@ -1714,7 +1729,7 @@ public override async Task Include_duplicate_reference2(bool async) FROM ( SELECT `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `o2`.`OrderID` AS `OrderID0`, `o2`.`CustomerID` AS `CustomerID0`, `o2`.`EmployeeID` AS `EmployeeID0`, `o2`.`OrderDate` AS `OrderDate0` FROM ( - SELECT TOP 2 `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` + SELECT TOP @p `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` ORDER BY `o`.`OrderID` ) AS `o1`, @@ -1723,7 +1738,7 @@ ORDER BY `o`.`OrderID` FROM ( SELECT TOP 2 `o3`.`OrderID`, `o3`.`CustomerID`, `o3`.`EmployeeID`, `o3`.`OrderDate` FROM ( - SELECT TOP 4 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` + SELECT TOP 2 + 2 `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Orders` AS `o0` ORDER BY `o0`.`OrderID` ) AS `o3` @@ -2055,9 +2070,9 @@ public override async Task Include_where_skip_take_projection(bool async) """ SELECT `o0`.`CustomerID` FROM ( - SELECT TOP 2 `o2`.`OrderID`, `o2`.`ProductID` + SELECT TOP @p0 `o2`.`OrderID`, `o2`.`ProductID` FROM ( - SELECT TOP 3 `o`.`OrderID`, `o`.`ProductID` + SELECT TOP @p + @p0 `o`.`OrderID`, `o`.`ProductID` FROM `Order Details` AS `o` WHERE `o`.`Quantity` = 10 ORDER BY `o`.`OrderID`, `o`.`ProductID` @@ -2077,7 +2092,7 @@ public override async Task Include_with_take(bool async) """ SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM ( - SELECT TOP 10 `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` + SELECT TOP @p `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` ORDER BY `c`.`ContactName` DESC ) AS `c0` diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs index a38964ad..563ed7ef 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs @@ -58,12 +58,12 @@ public override async Task Where_simple_closure(bool isAsync) var queryString = await base.Where_simple_closure(isAsync); AssertSql( - $""" -@__city_0='London' (Size = 15) + """ +@city='London' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__city_0")} +WHERE `c`.`City` = @city """); return queryString; @@ -74,12 +74,12 @@ public override async Task Where_indexer_closure(bool isAsync) await base.Where_indexer_closure(isAsync); AssertSql( - $""" -@__p_0='London' (Size = 15) + """ +@p='London' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `c`.`City` = @p """); } @@ -88,12 +88,12 @@ public override async Task Where_dictionary_key_access_closure(bool isAsync) await base.Where_dictionary_key_access_closure(isAsync); AssertSql( - $""" -@__get_Item_0='London' (Size = 15) + """ +@get_Item='London' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__get_Item_0")} +WHERE `c`.`City` = @get_Item """); } @@ -102,12 +102,12 @@ public override async Task Where_tuple_item_closure(bool isAsync) await base.Where_tuple_item_closure(isAsync); AssertSql( - $""" -@__predicateTuple_Item2_0='London' (Size = 15) + """ +@predicateTuple_Item2='London' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__predicateTuple_Item2_0")} +WHERE `c`.`City` = @predicateTuple_Item2 """); } @@ -116,12 +116,12 @@ public override async Task Where_named_tuple_item_closure(bool isAsync) await base.Where_named_tuple_item_closure(isAsync); AssertSql( - $""" -@__predicateTuple_Item2_0='London' (Size = 15) + """ +@predicateTuple_Item2='London' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__predicateTuple_Item2_0")} +WHERE `c`.`City` = @predicateTuple_Item2 """); } @@ -130,13 +130,13 @@ public override async Task Where_simple_closure_constant(bool isAsync) await base.Where_simple_closure_constant(isAsync); AssertSql( - $""" - @__predicate_0='True' - - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE {AssertSqlHelper.Parameter("@__predicate_0")} = TRUE - """); + """ +@predicate='True' + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE @predicate = TRUE +"""); } public override async Task Where_simple_closure_via_query_cache(bool isAsync) @@ -144,20 +144,20 @@ public override async Task Where_simple_closure_via_query_cache(bool isAsync) await base.Where_simple_closure_via_query_cache(isAsync); AssertSql( - $""" -@__city_0='London' (Size = 15) + """ +@city='London' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__city_0")} +WHERE `c`.`City` = @city """, // - $""" -@__city_0='Seattle' (Size = 15) + """ +@city='Seattle' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__city_0")} +WHERE `c`.`City` = @city """); } @@ -166,20 +166,20 @@ public override async Task Where_method_call_nullable_type_closure_via_query_cac await base.Where_method_call_nullable_type_closure_via_query_cache(isAsync); AssertSql( - $""" -@__p_0='2' (Nullable = true) (DbType = Decimal) + """ +@p='2' (Nullable = true) (DbType = Decimal) SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` -WHERE IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) = {AssertSqlHelper.Parameter("@__p_0")} +WHERE IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) = @p """, // - $""" -@__p_0='5' (Nullable = true) (DbType = Decimal) + """ +@p='5' (Nullable = true) (DbType = Decimal) SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` -WHERE IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) = {AssertSqlHelper.Parameter("@__p_0")} +WHERE IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) = @p """); } @@ -188,20 +188,20 @@ public override async Task Where_method_call_nullable_type_reverse_closure_via_q await base.Where_method_call_nullable_type_reverse_closure_via_query_cache(isAsync); AssertSql( - $""" -@__p_0='1' (Nullable = true) (DbType = Decimal) + """ +@p='1' (Nullable = true) (DbType = Decimal) SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` -WHERE CLNG(`e`.`EmployeeID`) > {AssertSqlHelper.Parameter("@__p_0")} +WHERE CLNG(`e`.`EmployeeID`) > @p """, // - $""" -@__p_0='5' (Nullable = true) (DbType = Decimal) + """ +@p='5' (Nullable = true) (DbType = Decimal) SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` -WHERE CLNG(`e`.`EmployeeID`) > {AssertSqlHelper.Parameter("@__p_0")} +WHERE CLNG(`e`.`EmployeeID`) > @p """); } @@ -210,20 +210,20 @@ public override async Task Where_method_call_closure_via_query_cache(bool isAsyn await base.Where_method_call_closure_via_query_cache(isAsync); AssertSql( - $""" -@__GetCity_0='London' (Size = 15) + """ +@GetCity='London' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__GetCity_0")} +WHERE `c`.`City` = @GetCity """, // - $""" -@__GetCity_0='Seattle' (Size = 15) + """ +@GetCity='Seattle' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__GetCity_0")} +WHERE `c`.`City` = @GetCity """); } @@ -232,20 +232,20 @@ public override async Task Where_field_access_closure_via_query_cache(bool isAsy await base.Where_field_access_closure_via_query_cache(isAsync); AssertSql( - $""" -@__city_InstanceFieldValue_0='London' (Size = 15) + """ +@city_InstanceFieldValue='London' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__city_InstanceFieldValue_0")} +WHERE `c`.`City` = @city_InstanceFieldValue """, // - $""" -@__city_InstanceFieldValue_0='Seattle' (Size = 15) + """ +@city_InstanceFieldValue='Seattle' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__city_InstanceFieldValue_0")} +WHERE `c`.`City` = @city_InstanceFieldValue """); } @@ -254,20 +254,20 @@ public override async Task Where_property_access_closure_via_query_cache(bool is await base.Where_property_access_closure_via_query_cache(isAsync); AssertSql( - $""" -@__city_InstancePropertyValue_0='London' (Size = 15) + """ +@city_InstancePropertyValue='London' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__city_InstancePropertyValue_0")} +WHERE `c`.`City` = @city_InstancePropertyValue """, // - $""" -@__city_InstancePropertyValue_0='Seattle' (Size = 15) + """ +@city_InstancePropertyValue='Seattle' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__city_InstancePropertyValue_0")} +WHERE `c`.`City` = @city_InstancePropertyValue """); } @@ -276,20 +276,20 @@ public override async Task Where_static_field_access_closure_via_query_cache(boo await base.Where_static_field_access_closure_via_query_cache(isAsync); AssertSql( - $""" -@__StaticFieldValue_0='London' (Size = 15) + """ +@StaticFieldValue='London' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__StaticFieldValue_0")} +WHERE `c`.`City` = @StaticFieldValue """, // - $""" -@__StaticFieldValue_0='Seattle' (Size = 15) + """ +@StaticFieldValue='Seattle' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__StaticFieldValue_0")} +WHERE `c`.`City` = @StaticFieldValue """); } @@ -298,20 +298,20 @@ public override async Task Where_static_property_access_closure_via_query_cache( await base.Where_static_property_access_closure_via_query_cache(isAsync); AssertSql( - $""" -@__StaticPropertyValue_0='London' (Size = 15) + """ +@StaticPropertyValue='London' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__StaticPropertyValue_0")} +WHERE `c`.`City` = @StaticPropertyValue """, // - $""" -@__StaticPropertyValue_0='Seattle' (Size = 15) + """ +@StaticPropertyValue='Seattle' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__StaticPropertyValue_0")} +WHERE `c`.`City` = @StaticPropertyValue """); } @@ -320,20 +320,20 @@ public override async Task Where_nested_field_access_closure_via_query_cache(boo await base.Where_nested_field_access_closure_via_query_cache(isAsync); AssertSql( - $""" -@__city_Nested_InstanceFieldValue_0='London' (Size = 15) + """ +@city_Nested_InstanceFieldValue='London' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__city_Nested_InstanceFieldValue_0")} +WHERE `c`.`City` = @city_Nested_InstanceFieldValue """, // - $""" -@__city_Nested_InstanceFieldValue_0='Seattle' (Size = 15) + """ +@city_Nested_InstanceFieldValue='Seattle' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__city_Nested_InstanceFieldValue_0")} +WHERE `c`.`City` = @city_Nested_InstanceFieldValue """); } @@ -342,20 +342,20 @@ public override async Task Where_nested_property_access_closure_via_query_cache( await base.Where_nested_property_access_closure_via_query_cache(isAsync); AssertSql( - $""" -@__city_Nested_InstancePropertyValue_0='London' (Size = 15) + """ +@city_Nested_InstancePropertyValue='London' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__city_Nested_InstancePropertyValue_0")} +WHERE `c`.`City` = @city_Nested_InstancePropertyValue """, // - $""" -@__city_Nested_InstancePropertyValue_0='Seattle' (Size = 15) + """ +@city_Nested_InstancePropertyValue='Seattle' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__city_Nested_InstancePropertyValue_0")} +WHERE `c`.`City` = @city_Nested_InstancePropertyValue """); } @@ -364,20 +364,20 @@ public override async Task Where_new_instance_field_access_query_cache(bool isAs await base.Where_new_instance_field_access_query_cache(isAsync); AssertSql( - $""" -@__InstanceFieldValue_0='London' (Size = 15) + """ +@InstanceFieldValue='London' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__InstanceFieldValue_0")} +WHERE `c`.`City` = @InstanceFieldValue """, // - $""" -@__InstanceFieldValue_0='Seattle' (Size = 15) + """ +@InstanceFieldValue='Seattle' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__InstanceFieldValue_0")} +WHERE `c`.`City` = @InstanceFieldValue """); } @@ -386,20 +386,20 @@ public override async Task Where_new_instance_field_access_closure_via_query_cac await base.Where_new_instance_field_access_closure_via_query_cache(isAsync); AssertSql( - $""" -@__InstanceFieldValue_0='London' (Size = 15) + """ +@InstanceFieldValue='London' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__InstanceFieldValue_0")} +WHERE `c`.`City` = @InstanceFieldValue """, // - $""" -@__InstanceFieldValue_0='Seattle' (Size = 15) + """ +@InstanceFieldValue='Seattle' (Size = 15) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`City` = {AssertSqlHelper.Parameter("@__InstanceFieldValue_0")} +WHERE `c`.`City` = @InstanceFieldValue """); } @@ -408,20 +408,20 @@ public override async Task Where_simple_closure_via_query_cache_nullable_type(bo await base.Where_simple_closure_via_query_cache_nullable_type(isAsync); AssertSql( - $""" -@__p_0='2' (Nullable = true) (DbType = Decimal) + """ +@p='2' (Nullable = true) (DbType = Decimal) SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` -WHERE IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) = {AssertSqlHelper.Parameter("@__p_0")} +WHERE IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) = @p """, // - $""" -@__p_0='5' (Nullable = true) (DbType = Decimal) + """ +@p='5' (Nullable = true) (DbType = Decimal) SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` -WHERE IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) = {AssertSqlHelper.Parameter("@__p_0")} +WHERE IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) = @p """, // """ @@ -442,20 +442,20 @@ public override async Task Where_simple_closure_via_query_cache_nullable_type_re WHERE `e`.`ReportsTo` IS NULL """, // - $""" -@__p_0='5' (Nullable = true) (DbType = Decimal) + """ +@p='5' (Nullable = true) (DbType = Decimal) SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` -WHERE IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) = {AssertSqlHelper.Parameter("@__p_0")} +WHERE IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) = @p """, // - $""" -@__p_0='2' (Nullable = true) (DbType = Decimal) + """ +@p='2' (Nullable = true) (DbType = Decimal) SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` -WHERE IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) = {AssertSqlHelper.Parameter("@__p_0")} +WHERE IIF(`e`.`ReportsTo` IS NULL, NULL, CLNG(`e`.`ReportsTo`)) = @p """); } @@ -463,63 +463,27 @@ public override async Task Where_subquery_closure_via_query_cache(bool isAsync) { await base.Where_subquery_closure_via_query_cache(isAsync); - AssertSql( - $""" - {AssertSqlHelper.Declaration("@__customerID_0='ALFKI' (Size = 5)")} - - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE EXISTS ( - SELECT 1 - FROM `Orders` AS `o` - WHERE `o`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID_0")} AND `o`.`CustomerID` = `c`.`CustomerID`) - """, - // - $""" - {AssertSqlHelper.Declaration("@__customerID_0='ANATR' (Size = 5)")} - - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE EXISTS ( - SELECT 1 - FROM `Orders` AS `o` - WHERE `o`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID_0")} AND `o`.`CustomerID` = `c`.`CustomerID`) - """); - } - - public override async Task Where_bitwise_or(bool isAsync) - { - await base.Where_bitwise_or(isAsync); - AssertSql( """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE `c`.`CustomerID` IN ('ALFKI', 'ANATR') -"""); - } - - public override async Task Where_bitwise_and(bool isAsync) - { - await base.Where_bitwise_and(isAsync); +@customerID='ALFKI' (Size = 5) - AssertSql( - """ SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE 0 = 1 -"""); - } - - public override async Task Where_bitwise_xor(bool isAsync) - { - await base.Where_bitwise_xor(isAsync); - - AssertSql( +WHERE EXISTS ( + SELECT 1 + FROM `Orders` AS `o` + WHERE `o`.`CustomerID` = @customerID AND `o`.`CustomerID` = `c`.`CustomerID`) +""", + // """ +@customerID='ANATR' (Size = 5) + SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE (IIF(`c`.`CustomerID` = 'ALFKI', TRUE, FALSE) BXOR TRUE) = TRUE +WHERE EXISTS ( + SELECT 1 + FROM `Orders` AS `o` + WHERE `o`.`CustomerID` = @customerID AND `o`.`CustomerID` = `c`.`CustomerID`) """); } @@ -580,18 +544,6 @@ SELECT 1 """); } - public override async Task Where_equals_method_string(bool isAsync) - { - await base.Where_equals_method_string(isAsync); - - AssertSql( - $""" - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE `c`.`City` = 'London' - """); - } - public override async Task Where_equals_method_int(bool isAsync) { await base.Where_equals_method_int(isAsync); @@ -626,13 +578,13 @@ public override async Task Where_equals_using_int_overload_on_mismatched_types(b await base.Where_equals_using_int_overload_on_mismatched_types(isAsync); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='1'")} - - SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` - FROM `Employees` AS `e` - WHERE `e`.`EmployeeID` = {AssertSqlHelper.Parameter("@__p_0")} - """); + """ +@p='1' + +SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` +FROM `Employees` AS `e` +WHERE `e`.`EmployeeID` = @p +"""); } public override async Task Where_equals_on_mismatched_types_nullable_int_long(bool isAsync) @@ -696,21 +648,21 @@ public override async Task Where_equals_on_mismatched_types_int_nullable_int(boo await base.Where_equals_on_mismatched_types_int_nullable_int(isAsync); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__intPrm_0='2'")} - - SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` - FROM `Employees` AS `e` - WHERE `e`.`ReportsTo` = {AssertSqlHelper.Parameter("@__intPrm_0")} - """, + """ +@intPrm='2' + +SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` +FROM `Employees` AS `e` +WHERE `e`.`ReportsTo` = @intPrm +""", // - $""" - {AssertSqlHelper.Declaration("@__intPrm_0='2'")} - - SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` - FROM `Employees` AS `e` - WHERE {AssertSqlHelper.Parameter("@__intPrm_0")} = `e`.`ReportsTo` - """); + """ +@intPrm='2' + +SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` +FROM `Employees` AS `e` +WHERE @intPrm = `e`.`ReportsTo` +"""); } public override async Task Where_equals_on_matched_nullable_int_types(bool isAsync) @@ -718,21 +670,21 @@ public override async Task Where_equals_on_matched_nullable_int_types(bool isAsy await base.Where_equals_on_matched_nullable_int_types(isAsync); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__nullableIntPrm_0='2' (Nullable = true)")} - - SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` - FROM `Employees` AS `e` - WHERE {AssertSqlHelper.Parameter("@__nullableIntPrm_0")} = `e`.`ReportsTo` - """, + """ +@nullableIntPrm='2' (Nullable = true) + +SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` +FROM `Employees` AS `e` +WHERE @nullableIntPrm = `e`.`ReportsTo` +""", // - $""" - {AssertSqlHelper.Declaration("@__nullableIntPrm_0='2' (Nullable = true)")} - - SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` - FROM `Employees` AS `e` - WHERE `e`.`ReportsTo` = {AssertSqlHelper.Parameter("@__nullableIntPrm_0")} - """); + """ +@nullableIntPrm='2' (Nullable = true) + +SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` +FROM `Employees` AS `e` +WHERE `e`.`ReportsTo` = @nullableIntPrm +"""); } public override async Task Where_equals_on_null_nullable_int_types(bool isAsync) @@ -777,258 +729,6 @@ public override async Task Where_comparison_nullable_type_null(bool isAsync) """); } - public override async Task Where_string_length(bool isAsync) - { - await base.Where_string_length(isAsync); - - AssertSql( - """ - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE IIF(LEN(`c`.`City`) IS NULL, NULL, CLNG(LEN(`c`.`City`))) = 6 - """); - } - - public override async Task Where_string_indexof(bool isAsync) - { - await base.Where_string_indexof(isAsync); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE (INSTR(1, `c`.`City`, 'Sea', 1) - 1) <> -1 OR `c`.`City` IS NULL -"""); - } - - public override async Task Where_string_replace(bool isAsync) - { - await base.Where_string_replace(isAsync); - - AssertSql( - $""" - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE REPLACE(`c`.`City`, 'Sea', 'Rea') = 'Reattle' - """); - } - - public override async Task Where_string_substring(bool isAsync) - { - await base.Where_string_substring(isAsync); - - AssertSql( - $""" - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE MID(`c`.`City`, 1 + 1, 2) = 'ea' - """); - } - - public override async Task Where_datetime_now(bool isAsync) - { - await base.Where_datetime_now(isAsync); - - AssertSql( - $""" - {AssertSqlHelper.Declaration("@__myDatetime_0='2015-04-10T00:00:00.0000000' (DbType = DateTime)")} - - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE NOW() <> CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) - """); - } - - public override async Task Where_datetime_utcnow(bool isAsync) - { - var dtoffset = -1 * TimeZoneInfo.Local.BaseUtcOffset.TotalMinutes; - await base.Where_datetime_utcnow(isAsync); - - AssertSql( - $""" - {AssertSqlHelper.Declaration("@__myDatetime_0='2015-04-10T00:00:00.0000000' (DbType = DateTime)")} - - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE DATEADD('n', {dtoffset}.0, NOW()) <> CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) - """); - } - - public override async Task Where_datetimeoffset_utcnow(bool async) - { - var dtoffset = -1 * TimeZoneInfo.Local.BaseUtcOffset.TotalMinutes; - await base.Where_datetimeoffset_utcnow(async); - - AssertSql( - $""" -@__myDatetimeOffset_0='2015-04-10T08:00:00.0000000Z' (DbType = DateTime) - -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE DATEADD('n', {dtoffset}.0, NOW()) <> @__myDatetimeOffset_0 -"""); - } - - public override async Task Where_datetime_today(bool isAsync) - { - await base.Where_datetime_today(isAsync); - - AssertSql( -""" -SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` -FROM `Employees` AS `e` -WHERE DATEVALUE(NOW()) = DATEVALUE(DATE()) -"""); - } - - public override async Task Where_datetime_date_component(bool isAsync) - { - await base.Where_datetime_date_component(isAsync); - - - AssertSql( - $""" - {AssertSqlHelper.Declaration("@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime)")} - - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE IIF(`o`.`OrderDate` IS NULL, NULL, DATEVALUE(`o`.`OrderDate`)) = CDATE({AssertSqlHelper.Parameter("@__myDatetime_0")}) - """); - } - - public override async Task Where_date_add_year_constant_component(bool isAsync) - { - await base.Where_date_add_year_constant_component(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE DATEPART('yyyy', DATEADD('yyyy', -1, `o`.`OrderDate`)) = 1997 - """); - } - - public override async Task Where_datetime_year_component(bool isAsync) - { - await base.Where_datetime_year_component(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE DATEPART('yyyy', `o`.`OrderDate`) = 1998 - """); - } - - public override async Task Where_datetime_month_component(bool isAsync) - { - await base.Where_datetime_month_component(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE DATEPART('m', `o`.`OrderDate`) = 4 - """); - } - - public override async Task Where_datetime_dayOfYear_component(bool isAsync) - { - await base.Where_datetime_dayOfYear_component(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE DATEPART('y', `o`.`OrderDate`) = 68 - """); - } - - public override async Task Where_datetime_day_component(bool isAsync) - { - await base.Where_datetime_day_component(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE DATEPART('d', `o`.`OrderDate`) = 4 - """); - } - - public override async Task Where_datetime_hour_component(bool isAsync) - { - await base.Where_datetime_hour_component(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE DATEPART('h', `o`.`OrderDate`) = 0 - """); - } - - public override async Task Where_datetime_minute_component(bool isAsync) - { - await base.Where_datetime_minute_component(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE DATEPART('n', `o`.`OrderDate`) = 0 - """); - } - - public override async Task Where_datetime_second_component(bool isAsync) - { - await base.Where_datetime_second_component(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE DATEPART('s', `o`.`OrderDate`) = 0 - """); - } - - public override async Task Where_datetime_millisecond_component(bool isAsync) - { - await base.Where_datetime_millisecond_component(isAsync); - - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE DATEPART(millisecond, `o`.`OrderDate`) = 88 - """); - } - - public override async Task Where_datetimeoffset_now_component(bool isAsync) - { - await base.Where_datetimeoffset_now_component(isAsync); - - AssertSql( - """ -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderDate` < NOW() -"""); - } - - public override async Task Where_datetimeoffset_utcnow_component(bool isAsync) - { - var dtoffset = -1 * TimeZoneInfo.Local.BaseUtcOffset.TotalMinutes; - await base.Where_datetimeoffset_utcnow_component(isAsync); - - AssertSql( - $""" -SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` -FROM `Orders` AS `o` -WHERE `o`.`OrderDate` <> DATEADD('n', {dtoffset}.0, NOW()) OR `o`.`OrderDate` IS NULL -"""); - } - public override async Task Where_simple_reversed(bool isAsync) { await base.Where_simple_reversed(isAsync); @@ -1209,7 +909,7 @@ public override async Task Where_primitive(bool isAsync) """ SELECT `e0`.`EmployeeID` FROM ( - SELECT TOP 9 `e`.`EmployeeID` + SELECT TOP @p `e`.`EmployeeID` FROM `Employees` AS `e` ) AS `e0` WHERE `e0`.`EmployeeID` = 5 @@ -1352,13 +1052,13 @@ public override async Task Where_bool_parameter(bool isAsync) await base.Where_bool_parameter(isAsync); AssertSql( - $""" - @__prm_0='True' - - SELECT `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` - FROM `Products` AS `p` - WHERE {AssertSqlHelper.Parameter("@__prm_0")} = TRUE - """); + """ +@prm='True' + +SELECT `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` +FROM `Products` AS `p` +WHERE @prm = TRUE +"""); } public override async Task Where_bool_parameter_compared_to_binary_expression(bool isAsync) @@ -1366,13 +1066,13 @@ public override async Task Where_bool_parameter_compared_to_binary_expression(bo await base.Where_bool_parameter_compared_to_binary_expression(isAsync); AssertSql( - $""" - @__prm_0='True' - - SELECT `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` - FROM `Products` AS `p` - WHERE IIF(`p`.`ProductID` > 50, TRUE, FALSE) <> {AssertSqlHelper.Parameter("@__prm_0")} - """); + """ +@prm='True' + +SELECT `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` +FROM `Products` AS `p` +WHERE IIF(`p`.`ProductID` > 50, TRUE, FALSE) <> @prm +"""); } public override async Task Where_bool_member_and_parameter_compared_to_binary_expression_nested(bool isAsync) @@ -1380,12 +1080,12 @@ public override async Task Where_bool_member_and_parameter_compared_to_binary_ex await base.Where_bool_member_and_parameter_compared_to_binary_expression_nested(isAsync); AssertSql( - $""" -@__prm_0='True' + """ +@prm='True' SELECT `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM `Products` AS `p` -WHERE `p`.`Discontinued` = (IIF(`p`.`ProductID` > 50, TRUE, FALSE) BXOR {AssertSqlHelper.Parameter("@__prm_0")}) +WHERE `p`.`Discontinued` = (IIF(`p`.`ProductID` > 50, TRUE, FALSE) BXOR @prm) """); } @@ -1521,120 +1221,6 @@ public override async Task Where_expression_invoke_3(bool async) """); } - public override async Task Where_concat_string_int_comparison1(bool isAsync) - { - await base.Where_concat_string_int_comparison1(isAsync); - - AssertSql( - $""" -@__i_0='10' - -SELECT `c`.`CustomerID` -FROM `Customers` AS `c` -WHERE (`c`.`CustomerID` & ({AssertSqlHelper.Parameter("@__i_0")} & '')) = `c`.`CompanyName` -"""); - } - - public override async Task Where_concat_string_int_comparison2(bool isAsync) - { - await base.Where_concat_string_int_comparison2(isAsync); - - AssertSql( - $""" -@__i_0='10' - -SELECT `c`.`CustomerID` -FROM `Customers` AS `c` -WHERE (({AssertSqlHelper.Parameter("@__i_0")} & '') & `c`.`CustomerID`) = `c`.`CompanyName` -"""); - } - - public override async Task Where_concat_string_int_comparison3(bool isAsync) - { - await base.Where_concat_string_int_comparison3(isAsync); - - AssertSql( - $""" -@__p_0='30' -@__j_1='21' - -SELECT `c`.`CustomerID` -FROM `Customers` AS `c` -WHERE (((({AssertSqlHelper.Parameter("@__p_0")} & '') & `c`.`CustomerID`) & ({AssertSqlHelper.Parameter("@__j_1")} & '')) & (42 & '')) = `c`.`CompanyName` -"""); - } - - public override async Task Where_concat_string_int_comparison4(bool isAsync) - { - await base.Where_concat_string_int_comparison4(isAsync); - - AssertSql( - """ -SELECT `o`.`CustomerID` -FROM `Orders` AS `o` -WHERE ((`o`.`OrderID` & '') & IIF(`o`.`CustomerID` IS NULL, '', `o`.`CustomerID`)) = `o`.`CustomerID` -"""); - } - - public override async Task Where_concat_string_string_comparison(bool isAsync) - { - await base.Where_concat_string_string_comparison(isAsync); - - AssertSql( - $""" -@__i_0='A' (Size = 255) - -SELECT `c`.`CustomerID` -FROM `Customers` AS `c` -WHERE ({AssertSqlHelper.Parameter("@__i_0")} & `c`.`CustomerID`) = 'AALFKI' -"""); - } - - public override async Task Where_string_concat_method_comparison(bool isAsync) - { - await base.Where_string_concat_method_comparison(isAsync); - - AssertSql( - $""" -@__i_0='A' (Size = 255) - -SELECT `c`.`CustomerID` -FROM `Customers` AS `c` -WHERE ({AssertSqlHelper.Parameter("@__i_0")} & `c`.`CustomerID`) = 'AAROUT' -"""); - } - - public override async Task Where_string_concat_method_comparison_2(bool async) - { - await base.Where_string_concat_method_comparison_2(async); - - AssertSql( - $""" -@__i_0='A' (Size = 255) -@__j_1='B' (Size = 255) - -SELECT `c`.`CustomerID` -FROM `Customers` AS `c` -WHERE ({AssertSqlHelper.Parameter("@__i_0")} & ({AssertSqlHelper.Parameter("@__j_1")} & `c`.`CustomerID`)) = 'ABANATR' -"""); - } - - public override async Task Where_string_concat_method_comparison_3(bool async) - { - await base.Where_string_concat_method_comparison_3(async); - - AssertSql( - $""" -@__i_0='A' (Size = 255) -@__j_1='B' (Size = 255) -@__k_2='C' (Size = 255) - -SELECT `c`.`CustomerID` -FROM `Customers` AS `c` -WHERE ({AssertSqlHelper.Parameter("@__i_0")} & ({AssertSqlHelper.Parameter("@__j_1")} & ({AssertSqlHelper.Parameter("@__k_2")} & `c`.`CustomerID`))) = 'ABCANTON' -"""); - } - public override async Task Where_ternary_boolean_condition_true(bool isAsync) { await base.Where_ternary_boolean_condition_true(isAsync); @@ -1664,13 +1250,13 @@ public override async Task Where_ternary_boolean_condition_with_another_conditio await base.Where_ternary_boolean_condition_with_another_condition(isAsync); AssertSql( - $""" - @__productId_0='15' - - SELECT `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` - FROM `Products` AS `p` - WHERE `p`.`ProductID` < {AssertSqlHelper.Parameter("@__productId_0")} AND `p`.`UnitsInStock` >= 20 - """); + """ +@productId='15' + +SELECT `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` +FROM `Products` AS `p` +WHERE `p`.`ProductID` < @productId AND `p`.`UnitsInStock` >= 20 +"""); } public override async Task Where_ternary_boolean_condition_with_false_as_result_true(bool isAsync) @@ -1869,13 +1455,13 @@ public override async Task Where_array_index(bool isAsync) await base.Where_array_index(isAsync); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='ALFKI' (Size = 5)")} - - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__p_0")} - """); + """ +@p='ALFKI' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = @p +"""); } public override async Task Where_multiple_contains_in_subquery_with_or(bool isAsync) @@ -1969,31 +1555,20 @@ SELECT TOP 1 `o`.`OrderID` """); } - public override async Task Time_of_day_datetime(bool isAsync) + public override async Task TypeBinary_short_circuit(bool isAsync) { - await base.Time_of_day_datetime(isAsync); + await base.TypeBinary_short_circuit(isAsync); AssertSql( """ -SELECT IIF(`o`.`OrderDate` IS NULL, NULL, TIMEVALUE(`o`.`OrderDate`)) +@p='False' + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` +WHERE @p = TRUE """); } - public override async Task TypeBinary_short_circuit(bool isAsync) - { - await base.TypeBinary_short_circuit(isAsync); - - AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='False'")} - - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE {AssertSqlHelper.Parameter("@__p_0")} = TRUE - """); - } - public override async Task Where_is_conditional(bool isAsync) { await base.Where_is_conditional(isAsync); @@ -2011,21 +1586,21 @@ public override async Task Enclosing_class_settable_member_generates_parameter(b await base.Enclosing_class_settable_member_generates_parameter(isAsync); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__SettableProperty_0='10274'")} - - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE `o`.`OrderID` = {AssertSqlHelper.Parameter("@__SettableProperty_0")} - """, + """ +@SettableProperty='10274' + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderID` = @SettableProperty +""", // - $""" - {AssertSqlHelper.Declaration("@__SettableProperty_0='10275'")} - - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE `o`.`OrderID` = {AssertSqlHelper.Parameter("@__SettableProperty_0")} - """); + """ +@SettableProperty='10275' + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderID` = @SettableProperty +"""); } public override async Task Enclosing_class_readonly_member_generates_parameter(bool isAsync) @@ -2033,13 +1608,13 @@ public override async Task Enclosing_class_readonly_member_generates_parameter(b await base.Enclosing_class_readonly_member_generates_parameter(isAsync); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ReadOnlyProperty_0='10275'")} - - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE `o`.`OrderID` = {AssertSqlHelper.Parameter("@__ReadOnlyProperty_0")} - """); + """ +@ReadOnlyProperty='10275' + +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderID` = @ReadOnlyProperty +"""); } public override async Task Enclosing_class_const_member_does_not_generate_parameter(bool isAsync) @@ -2081,42 +1656,33 @@ SELECT TOP 1 IIF(LEN(`o`.`CustomerID`) IS NULL, NULL, CLNG(LEN(`o`.`CustomerID`) """); } - public override async Task Like_with_non_string_column_using_ToString(bool isAsync) + public override async Task Using_same_parameter_twice_in_query_generates_one_sql_parameter(bool async) { - await base.Like_with_non_string_column_using_ToString(isAsync); + await base.Using_same_parameter_twice_in_query_generates_one_sql_parameter(async); AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`OrderID` & '') LIKE '%20%' - """); - } - - public override async Task Like_with_non_string_column_using_double_cast(bool isAsync) - { - await base.Like_with_non_string_column_using_double_cast(isAsync); + """ +@i='10' +@i='10' - AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE (`o`.`OrderID` & '') LIKE '%20%' - """); +SELECT `c`.`CustomerID` +FROM `Customers` AS `c` +WHERE (((@i & '') & `c`.`CustomerID`) & (@i & '')) = '10ALFKI10' +"""); } - public override async Task Using_same_parameter_twice_in_query_generates_one_sql_parameter(bool async) + public override async Task Two_parameters_with_same_name_get_uniquified(bool async) { - await base.Using_same_parameter_twice_in_query_generates_one_sql_parameter(async); + await base.Two_parameters_with_same_name_get_uniquified(async); AssertSql( - $""" -@__i_0='10' -@__i_0='10' + """ +@p='11' +@p0='12' -SELECT `c`.`CustomerID` +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE ((({AssertSqlHelper.Parameter("@__i_0")} & '') & `c`.`CustomerID`) & ({AssertSqlHelper.Parameter("@__i_0")} & '')) = '10ALFKI10' +WHERE ((`c`.`CustomerID` & (@p & '')) & (`c`.`CustomerID` & (@p0 & ''))) = 'ALFKI11ALFKI12' """); } @@ -2303,18 +1869,18 @@ public override async Task Where_collection_navigation_ToList_Contains(bool asyn await base.Where_collection_navigation_ToList_Contains(async); AssertSql( - $""" - @__entity_equality_order_0_OrderID='10248' (Nullable = true) - - SELECT `c`.`CustomerID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` - FROM `Customers` AS `c` - LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` - WHERE EXISTS ( - SELECT 1 - FROM `Orders` AS `o` - WHERE `c`.`CustomerID` = `o`.`CustomerID` AND `o`.`OrderID` = {AssertSqlHelper.Parameter("@__entity_equality_order_0_OrderID")}) - ORDER BY `c`.`CustomerID`, `o0`.`OrderID` - """); + """ +@entity_equality_order_OrderID='10248' (Nullable = true) + +SELECT `c`.`CustomerID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` +FROM `Customers` AS `c` +LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` +WHERE EXISTS ( + SELECT 1 + FROM `Orders` AS `o` + WHERE `c`.`CustomerID` = `o`.`CustomerID` AND `o`.`OrderID` = @entity_equality_order_OrderID) +ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +"""); } public override async Task Where_collection_navigation_ToArray_Count(bool async) @@ -2334,25 +1900,6 @@ SELECT COUNT(*) """); } - public override async Task Where_collection_navigation_ToArray_Contains(bool async) - { - await base.Where_collection_navigation_ToArray_Contains(async); - - AssertSql( - $""" - @__entity_equality_order_0_OrderID='10248' (Nullable = true) - - SELECT `c`.`CustomerID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` - FROM `Customers` AS `c` - LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` - WHERE EXISTS ( - SELECT 1 - FROM `Orders` AS `o` - WHERE `c`.`CustomerID` = `o`.`CustomerID` AND `o`.`OrderID` = {AssertSqlHelper.Parameter("@__entity_equality_order_0_OrderID")}) - ORDER BY `c`.`CustomerID`, `o0`.`OrderID` - """); - } - public override async Task Where_collection_navigation_AsEnumerable_Count(bool async) { await base.Where_collection_navigation_AsEnumerable_Count(async); @@ -2375,18 +1922,18 @@ public override async Task Where_collection_navigation_AsEnumerable_Contains(boo await base.Where_collection_navigation_AsEnumerable_Contains(async); AssertSql( - $""" - @__entity_equality_order_0_OrderID='10248' (Nullable = true) - - SELECT `c`.`CustomerID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` - FROM `Customers` AS `c` - LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` - WHERE EXISTS ( - SELECT 1 - FROM `Orders` AS `o` - WHERE `c`.`CustomerID` = `o`.`CustomerID` AND `o`.`OrderID` = {AssertSqlHelper.Parameter("@__entity_equality_order_0_OrderID")}) - ORDER BY `c`.`CustomerID`, `o0`.`OrderID` - """); + """ +@entity_equality_order_OrderID='10248' (Nullable = true) + +SELECT `c`.`CustomerID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` +FROM `Customers` AS `c` +LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` +WHERE EXISTS ( + SELECT 1 + FROM `Orders` AS `o` + WHERE `c`.`CustomerID` = `o`.`CustomerID` AND `o`.`OrderID` = @entity_equality_order_OrderID) +ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +"""); } public override async Task Where_collection_navigation_ToList_Count_member(bool async) @@ -2435,18 +1982,6 @@ public override async Task Where_list_object_contains_over_value_type(bool async """); } - public override async Task Where_array_of_object_contains_over_value_type(bool async) - { - await base.Where_array_of_object_contains_over_value_type(async); - - AssertSql( - """ - SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` - FROM `Orders` AS `o` - WHERE `o`.`OrderID` IN (10248, 10249) - """); - } - public override async Task Multiple_OrElse_on_same_column_converted_to_in_with_overlap(bool async) { await base.Multiple_OrElse_on_same_column_converted_to_in_with_overlap(async); @@ -2524,15 +2059,15 @@ public override async Task Multiple_AndAlso_on_same_column_converted_to_in_using await base.Multiple_AndAlso_on_same_column_converted_to_in_using_parameters(async); AssertSql( -$""" - @__prm1_0='ALFKI' (Size = 5) - @__prm2_1='ANATR' (Size = 5) - @__prm3_2='ANTON' (Size = 5) - - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` <> {AssertSqlHelper.Parameter("@__prm1_0")} AND `c`.`CustomerID` <> {AssertSqlHelper.Parameter("@__prm2_1")} AND `c`.`CustomerID` <> {AssertSqlHelper.Parameter("@__prm3_2")} - """); + """ +@prm1='ALFKI' (Size = 5) +@prm2='ANATR' (Size = 5) +@prm3='ANTON' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` <> @prm1 AND `c`.`CustomerID` <> @prm2 AND `c`.`CustomerID` <> @prm3 +"""); } public override async Task Array_of_parameters_Contains_OrElse_comparison_with_constant_gets_combined_to_one_in(bool async) @@ -2541,13 +2076,13 @@ public override async Task Array_of_parameters_Contains_OrElse_comparison_with_c // issue #21462 AssertSql( - $""" -@__prm1_0='ALFKI' (Size = 5) -@__prm2_1='ANATR' (Size = 5) + """ +@prm1='ALFKI' (Size = 5) +@prm2='ANATR' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` IN ({AssertSqlHelper.Parameter("@__prm1_0")}, {AssertSqlHelper.Parameter("@__prm2_1")}, 'ANTON') +WHERE `c`.`CustomerID` IN (@prm1, @prm2, 'ANTON') """); } @@ -2581,14 +2116,14 @@ public override async Task Parameter_array_Contains_OrElse_comparison_with_param await base.Parameter_array_Contains_OrElse_comparison_with_parameter_with_overlap(async); AssertSql( - $""" - @__prm1_0='ANTON' (Size = 5) - @__prm2_2='ALFKI' (Size = 5) - - SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM `Customers` AS `c` - WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__prm1_0")} OR `c`.`CustomerID` IN ('ALFKI', 'ANATR') OR `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__prm2_2")} - """); + """ +@prm1='ANTON' (Size = 5) +@prm2='ALFKI' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = @prm1 OR `c`.`CustomerID` IN ('ALFKI', 'ANATR') OR `c`.`CustomerID` = @prm2 +"""); } public override async Task Two_sets_of_comparison_combine_correctly(bool async) @@ -2907,30 +2442,6 @@ public override async Task Where_Contains_or_comparison(bool async) """); } - public override async Task Where_Like_and_comparison(bool async) - { - await base.Where_Like_and_comparison(async); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE (`c`.`CustomerID` LIKE 'F%') AND `c`.`City` = 'Seattle' -"""); - } - - public override async Task Where_Like_or_comparison(bool async) - { - await base.Where_Like_or_comparison(async); - - AssertSql( - """ -SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` -FROM `Customers` AS `c` -WHERE (`c`.`CustomerID` LIKE 'F%') OR `c`.`City` = 'Seattle' -"""); - } - public override async Task GetType_on_non_hierarchy1(bool async) { await base.GetType_on_non_hierarchy1(async); @@ -2994,20 +2505,20 @@ public override async Task Where_poco_closure(bool async) await base.Where_poco_closure(async); AssertSql( - $""" -@__entity_equality_customer_0_CustomerID='ALFKI' (Size = 5) + """ +@entity_equality_customer_CustomerID='ALFKI' (Size = 5) SELECT `c`.`CustomerID` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__entity_equality_customer_0_CustomerID")} +WHERE `c`.`CustomerID` = @entity_equality_customer_CustomerID """, // - $""" -@__entity_equality_customer_0_CustomerID='ANATR' (Size = 5) + """ +@entity_equality_customer_CustomerID='ANATR' (Size = 5) SELECT `c`.`CustomerID` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__entity_equality_customer_0_CustomerID")} +WHERE `c`.`CustomerID` = @entity_equality_customer_CustomerID """); } @@ -3031,7 +2542,7 @@ public override async Task Where_simple_shadow_subquery(bool async) """ SELECT `e0`.`EmployeeID`, `e0`.`City`, `e0`.`Country`, `e0`.`FirstName`, `e0`.`ReportsTo`, `e0`.`Title` FROM ( - SELECT TOP 5 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` + SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` ) AS `e0` @@ -3048,7 +2559,7 @@ public override async Task Where_primitive_tracked2(bool async) """ SELECT `e0`.`EmployeeID`, `e0`.`City`, `e0`.`Country`, `e0`.`FirstName`, `e0`.`ReportsTo`, `e0`.`Title` FROM ( - SELECT TOP 9 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` + SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` ) AS `e0` WHERE `e0`.`EmployeeID` = 5 @@ -3104,7 +2615,7 @@ public override async Task Where_primitive_tracked(bool async) """ SELECT `e0`.`EmployeeID`, `e0`.`City`, `e0`.`Country`, `e0`.`FirstName`, `e0`.`ReportsTo`, `e0`.`Title` FROM ( - SELECT TOP 9 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` + SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` ) AS `e0` WHERE `e0`.`EmployeeID` = 5 @@ -3142,13 +2653,6 @@ public override async Task Where_bool_client_side_negated(bool async) AssertSql(); } - public override async Task Where_equals_method_string_with_ignore_case(bool async) - { - await base.Where_equals_method_string_with_ignore_case(async); - - AssertSql(); - } - public override async Task Where_nested_field_access_closure_via_query_cache_error_null(bool async) { await base.Where_nested_field_access_closure_via_query_cache_error_null(async); @@ -3254,11 +2758,11 @@ public override async Task EF_Parameter(bool async) AssertSql( """ -@__p_0='ALFKI' (Size = 5) +@p='ALFKI' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = @__p_0 +WHERE `c`.`CustomerID` = @p """); } @@ -3268,11 +2772,11 @@ public override async Task EF_Parameter_with_subtree(bool async) AssertSql( """ -@__p_0='ALFKI' (Size = 5) +@p='ALFKI' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = @__p_0 +WHERE `c`.`CustomerID` = @p """); } @@ -3282,11 +2786,11 @@ public override async Task EF_Parameter_does_not_parameterized_as_part_of_bigger AssertSql( """ -@__id_0='ALF' (Size = 5) +@id='ALF' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE `c`.`CustomerID` = (@__id_0 & 'KI') +WHERE `c`.`CustomerID` = (@id & 'KI') """); } @@ -3309,27 +2813,27 @@ public override async Task Implicit_cast_in_predicate(bool async) """, // """ -@__prm_Value_0='1337' (Size = 5) +@prm_Value='1337' (Size = 5) SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`CustomerID` = @__prm_Value_0 +WHERE `o`.`CustomerID` = @prm_Value """, // """ -@__ToString_0='1337' (Size = 5) +@ToString='1337' (Size = 5) SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`CustomerID` = @__ToString_0 +WHERE `o`.`CustomerID` = @ToString """, // """ -@__p_0='1337' (Size = 5) +@p='1337' (Size = 5) SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`CustomerID` = @__p_0 +WHERE `o`.`CustomerID` = @p """, // """ @@ -3345,11 +2849,11 @@ public override async Task Interface_casting_though_generic_method(bool async) AssertSql( """ -@__id_0='10252' +@id='10252' SELECT `o`.`OrderID` AS `Id` FROM `Orders` AS `o` -WHERE `o`.`OrderID` = @__id_0 +WHERE `o`.`OrderID` = @id """, // """ @@ -3376,12 +2880,12 @@ public override async Task Simplifiable_coalesce_over_nullable(bool async) await base.Simplifiable_coalesce_over_nullable(async); AssertSql( - $""" -@__p_0='10248' + """ +@p='10248' SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` -WHERE `o`.`OrderID` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `o`.`OrderID` = @p """); } @@ -3395,7 +2899,7 @@ public override async Task Take_and_Where_evaluation_order(bool async) """ SELECT `e0`.`EmployeeID`, `e0`.`City`, `e0`.`Country`, `e0`.`FirstName`, `e0`.`ReportsTo`, `e0`.`Title` FROM ( - SELECT TOP 3 `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` + SELECT TOP @p `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` ORDER BY `e`.`EmployeeID` ) AS `e0` @@ -3432,7 +2936,7 @@ public override async Task Take_and_Distinct_evaluation_order(bool async) """ SELECT DISTINCT `c0`.`ContactTitle` FROM ( - SELECT TOP 3 `c`.`ContactTitle` + SELECT TOP @p `c`.`ContactTitle` FROM `Customers` AS `c` ORDER BY `c`.`ContactTitle` ) AS `c0` diff --git a/test/EFCore.Jet.FunctionalTests/Query/NullSemanticsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NullSemanticsQueryJetTest.cs index 82f4f7f0..fc2aa6b1 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NullSemanticsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NullSemanticsQueryJetTest.cs @@ -2378,13 +2378,13 @@ public override async Task Compare_nullable_with_non_null_parameter_not_equal(bo await base.Compare_nullable_with_non_null_parameter_not_equal(async); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__prm_0='Foo' (Size = 255)")} - - SELECT `e`.`Id` - FROM `Entities1` AS `e` - WHERE `e`.`NullableStringA` = {AssertSqlHelper.Parameter("@__prm_0")} - """); + """ +@prm='Foo' (Size = 255) + +SELECT `e`.`Id` +FROM `Entities1` AS `e` +WHERE `e`.`NullableStringA` = @prm +"""); } public override async Task Join_uses_database_semantics(bool async) @@ -2500,12 +2500,12 @@ public override async Task Where_multiple_ands_with_nullable_parameter_and_const await base.Where_multiple_ands_with_nullable_parameter_and_constant(async); AssertSql( -$""" -@__prm3_2='Blah' (Size = 255) + """ +@prm3='Blah' (Size = 255) SELECT `e`.`Id` FROM `Entities1` AS `e` -WHERE (`e`.`NullableStringA` <> 'Foo' OR `e`.`NullableStringA` IS NULL) AND `e`.`NullableStringA` IS NOT NULL AND `e`.`NullableStringA` <> {AssertSqlHelper.Parameter("@__prm3_2")} +WHERE (`e`.`NullableStringA` <> 'Foo' OR `e`.`NullableStringA` IS NULL) AND `e`.`NullableStringA` IS NOT NULL AND `e`.`NullableStringA` <> @prm3 """); } @@ -2514,12 +2514,12 @@ public override async Task Where_multiple_ands_with_nullable_parameter_and_const await base.Where_multiple_ands_with_nullable_parameter_and_constant_not_optimized(async); AssertSql( -$""" -@__prm3_2='Blah' (Size = 255) + """ +@prm3='Blah' (Size = 255) SELECT `e`.`Id` FROM `Entities1` AS `e` -WHERE `e`.`NullableStringB` IS NOT NULL AND (`e`.`NullableStringA` <> 'Foo' OR `e`.`NullableStringA` IS NULL) AND `e`.`NullableStringA` IS NOT NULL AND `e`.`NullableStringA` <> {AssertSqlHelper.Parameter("@__prm3_2")} +WHERE `e`.`NullableStringB` IS NOT NULL AND (`e`.`NullableStringA` <> 'Foo' OR `e`.`NullableStringA` IS NULL) AND `e`.`NullableStringA` IS NOT NULL AND `e`.`NullableStringA` <> @prm3 """); } @@ -2897,21 +2897,21 @@ public override async Task Where_comparison_null_constant_and_null_parameter(boo await base.Where_comparison_null_constant_and_null_parameter(async); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='True'")} - - SELECT `e`.`Id` - FROM `Entities1` AS `e` - WHERE {AssertSqlHelper.Parameter("@__p_0")} = TRUE - """, + """ +@p='True' + +SELECT `e`.`Id` +FROM `Entities1` AS `e` +WHERE @p = TRUE +""", // - $""" - {AssertSqlHelper.Declaration("@__p_0='False'")} - - SELECT `e`.`Id` - FROM `Entities1` AS `e` - WHERE {AssertSqlHelper.Parameter("@__p_0")} = TRUE - """); + """ +@p='False' + +SELECT `e`.`Id` +FROM `Entities1` AS `e` +WHERE @p = TRUE +"""); } public override async Task Where_comparison_null_constant_and_nonnull_parameter(bool async) @@ -2919,21 +2919,21 @@ public override async Task Where_comparison_null_constant_and_nonnull_parameter( await base.Where_comparison_null_constant_and_nonnull_parameter(async); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='False'")} - - SELECT `e`.`Id` - FROM `Entities1` AS `e` - WHERE {AssertSqlHelper.Parameter("@__p_0")} = TRUE - """, + """ +@p='False' + +SELECT `e`.`Id` +FROM `Entities1` AS `e` +WHERE @p = TRUE +""", // - $""" - {AssertSqlHelper.Declaration("@__p_0='True'")} - - SELECT `e`.`Id` - FROM `Entities1` AS `e` - WHERE {AssertSqlHelper.Parameter("@__p_0")} = TRUE - """); + """ +@p='True' + +SELECT `e`.`Id` +FROM `Entities1` AS `e` +WHERE @p = TRUE +"""); } public override async Task Where_comparison_nonnull_constant_and_null_parameter(bool async) @@ -2941,21 +2941,21 @@ public override async Task Where_comparison_nonnull_constant_and_null_parameter( await base.Where_comparison_nonnull_constant_and_null_parameter(async); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__p_0='False'")} - - SELECT `e`.`Id` - FROM `Entities1` AS `e` - WHERE {AssertSqlHelper.Parameter("@__p_0")} = TRUE - """, + """ +@p='False' + +SELECT `e`.`Id` +FROM `Entities1` AS `e` +WHERE @p = TRUE +""", // - $""" - {AssertSqlHelper.Declaration("@__p_0='True'")} - - SELECT `e`.`Id` - FROM `Entities1` AS `e` - WHERE {AssertSqlHelper.Parameter("@__p_0")} = TRUE - """); + """ +@p='True' + +SELECT `e`.`Id` +FROM `Entities1` AS `e` +WHERE @p = TRUE +"""); } public override async Task Where_comparison_null_semantics_optimization_works_with_complex_predicates(bool async) @@ -2993,20 +2993,20 @@ public override void Switching_parameter_value_to_null_produces_different_cache_ base.Switching_parameter_value_to_null_produces_different_cache_entry(); AssertSql( - $""" -@__p_0='True' + """ +@p='True' SELECT `e`.`Id` FROM `Entities1` AS `e` -WHERE {AssertSqlHelper.Parameter("@__p_0")} = TRUE +WHERE @p = TRUE """, // - $""" -@__p_0='False' + """ +@p='False' SELECT `e`.`Id` FROM `Entities1` AS `e` -WHERE {AssertSqlHelper.Parameter("@__p_0")} = TRUE +WHERE @p = TRUE """); } @@ -3450,215 +3450,6 @@ public override async Task Null_semantics_contains_with_non_nullable_item_and_in """); } - public override async Task Null_semantics_contains_with_non_nullable_item_and_inline_values_with_null(bool async) - { - await base.Null_semantics_contains_with_non_nullable_item_and_inline_values_with_null(async); - - AssertSql( - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`IntA` IN (1, 2) -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`IntA` NOT IN (1, 2) -"""); - } - - public override async Task Null_semantics_contains_with_non_nullable_item_and_inline_values_with_nullable_column(bool async) - { - await base.Null_semantics_contains_with_non_nullable_item_and_inline_values_with_nullable_column(async); - - AssertSql( - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`IntA` IN (1, 2, `e`.`NullableIntB`) -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`IntA` NOT IN (1, 2) AND (`e`.`IntA` <> `e`.`NullableIntB` OR `e`.`NullableIntB` IS NULL) -"""); - } - - public override async Task Null_semantics_contains_with_non_nullable_item_and_inline_values_with_nullable_column_and_null(bool async) - { - await base.Null_semantics_contains_with_non_nullable_item_and_inline_values_with_nullable_column_and_null(async); - - AssertSql( - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`IntA` IN (1, 2, `e`.`NullableIntB`) -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`IntA` NOT IN (1, 2) AND (`e`.`IntA` <> `e`.`NullableIntB` OR `e`.`NullableIntB` IS NULL) -"""); - } - - public override async Task Null_semantics_contains_with_nullable_item_and_inline_non_nullable_values(bool async) - { - await base.Null_semantics_contains_with_nullable_item_and_inline_non_nullable_values(async); - - AssertSql( - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`NullableIntA` IN (1, 2) -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`NullableIntA` NOT IN (1, 2) OR `e`.`NullableIntA` IS NULL -"""); - } - - public override async Task Null_semantics_contains_with_nullable_item_and_inline_values_with_null(bool async) - { - await base.Null_semantics_contains_with_nullable_item_and_inline_values_with_null(async); - - AssertSql( - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`NullableIntA` IN (1, 2) OR `e`.`NullableIntA` IS NULL -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`NullableIntA` NOT IN (1, 2) AND `e`.`NullableIntA` IS NOT NULL -"""); - } - - public override async Task Null_semantics_contains_with_nullable_item_and_inline_values_with_nullable_column(bool async) - { - await base.Null_semantics_contains_with_nullable_item_and_inline_values_with_nullable_column(async); - - AssertSql( - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE (`e`.`NullableIntA` IN (1, 2) AND `e`.`NullableIntA` IS NOT NULL) OR `e`.`NullableIntA` = `e`.`NullableIntB` OR (`e`.`NullableIntA` IS NULL AND `e`.`NullableIntB` IS NULL) -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE (`e`.`NullableIntA` NOT IN (1, 2) OR `e`.`NullableIntA` IS NULL) AND (`e`.`NullableIntA` <> `e`.`NullableIntB` OR `e`.`NullableIntA` IS NULL OR `e`.`NullableIntB` IS NULL) AND (`e`.`NullableIntA` IS NOT NULL OR `e`.`NullableIntB` IS NOT NULL) -"""); - } - - public override async Task Null_semantics_contains_with_nullable_item_and_values_with_nullable_column_and_null(bool async) - { - await base.Null_semantics_contains_with_nullable_item_and_values_with_nullable_column_and_null(async); - - AssertSql( - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`NullableIntA` IN (1, 2) OR `e`.`NullableIntA` IS NULL OR `e`.`NullableIntA` = `e`.`NullableIntB` OR (`e`.`NullableIntA` IS NULL AND `e`.`NullableIntB` IS NULL) -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`NullableIntA` NOT IN (1, 2) AND `e`.`NullableIntA` IS NOT NULL AND (`e`.`NullableIntA` <> `e`.`NullableIntB` OR `e`.`NullableIntA` IS NULL OR `e`.`NullableIntB` IS NULL) AND (`e`.`NullableIntA` IS NOT NULL OR `e`.`NullableIntB` IS NOT NULL) -"""); - } - - public override async Task Null_semantics_contains_with_non_nullable_item_and_one_value(bool async) - { - await base.Null_semantics_contains_with_non_nullable_item_and_one_value(async); - - AssertSql( - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`IntA` = 1 -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`IntA` <> 1 -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE 0 = 1 -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`IntA` = `e`.`NullableIntB` -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`IntA` <> `e`.`NullableIntB` OR `e`.`NullableIntB` IS NULL -"""); - } - - public override async Task Null_semantics_contains_with_nullable_item_and_one_value(bool async) - { - await base.Null_semantics_contains_with_nullable_item_and_one_value(async); - - AssertSql( - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`NullableIntA` = 1 -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`NullableIntA` <> 1 OR `e`.`NullableIntA` IS NULL -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`NullableIntA` IS NULL -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`NullableIntA` IS NOT NULL -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE `e`.`NullableIntA` = `e`.`NullableIntB` OR (`e`.`NullableIntA` IS NULL AND `e`.`NullableIntB` IS NULL) -""", - // - """ -SELECT `e`.`Id` -FROM `Entities1` AS `e` -WHERE (`e`.`NullableIntA` <> `e`.`NullableIntB` OR `e`.`NullableIntA` IS NULL OR `e`.`NullableIntB` IS NULL) AND (`e`.`NullableIntA` IS NOT NULL OR `e`.`NullableIntB` IS NOT NULL) -"""); - } - #endregion Contains with inline collection public override async Task Null_semantics_contains_non_nullable_item_with_values(bool async) @@ -3838,36 +3629,36 @@ public override async Task Negated_order_comparison_on_non_nullable_arguments_ge await base.Negated_order_comparison_on_non_nullable_arguments_gets_optimized(async); AssertSql( -$""" -@__i_0='1' + """ +@i='1' SELECT `e`.`Id` FROM `Entities1` AS `e` -WHERE `e`.`IntA` <= {AssertSqlHelper.Parameter("@__i_0")} +WHERE `e`.`IntA` <= @i """, -// -$""" -@__i_0='1' + // + """ +@i='1' SELECT `e`.`Id` FROM `Entities1` AS `e` -WHERE `e`.`IntA` < {AssertSqlHelper.Parameter("@__i_0")} +WHERE `e`.`IntA` < @i """, -// -$""" -@__i_0='1' + // + """ +@i='1' SELECT `e`.`Id` FROM `Entities1` AS `e` -WHERE `e`.`IntA` >= {AssertSqlHelper.Parameter("@__i_0")} +WHERE `e`.`IntA` >= @i """, -// -$""" -@__i_0='1' + // + """ +@i='1' SELECT `e`.`Id` FROM `Entities1` AS `e` -WHERE `e`.`IntA` > {AssertSqlHelper.Parameter("@__i_0")} +WHERE `e`.`IntA` > @i """); } @@ -3877,35 +3668,35 @@ public override async Task Negated_order_comparison_on_nullable_arguments_doesnt AssertSql( """ -@__i_0='1' (Nullable = true) +@i='1' (Nullable = true) SELECT `e`.`Id` FROM `Entities1` AS `e` -WHERE IIF(`e`.`NullableIntA` > @__i_0, FALSE, TRUE) = TRUE +WHERE IIF(`e`.`NullableIntA` > @i, FALSE, TRUE) = TRUE """, // """ -@__i_0='1' (Nullable = true) +@i='1' (Nullable = true) SELECT `e`.`Id` FROM `Entities1` AS `e` -WHERE IIF(`e`.`NullableIntA` >= @__i_0, FALSE, TRUE) = TRUE +WHERE IIF(`e`.`NullableIntA` >= @i, FALSE, TRUE) = TRUE """, // """ -@__i_0='1' (Nullable = true) +@i='1' (Nullable = true) SELECT `e`.`Id` FROM `Entities1` AS `e` -WHERE IIF(`e`.`NullableIntA` < @__i_0, FALSE, TRUE) = TRUE +WHERE IIF(`e`.`NullableIntA` < @i, FALSE, TRUE) = TRUE """, // """ -@__i_0='1' (Nullable = true) +@i='1' (Nullable = true) SELECT `e`.`Id` FROM `Entities1` AS `e` -WHERE IIF(`e`.`NullableIntA` <= @__i_0, FALSE, TRUE) = TRUE +WHERE IIF(`e`.`NullableIntA` <= @i, FALSE, TRUE) = TRUE """); } @@ -4225,87 +4016,27 @@ public override async Task Multiple_equality_comparisons_including_null_comparis WHERE `e`.`NullableIntA` = 1 OR `e`.`NullableIntA` IS NULL """); } - - public override async Task Multiple_contains_calls_get_combined_into_one_for_relational_null_semantics(bool async) - { - await base.Multiple_contains_calls_get_combined_into_one_for_relational_null_semantics(async); - - AssertSql( -""" -SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` -FROM `Entities1` AS `e` -WHERE `e`.`NullableIntA` IN (1, NULL, 2, 3) -"""); - } - - public override async Task Multiple_negated_contains_calls_get_combined_into_one_for_relational_null_semantics(bool async) - { - await base.Multiple_negated_contains_calls_get_combined_into_one_for_relational_null_semantics(async); - - AssertSql( - """ -SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] -FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] NOT IN (1, NULL, 2, 3) -"""); - } - - public override async Task Contains_with_comparison_dont_get_combined_for_relational_null_semantics(bool async) - { - await base.Contains_with_comparison_dont_get_combined_for_relational_null_semantics(async); - - AssertSql( -""" -SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` -FROM `Entities1` AS `e` -WHERE `e`.`NullableIntA` IN (1, 2) OR `e`.`NullableIntA` IS NULL -"""); - } - - public override async Task Negated_contains_with_comparison_dont_get_combined_for_relational_null_semantics(bool async) - { - await base.Negated_contains_with_comparison_dont_get_combined_for_relational_null_semantics(async); - - AssertSql( -""" -SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` -FROM `Entities1` AS `e` -WHERE `e`.`NullableIntA` IS NOT NULL AND `e`.`NullableIntA` NOT IN (1, 2) -"""); - } - - public override async Task Negated_contains_with_comparison_without_null_get_combined_for_relational_null_semantics(bool async) - { - await base.Negated_contains_with_comparison_without_null_get_combined_for_relational_null_semantics(async); - - AssertSql( -""" -SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` -FROM `Entities1` AS `e` -WHERE `e`.`NullableIntA` NOT IN (3, 1, 2) -"""); - } - + public override async Task Bool_equal_nullable_bool_HasValue(bool async) { await base.Bool_equal_nullable_bool_HasValue(async); AssertSql( -""" + """ SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` FROM `Entities1` AS `e` WHERE `e`.`NullableBoolA` IS NOT NULL """, -// -$""" -@__prm_0='False' + // + """ +@prm='False' SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` FROM `Entities1` AS `e` -WHERE {AssertSqlHelper.Parameter("@__prm_0")} = IIF(`e`.`NullableBoolA` IS NOT NULL, TRUE, FALSE) +WHERE @prm = IIF(`e`.`NullableBoolA` IS NOT NULL, TRUE, FALSE) """, -// -""" + // + """ SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` FROM `Entities1` AS `e` WHERE `e`.`BoolB` = IIF(`e`.`NullableBoolA` IS NOT NULL, TRUE, FALSE) @@ -4317,18 +4048,18 @@ public override async Task Bool_equal_nullable_bool_compared_to_null(bool async) await base.Bool_equal_nullable_bool_compared_to_null(async); AssertSql( -""" + """ SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` FROM `Entities1` AS `e` WHERE `e`.`NullableBoolA` IS NULL """, -// -$""" -@__prm_0='False' + // + """ +@prm='False' SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` FROM `Entities1` AS `e` -WHERE {AssertSqlHelper.Parameter("@__prm_0")} = IIF(`e`.`NullableBoolA` IS NOT NULL, TRUE, FALSE) +WHERE @prm = IIF(`e`.`NullableBoolA` IS NOT NULL, TRUE, FALSE) """); } @@ -4337,21 +4068,21 @@ public override async Task Bool_not_equal_nullable_bool_HasValue(bool async) await base.Bool_not_equal_nullable_bool_HasValue(async); AssertSql( -""" + """ SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` FROM `Entities1` AS `e` WHERE `e`.`NullableBoolA` IS NULL """, -// -$""" -@__prm_0='False' + // + """ +@prm='False' SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` FROM `Entities1` AS `e` -WHERE {AssertSqlHelper.Parameter("@__prm_0")} <> IIF(`e`.`NullableBoolA` IS NOT NULL, TRUE, FALSE) +WHERE @prm <> IIF(`e`.`NullableBoolA` IS NOT NULL, TRUE, FALSE) """, -// -""" + // + """ SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` FROM `Entities1` AS `e` WHERE `e`.`BoolB` <> IIF(`e`.`NullableBoolA` IS NOT NULL, TRUE, FALSE) @@ -4363,21 +4094,21 @@ public override async Task Bool_not_equal_nullable_int_HasValue(bool async) await base.Bool_not_equal_nullable_int_HasValue(async); AssertSql( -""" + """ SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` FROM `Entities1` AS `e` WHERE `e`.`NullableIntA` IS NULL """, -// -$""" -@__prm_0='False' + // + """ +@prm='False' SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` FROM `Entities1` AS `e` -WHERE {AssertSqlHelper.Parameter("@__prm_0")} <> IIF(`e`.`NullableIntA` IS NOT NULL, TRUE, FALSE) +WHERE @prm <> IIF(`e`.`NullableIntA` IS NOT NULL, TRUE, FALSE) """, -// -""" + // + """ SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` FROM `Entities1` AS `e` WHERE `e`.`BoolB` <> IIF(`e`.`NullableIntA` IS NOT NULL, TRUE, FALSE) @@ -4389,18 +4120,18 @@ public override async Task Bool_not_equal_nullable_bool_compared_to_null(bool as await base.Bool_not_equal_nullable_bool_compared_to_null(async); AssertSql( -""" + """ SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` FROM `Entities1` AS `e` WHERE `e`.`NullableBoolA` IS NOT NULL """, -// -$""" -@__prm_0='False' + // + """ +@prm='False' SELECT `e`.`Id`, `e`.`BoolA`, `e`.`BoolB`, `e`.`BoolC`, `e`.`IntA`, `e`.`IntB`, `e`.`IntC`, `e`.`NullableBoolA`, `e`.`NullableBoolB`, `e`.`NullableBoolC`, `e`.`NullableIntA`, `e`.`NullableIntB`, `e`.`NullableIntC`, `e`.`NullableStringA`, `e`.`NullableStringB`, `e`.`NullableStringC`, `e`.`StringA`, `e`.`StringB`, `e`.`StringC` FROM `Entities1` AS `e` -WHERE {AssertSqlHelper.Parameter("@__prm_0")} <> IIF(`e`.`NullableBoolA` IS NOT NULL, TRUE, FALSE) +WHERE @prm <> IIF(`e`.`NullableBoolA` IS NOT NULL, TRUE, FALSE) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/OperatorsProceduralJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/OperatorsProceduralJetTest.cs index c19884f1..143022ed 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/OperatorsProceduralJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/OperatorsProceduralJetTest.cs @@ -2,12 +2,13 @@ // The .NET Foundation licenses this file to you under the MIT license. using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; namespace EntityFrameworkCore.Jet.FunctionalTests.Query; -public class OperatorsProceduralJetTest : OperatorsProceduralQueryTestBase +public class OperatorsProceduralJetTest(NonSharedFixture fixture) : OperatorsProceduralQueryTestBase(fixture) { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; diff --git a/test/EFCore.Jet.FunctionalTests/Query/OperatorsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/OperatorsQueryJetTest.cs index c646edb9..a97b10db 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/OperatorsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/OperatorsQueryJetTest.cs @@ -14,7 +14,7 @@ namespace EntityFrameworkCore.Jet.FunctionalTests.Query; -public class OperatorsQueryJetTest : OperatorsQueryTestBase +public class OperatorsQueryJetTest(NonSharedFixture fixture) : OperatorsQueryTestBase(fixture) { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; diff --git a/test/EFCore.Jet.FunctionalTests/Query/OwnedEntityQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/OwnedEntityQueryJetTest.cs index 0e8d6093..862842a1 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/OwnedEntityQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/OwnedEntityQueryJetTest.cs @@ -3,14 +3,15 @@ // ReSharper disable InconsistentNaming -using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; namespace EntityFrameworkCore.Jet.FunctionalTests.Query; -public class OwnedEntityQueryJetTest : OwnedEntityQueryRelationalTestBase +public class OwnedEntityQueryJetTest(NonSharedFixture fixture) : OwnedEntityQueryRelationalTestBase(fixture) { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; @@ -66,6 +67,7 @@ public override async Task Multiple_owned_reference_mapped_to_own_table_containi LEFT JOIN `MiddleB` AS `m` ON `r`.`Id` = `m`.`RootId`) LEFT JOIN `ModdleA` AS `m0` ON `r`.`Id` = `m0`.`RootId` WHERE `r`.`Id` = 3 + ORDER BY `r`.`Id`, `m`.`Id`, `m0`.`Id` ) AS `s` INNER JOIN `Leaf` AS `l0` ON `s`.`Id1` = `l0`.`ModdleAId` ORDER BY `s`.`Id`, `s`.`Id0`, `s`.`Id1` @@ -106,12 +108,12 @@ public override async Task Owned_collection_basic_split_query(bool async) await base.Owned_collection_basic_split_query(async); AssertSql( -$""" -@__id_0='6c1ae3e5-30b9-4c77-8d98-f02075974a0a' + """ +@id='6c1ae3e5-30b9-4c77-8d98-f02075974a0a' SELECT TOP 1 `l`.`Id` FROM `Location25680` AS `l` -WHERE `l`.`Id` = {AssertSqlHelper.Parameter("@__id_0")} +WHERE `l`.`Id` = @id ORDER BY `l`.`Id` """); } @@ -121,8 +123,8 @@ public override async Task Owned_reference_mapped_to_different_table_updated_cor await base.Owned_reference_mapped_to_different_table_updated_correctly_after_subquery_pushdown(async); AssertSql( -""" -SELECT TOP 10 `c`.`Id`, `c`.`Name`, `c0`.`CompanyId`, `c0`.`AdditionalCustomerData`, `c0`.`Id`, `s`.`CompanyId`, `s`.`AdditionalSupplierData`, `s`.`Id` + """ +SELECT TOP @p `c`.`Id`, `c`.`Name`, `c0`.`CompanyId`, `c0`.`AdditionalCustomerData`, `c0`.`Id`, `s`.`CompanyId`, `s`.`AdditionalSupplierData`, `s`.`Id` FROM (`Companies` AS `c` LEFT JOIN `CustomerData` AS `c0` ON `c`.`Id` = `c0`.`CompanyId`) LEFT JOIN `SupplierData` AS `s` ON `c`.`Id` = `s`.`CompanyId` @@ -136,8 +138,8 @@ public override async Task Owned_reference_mapped_to_different_table_nested_upda await base.Owned_reference_mapped_to_different_table_nested_updated_correctly_after_subquery_pushdown(async); AssertSql( -""" -SELECT TOP 10 `o`.`Id`, `o`.`Name`, `i`.`OwnerId`, `i`.`Id`, `i`.`Name`, `i0`.`IntermediateOwnedEntityOwnerId`, `i0`.`AdditionalCustomerData`, `i0`.`Id`, `i1`.`IntermediateOwnedEntityOwnerId`, `i1`.`AdditionalSupplierData`, `i1`.`Id` + """ +SELECT TOP @p `o`.`Id`, `o`.`Name`, `i`.`OwnerId`, `i`.`Id`, `i`.`Name`, `i0`.`IntermediateOwnedEntityOwnerId`, `i0`.`AdditionalCustomerData`, `i0`.`Id`, `i1`.`IntermediateOwnedEntityOwnerId`, `i1`.`AdditionalSupplierData`, `i1`.`Id` FROM ((`Owners` AS `o` LEFT JOIN `IntermediateOwnedEntity` AS `i` ON `o`.`Id` = `i`.`OwnerId`) LEFT JOIN `IM_CustomerData` AS `i0` ON `i`.`OwnerId` = `i0`.`IntermediateOwnedEntityOwnerId`) diff --git a/test/EFCore.Jet.FunctionalTests/Query/OwnedQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/OwnedQueryJetTest.cs index ee474bb2..0260adbd 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/OwnedQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/OwnedQueryJetTest.cs @@ -130,7 +130,7 @@ public override async Task Query_when_subquery(bool isAsync) """ SELECT `o3`.`Id`, `o3`.`Discriminator`, `o3`.`Name`, `s`.`ClientId`, `s`.`Id`, `s`.`OrderDate`, `s`.`OrderClientId`, `s`.`OrderId`, `s`.`Id0`, `s`.`Detail`, `o3`.`PersonAddress_AddressLine`, `o3`.`PersonAddress_PlaceType`, `o3`.`PersonAddress_ZipCode`, `o3`.`PersonAddress_Country_Name`, `o3`.`PersonAddress_Country_PlanetId`, `o3`.`BranchAddress_BranchName`, `o3`.`BranchAddress_PlaceType`, `o3`.`BranchAddress_Country_Name`, `o3`.`BranchAddress_Country_PlanetId`, `o3`.`LeafBAddress_LeafBType`, `o3`.`LeafBAddress_PlaceType`, `o3`.`LeafBAddress_Country_Name`, `o3`.`LeafBAddress_Country_PlanetId`, `o3`.`LeafAAddress_LeafType`, `o3`.`LeafAAddress_PlaceType`, `o3`.`LeafAAddress_Country_Name`, `o3`.`LeafAAddress_Country_PlanetId` FROM ( - SELECT TOP 5 `o0`.`Id`, `o0`.`Discriminator`, `o0`.`Name`, `o0`.`PersonAddress_AddressLine`, `o0`.`PersonAddress_PlaceType`, `o0`.`PersonAddress_ZipCode`, `o0`.`PersonAddress_Country_Name`, `o0`.`PersonAddress_Country_PlanetId`, `o0`.`BranchAddress_BranchName`, `o0`.`BranchAddress_PlaceType`, `o0`.`BranchAddress_Country_Name`, `o0`.`BranchAddress_Country_PlanetId`, `o0`.`LeafBAddress_LeafBType`, `o0`.`LeafBAddress_PlaceType`, `o0`.`LeafBAddress_Country_Name`, `o0`.`LeafBAddress_Country_PlanetId`, `o0`.`LeafAAddress_LeafType`, `o0`.`LeafAAddress_PlaceType`, `o0`.`LeafAAddress_Country_Name`, `o0`.`LeafAAddress_Country_PlanetId` + SELECT TOP @p `o0`.`Id`, `o0`.`Discriminator`, `o0`.`Name`, `o0`.`PersonAddress_AddressLine`, `o0`.`PersonAddress_PlaceType`, `o0`.`PersonAddress_ZipCode`, `o0`.`PersonAddress_Country_Name`, `o0`.`PersonAddress_Country_PlanetId`, `o0`.`BranchAddress_BranchName`, `o0`.`BranchAddress_PlaceType`, `o0`.`BranchAddress_Country_Name`, `o0`.`BranchAddress_Country_PlanetId`, `o0`.`LeafBAddress_LeafBType`, `o0`.`LeafBAddress_PlaceType`, `o0`.`LeafBAddress_Country_Name`, `o0`.`LeafBAddress_Country_PlanetId`, `o0`.`LeafAAddress_LeafType`, `o0`.`LeafAAddress_PlaceType`, `o0`.`LeafAAddress_Country_Name`, `o0`.`LeafAAddress_Country_PlanetId` FROM ( SELECT DISTINCT `o`.`Id`, `o`.`Discriminator`, `o`.`Name`, `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` @@ -189,10 +189,10 @@ LEFT JOIN ( FROM `Order` AS `o1` LEFT JOIN `OrderDetail` AS `o2` ON `o1`.`ClientId` = `o2`.`OrderClientId` AND `o1`.`Id` = `o2`.`OrderId` ) AS `s` ON `o`.`Id` = `s`.`ClientId` -WHERE ( - SELECT COUNT(*) +WHERE EXISTS ( + SELECT 1 FROM `Order` AS `o0` - WHERE `o`.`Id` = `o0`.`ClientId`) > 0 + WHERE `o`.`Id` = `o0`.`ClientId`) ORDER BY `o`.`Id`, `s`.`ClientId`, `s`.`Id`, `s`.`OrderClientId`, `s`.`OrderId` """); } @@ -462,9 +462,9 @@ public override async Task Preserve_includes_when_applying_skip_take_after_anony """ SELECT `o4`.`Id`, `o4`.`Discriminator`, `o4`.`Name`, `s`.`ClientId`, `s`.`Id`, `s`.`OrderDate`, `s`.`OrderClientId`, `s`.`OrderId`, `s`.`Id0`, `s`.`Detail`, `o4`.`PersonAddress_AddressLine`, `o4`.`PersonAddress_PlaceType`, `o4`.`PersonAddress_ZipCode`, `o4`.`PersonAddress_Country_Name`, `o4`.`PersonAddress_Country_PlanetId`, `o4`.`BranchAddress_BranchName`, `o4`.`BranchAddress_PlaceType`, `o4`.`BranchAddress_Country_Name`, `o4`.`BranchAddress_Country_PlanetId`, `o4`.`LeafBAddress_LeafBType`, `o4`.`LeafBAddress_PlaceType`, `o4`.`LeafBAddress_Country_Name`, `o4`.`LeafBAddress_Country_PlanetId`, `o4`.`LeafAAddress_LeafType`, `o4`.`LeafAAddress_PlaceType`, `o4`.`LeafAAddress_Country_Name`, `o4`.`LeafAAddress_Country_PlanetId`, `o4`.`c` FROM ( - SELECT TOP 100 `o3`.`Id`, `o3`.`Discriminator`, `o3`.`Name`, `o3`.`PersonAddress_AddressLine`, `o3`.`PersonAddress_PlaceType`, `o3`.`PersonAddress_ZipCode`, `o3`.`PersonAddress_Country_Name`, `o3`.`PersonAddress_Country_PlanetId`, `o3`.`BranchAddress_BranchName`, `o3`.`BranchAddress_PlaceType`, `o3`.`BranchAddress_Country_Name`, `o3`.`BranchAddress_Country_PlanetId`, `o3`.`LeafBAddress_LeafBType`, `o3`.`LeafBAddress_PlaceType`, `o3`.`LeafBAddress_Country_Name`, `o3`.`LeafBAddress_Country_PlanetId`, `o3`.`LeafAAddress_LeafType`, `o3`.`LeafAAddress_PlaceType`, `o3`.`LeafAAddress_Country_Name`, `o3`.`LeafAAddress_Country_PlanetId`, `o3`.`c` + SELECT TOP @p0 `o3`.`Id`, `o3`.`Discriminator`, `o3`.`Name`, `o3`.`PersonAddress_AddressLine`, `o3`.`PersonAddress_PlaceType`, `o3`.`PersonAddress_ZipCode`, `o3`.`PersonAddress_Country_Name`, `o3`.`PersonAddress_Country_PlanetId`, `o3`.`BranchAddress_BranchName`, `o3`.`BranchAddress_PlaceType`, `o3`.`BranchAddress_Country_Name`, `o3`.`BranchAddress_Country_PlanetId`, `o3`.`LeafBAddress_LeafBType`, `o3`.`LeafBAddress_PlaceType`, `o3`.`LeafBAddress_Country_Name`, `o3`.`LeafBAddress_Country_PlanetId`, `o3`.`LeafAAddress_LeafType`, `o3`.`LeafAAddress_PlaceType`, `o3`.`LeafAAddress_Country_Name`, `o3`.`LeafAAddress_Country_PlanetId`, `o3`.`c` FROM ( - SELECT TOP 100 `o`.`Id`, `o`.`Discriminator`, `o`.`Name`, `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 TOP @p + @p0 `o`.`Id`, `o`.`Discriminator`, `o`.`Name`, `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 COUNT(*) FROM `OwnedPerson` AS `o2`) AS `c` FROM `OwnedPerson` AS `o` diff --git a/test/EFCore.Jet.FunctionalTests/Query/PrecompiledQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/PrecompiledQueryJetTest.cs index 13cdecba..5be03c7f 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/PrecompiledQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/PrecompiledQueryJetTest.cs @@ -32,11 +32,11 @@ public override async Task BinaryExpression() AssertSql( """ -@__id_0='3' +@id='3' SELECT `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` -WHERE `b`.`Id` > @__id_0 +WHERE `b`.`Id` > @id """); } @@ -57,9 +57,9 @@ public override async Task Conditional_contains_captured_variable() AssertSql( """ -@__yes_0='yes' (Size = 255) +@yes='yes' (Size = 255) -SELECT IIF(`b`.`Id` = 2, @__yes_0, 'no') +SELECT IIF(`b`.`Id` = 2, @yes, 'no') FROM `Blogs` AS `b` """); } @@ -134,11 +134,11 @@ public override async Task MethodCallExpression_with_evaluatable_with_captured_v AssertSql( """ -@__pattern_0_startswith='foo%' (Size = 255) +@pattern_startswith='foo%' (Size = 255) SELECT `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` -WHERE `b`.`Name` LIKE @__pattern_0_startswith +WHERE `b`.`Name` LIKE @pattern_startswith """); } @@ -212,9 +212,9 @@ public override async Task MemberInit_contains_captured_variable() AssertSql( """ -@__id_0='8' +@id='8' -SELECT CLNG(@__id_0) AS `Id`, `b`.`Name` +SELECT CLNG(@id) AS `Id`, `b`.`Name` FROM `Blogs` AS `b` """); } @@ -247,9 +247,9 @@ public override async Task NewArray() AssertSql( """ -@__i_0='8' +@i='8' -SELECT `b`.`Id`, `b`.`Id` + @__i_0 +SELECT `b`.`Id`, `b`.`Id` + @i FROM `Blogs` AS `b` """); } @@ -620,9 +620,9 @@ public override async Task Terminating_Contains() AssertSql( """ -@__p_0='8' +@p='8' -SELECT IIF(@__p_0 IN ( +SELECT IIF(@p IN ( SELECT `b`.`Id` FROM `Blogs` AS `b` ), TRUE, FALSE) @@ -630,9 +630,9 @@ SELECT IIF(@__p_0 IN ( """, // """ -@__p_0='7' +@p='7' -SELECT IIF(@__p_0 IN ( +SELECT IIF(@p IN ( SELECT `b`.`Id` FROM `Blogs` AS `b` ), TRUE, FALSE) @@ -646,9 +646,9 @@ public override async Task Terminating_ContainsAsync() AssertSql( """ -@__p_0='8' +@p='8' -SELECT IIF(@__p_0 IN ( +SELECT IIF(@p IN ( SELECT `b`.`Id` FROM `Blogs` AS `b` ), TRUE, FALSE) @@ -656,9 +656,9 @@ SELECT IIF(@__p_0 IN ( """, // """ -@__p_0='7' +@p='7' -SELECT IIF(@__p_0 IN ( +SELECT IIF(@p IN ( SELECT `b`.`Id` FROM `Blogs` AS `b` ), TRUE, FALSE) @@ -1342,36 +1342,57 @@ SELECT COUNT(*) """); } - public override async Task Terminating_ExecuteUpdate() + public override async Task Terminating_ExecuteUpdate_with_lambda() { - await base.Terminating_ExecuteUpdate(); + await base.Terminating_ExecuteUpdate_with_lambda(); AssertSql( """ -@__suffix_0='Suffix' (Size = 255) +@suffix='Suffix' (Size = 4000) + +UPDATE [b] +SET [b].[Name] = COALESCE([b].[Name], N'') + @suffix +FROM [Blogs] AS [b] +WHERE [b].[Id] > 8 +""", + // + """ +SELECT COUNT(*) +FROM [Blogs] AS [b] +WHERE [b].[Id] = 9 AND [b].[Name] = N'Blog2Suffix' +"""); + } + + public override async Task Terminating_ExecuteUpdate_without_lambda() + { + await base.Terminating_ExecuteUpdate_without_lambda(); + + AssertSql( + """ +@newValue='NewValue' (Size = 255) UPDATE `Blogs` AS `b` -SET `b`.`Name` = IIF(`b`.`Name` IS NULL, '', `b`.`Name`) & @__suffix_0 +SET `b`.`Name` = @newValue WHERE `b`.`Id` > 8 """, // """ SELECT COUNT(*) FROM `Blogs` AS `b` -WHERE `b`.`Id` = 9 AND `b`.`Name` = 'Blog2Suffix' +WHERE `b`.`Id` = 9 AND `b`.`Name` = 'NewValue' """); } - public override async Task Terminating_ExecuteUpdateAsync() + public override async Task Terminating_ExecuteUpdateAsync_with_lambda() { - await base.Terminating_ExecuteUpdateAsync(); + await base.Terminating_ExecuteUpdateAsync_with_lambda(); AssertSql( """ -@__suffix_0='Suffix' (Size = 255) +@suffix='Suffix' (Size = 255) UPDATE `Blogs` AS `b` -SET `b`.`Name` = IIF(`b`.`Name` IS NULL, '', `b`.`Name`) & @__suffix_0 +SET `b`.`Name` = IIF(`b`.`Name` IS NULL, '', `b`.`Name`) & @suffix WHERE `b`.`Id` > 8 """, // @@ -1382,6 +1403,44 @@ SELECT COUNT(*) """); } + public override async Task Terminating_ExecuteUpdateAsync_without_lambda() + { + await base.Terminating_ExecuteUpdateAsync_without_lambda(); + + AssertSql( + """ +@newValue='NewValue' (Size = 255) + +UPDATE `Blogs` AS `b` +SET `b`.`Name` = @newValue +WHERE `b`.`Id` > 8 +""", + // + """ +SELECT COUNT(*) +FROM `Blogs` AS `b` +WHERE `b`.`Id` = 9 AND `b`.`Name` = 'NewValue' +"""); + } + + public override async Task Terminating_with_cancellation_token() + { + await base.Terminating_with_cancellation_token(); + + AssertSql( + """ +SELECT TOP 1 `b`.`Id`, `b`.`Name`, `b`.`Json` +FROM `Blogs` AS `b` +WHERE `b`.`Id` = 8 +""", + // + """ +SELECT TOP 1 `b`.`Id`, `b`.`Name`, `b`.`Json` +FROM `Blogs` AS `b` +WHERE `b`.`Id` = 7 +"""); + } + #endregion Reducing terminating operators #region SQL expression quotability @@ -1808,18 +1867,7 @@ public override async Task Query_syntax_is_not_supported() } #endregion Negative cases - - public override async Task Select_changes_type() - { - await base.Select_changes_type(); - - AssertSql( - """ -SELECT `b`.`Name` -FROM `Blogs` AS `b` -"""); - } - + public override async Task OrderBy() { await base.OrderBy(); @@ -1832,100 +1880,79 @@ ORDER BY `b`.`Name` """); } - public override async Task Skip() + public override async Task Skip_with_constant() { - await base.Skip(); + await base.Skip_with_constant(); AssertSql( """ -@__p_0='1' +@p='1' -SELECT [b].[Id], [b].[Name] +SELECT [b].[Id], [b].[Name], [b].[Json] FROM [Blogs] AS [b] ORDER BY [b].[Name] -OFFSET @__p_0 ROWS +OFFSET @p ROWS """); } - public override async Task Take() + public override async Task Skip_with_parameter() { - await base.Take(); + await base.Skip_with_parameter(); AssertSql( """ -SELECT TOP 1 `b`.`Id`, `b`.`Name`, `b`.`Json` -FROM `Blogs` AS `b` -ORDER BY `b`.`Name` -"""); - } - - public override async Task Project_anonymous_object() - { - await base.Project_anonymous_object(); +@p='1' - AssertSql( - """ -SELECT IIF(`b`.`Name` IS NULL, '', `b`.`Name`) & 'Foo' AS `Foo` -FROM `Blogs` AS `b` +SELECT [b].[Id], [b].[Name], [b].[Json] +FROM [Blogs] AS [b] +ORDER BY [b].[Name] +OFFSET @p ROWS """); } - public override async Task Two_captured_variables_in_same_lambda() + public override async Task Take_with_constant() { - await base.Two_captured_variables_in_same_lambda(); + await base.Take_with_constant(); AssertSql( """ -@__yes_0='yes' (Size = 255) -@__no_1='no' (Size = 255) - -SELECT IIF(`b`.`Id` = 3, @__yes_0, @__no_1) +SELECT TOP @p `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` +ORDER BY `b`.`Name` """); } - public override async Task Two_captured_variables_in_different_lambdas() + public override async Task Take_with_parameter() { - await base.Two_captured_variables_in_different_lambdas(); + await base.Take_with_parameter(); AssertSql( """ -@__starts_0_startswith='blog%' (Size = 255) -@__ends_1_endswith='%2' (Size = 255) - -SELECT TOP 2 `b`.`Id`, `b`.`Name`, `b`.`Json` +SELECT TOP @p `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` -WHERE (`b`.`Name` LIKE @__starts_0_startswith) AND (`b`.`Name` LIKE @__ends_1_endswith) +ORDER BY `b`.`Name` """); } - public override async Task Same_captured_variable_twice_in_same_lambda() + public override async Task Select_changes_type() { - await base.Same_captured_variable_twice_in_same_lambda(); + await base.Select_changes_type(); AssertSql( """ -@__foo_0_startswith='X%' (Size = 255) -@__foo_0_endswith='%X' (Size = 255) - -SELECT `b`.`Id`, `b`.`Name`, `b`.`Json` +SELECT `b`.`Name` FROM `Blogs` AS `b` -WHERE (`b`.`Name` LIKE @__foo_0_startswith) AND (`b`.`Name` LIKE @__foo_0_endswith) """); } - public override async Task Same_captured_variable_twice_in_different_lambdas() + public override async Task Select_anonymous_object() { - await base.Same_captured_variable_twice_in_different_lambdas(); + await base.Select_anonymous_object(); AssertSql( """ -@__foo_0_startswith='X%' (Size = 255) -@__foo_0_endswith='%X' (Size = 255) - -SELECT `b`.`Id`, `b`.`Name`, `b`.`Json` +SELECT IIF(`b`.`Name` IS NULL, '', `b`.`Name`) & 'Foo' AS `Foo` FROM `Blogs` AS `b` -WHERE (`b`.`Name` LIKE @__foo_0_startswith) AND (`b`.`Name` LIKE @__foo_0_endswith) """); } @@ -1974,26 +2001,85 @@ ORDER BY `b`.`Name` """); } + public override async Task Two_captured_variables_in_same_lambda() + { + await base.Two_captured_variables_in_same_lambda(); + + AssertSql( + """ +@yes='yes' (Size = 255) +@no='no' (Size = 255) + +SELECT IIF(`b`.`Id` = 3, @yes, @no) +FROM `Blogs` AS `b` +"""); + } + + public override async Task Two_captured_variables_in_different_lambdas() + { + await base.Two_captured_variables_in_different_lambdas(); + + AssertSql( + """ +@starts_startswith='Blog%' (Size = 255) +@ends_endswith='%2' (Size = 255) + +SELECT TOP 2 `b`.`Id`, `b`.`Name`, `b`.`Json` +FROM `Blogs` AS `b` +WHERE (`b`.`Name` LIKE @starts_startswith) AND (`b`.`Name` LIKE @ends_endswith) +"""); + } + + public override async Task Same_captured_variable_twice_in_same_lambda() + { + await base.Same_captured_variable_twice_in_same_lambda(); + + AssertSql( + """ +@foo_startswith='X%' (Size = 255) +@foo_endswith='%X' (Size = 255) + +SELECT `b`.`Id`, `b`.`Name`, `b`.`Json` +FROM `Blogs` AS `b` +WHERE (`b`.`Name` LIKE @foo_startswith) AND (`b`.`Name` LIKE @foo_endswith) +"""); + } + + public override async Task Same_captured_variable_twice_in_different_lambdas() + { + await base.Same_captured_variable_twice_in_different_lambdas(); + + AssertSql( + """ +@foo_startswith='X%' (Size = 255) +@foo_endswith='%X' (Size = 255) + +SELECT `b`.`Id`, `b`.`Name`, `b`.`Json` +FROM `Blogs` AS `b` +WHERE (`b`.`Name` LIKE @foo_startswith) AND (`b`.`Name` LIKE @foo_endswith) +"""); + } + public override async Task Multiple_queries_with_captured_variables() { await base.Multiple_queries_with_captured_variables(); AssertSql( """ -@__id1_0='8' -@__id2_1='9' +@id1='8' +@id2='9' SELECT `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` -WHERE `b`.`Id` = @__id1_0 OR `b`.`Id` = @__id2_1 +WHERE `b`.`Id` = @id1 OR `b`.`Id` = @id2 """, // """ -@__id1_0='8' +@id1='8' SELECT TOP 2 `b`.`Id`, `b`.`Name`, `b`.`Json` FROM `Blogs` AS `b` -WHERE `b`.`Id` = @__id1_0 +WHERE `b`.`Id` = @id1 """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/PrecompiledSqlPregenerationQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/PrecompiledSqlPregenerationQueryJetTest.cs index 958f3425..98db2496 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/PrecompiledSqlPregenerationQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/PrecompiledSqlPregenerationQueryJetTest.cs @@ -43,11 +43,11 @@ public override async Task Non_nullable_value_type() AssertSql( """ -@__id_0='8' +@id='8' SELECT `b`.`Id`, `b`.`Name` FROM `Blogs` AS `b` -WHERE `b`.`Id` = @__id_0 +WHERE `b`.`Id` = @id """); } @@ -57,11 +57,11 @@ public override async Task Nullable_value_type() AssertSql( """ -@__id_0='8' (Nullable = true) +@id='8' (Nullable = true) SELECT `b`.`Id`, `b`.`Name` FROM `Blogs` AS `b` -WHERE `b`.`Id` = @__id_0 +WHERE `b`.`Id` = @id """); } @@ -71,11 +71,11 @@ public override async Task Nullable_reference_type() AssertSql( """ -@__name_0='bar' (Size = 255) +@name='bar' (Size = 255) SELECT `b`.`Id`, `b`.`Name` FROM `Blogs` AS `b` -WHERE `b`.`Name` = @__name_0 +WHERE `b`.`Name` = @name """); } @@ -85,11 +85,11 @@ public override async Task Non_nullable_reference_type() AssertSql( """ -@__name_0='bar' (Nullable = false) (Size = 255) +@name='bar' (Nullable = false) (Size = 255) SELECT `b`.`Id`, `b`.`Name` FROM `Blogs` AS `b` -WHERE `b`.`Name` = @__name_0 +WHERE `b`.`Name` = @name """); } @@ -99,12 +99,12 @@ public override async Task Nullable_and_non_nullable_value_types() AssertSql( """ -@__id1_0='8' (Nullable = true) -@__id2_1='9' +@id1='8' (Nullable = true) +@id2='9' SELECT `b`.`Id`, `b`.`Name` FROM `Blogs` AS `b` -WHERE `b`.`Id` = @__id1_0 OR `b`.`Id` = @__id2_1 +WHERE `b`.`Id` = @id1 OR `b`.`Id` = @id2 """); } @@ -114,12 +114,12 @@ public override async Task Two_nullable_reference_types() AssertSql( """ -@__name1_0='foo' (Size = 255) -@__name2_1='bar' (Size = 255) +@name1='foo' (Size = 255) +@name2='bar' (Size = 255) SELECT `b`.`Id`, `b`.`Name` FROM `Blogs` AS `b` -WHERE `b`.`Name` = @__name1_0 OR `b`.`Name` = @__name2_1 +WHERE `b`.`Name` = @name1 OR `b`.`Name` = @name2 """); } @@ -129,12 +129,12 @@ public override async Task Two_non_nullable_reference_types() AssertSql( """ -@__name1_0='foo' (Nullable = false) (Size = 255) -@__name2_1='bar' (Nullable = false) (Size = 255) +@name1='foo' (Nullable = false) (Size = 255) +@name2='bar' (Nullable = false) (Size = 255) SELECT `b`.`Id`, `b`.`Name` FROM `Blogs` AS `b` -WHERE `b`.`Name` = @__name1_0 OR `b`.`Name` = @__name2_1 +WHERE `b`.`Name` = @name1 OR `b`.`Name` = @name2 """); } @@ -144,12 +144,12 @@ public override async Task Nullable_and_non_nullable_reference_types() AssertSql( """ -@__name1_0='foo' (Size = 255) -@__name2_1='bar' (Nullable = false) (Size = 255) +@name1='foo' (Size = 255) +@name2='bar' (Nullable = false) (Size = 255) SELECT `b`.`Id`, `b`.`Name` FROM `Blogs` AS `b` -WHERE `b`.`Name` = @__name1_0 OR `b`.`Name` = @__name2_1 +WHERE `b`.`Name` = @name1 OR `b`.`Name` = @name2 """); } @@ -159,14 +159,14 @@ public override async Task Too_many_nullable_parameters_prevent_pregeneration() AssertSql( """ -@__name1_0='foo' (Size = 255) -@__name2_1='bar' (Size = 255) -@__name3_2='baz' (Size = 255) -@__name4_3='baq' (Size = 255) +@name1='foo' (Size = 255) +@name2='bar' (Size = 255) +@name3='baz' (Size = 255) +@name4='baq' (Size = 255) SELECT `b`.`Id`, `b`.`Name` FROM `Blogs` AS `b` -WHERE `b`.`Name` = @__name1_0 OR `b`.`Name` = @__name2_1 OR `b`.`Name` = @__name3_2 OR `b`.`Name` = @__name4_3 +WHERE `b`.`Name` = @name1 OR `b`.`Name` = @name2 OR `b`.`Name` = @name3 OR `b`.`Name` = @name4 """); } @@ -176,14 +176,14 @@ public override async Task Many_non_nullable_parameters_do_not_prevent_pregenera AssertSql( """ -@__name1_0='foo' (Nullable = false) (Size = 255) -@__name2_1='bar' (Nullable = false) (Size = 255) -@__name3_2='baz' (Nullable = false) (Size = 255) -@__name4_3='baq' (Nullable = false) (Size = 255) +@name1='foo' (Nullable = false) (Size = 255) +@name2='bar' (Nullable = false) (Size = 255) +@name3='baz' (Nullable = false) (Size = 255) +@name4='baq' (Nullable = false) (Size = 255) SELECT `b`.`Id`, `b`.`Name` FROM `Blogs` AS `b` -WHERE `b`.`Name` = @__name1_0 OR `b`.`Name` = @__name2_1 OR `b`.`Name` = @__name3_2 OR `b`.`Name` = @__name4_3 +WHERE `b`.`Name` = @name1 OR `b`.`Name` = @name2 OR `b`.`Name` = @name3 OR `b`.`Name` = @name4 """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs index 6866caaf..25a313ee 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs @@ -36,35 +36,12 @@ public override async Task Inline_collection_of_ints_Contains(bool async) AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`Int` IN (10, 999) """); } - public override async Task Inline_collection_of_nullable_ints_Contains(bool async) - { - await base.Inline_collection_of_nullable_ints_Contains(async); - - AssertSql( - """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` -FROM `PrimitiveCollectionsEntity` AS `p` -WHERE `p`.`NullableInt` IN (10, 999) -"""); - } - - public override async Task Inline_collection_of_nullable_ints_Contains_null(bool async) - { - await base.Inline_collection_of_nullable_ints_Contains_null(async); - - AssertSql( - """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` -FROM `PrimitiveCollectionsEntity` AS `p` -WHERE `p`.`NullableInt` IS NULL OR `p`.`NullableInt` = 999 -"""); - } public override async Task Inline_collection_Count_with_zero_values(bool async) { await base.Inline_collection_Count_with_zero_values(async); @@ -78,7 +55,7 @@ public override async Task Inline_collection_Count_with_one_value(bool async) AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE ( SELECT COUNT(*) @@ -94,7 +71,7 @@ public override async Task Inline_collection_Count_with_two_values(bool async) AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE ( SELECT COUNT(*) @@ -113,7 +90,7 @@ public override async Task Inline_collection_Count_with_three_values(bool async) AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE ( SELECT COUNT(*) @@ -135,7 +112,7 @@ public override async Task Inline_collection_Contains_with_zero_values(bool asyn AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE 0 = 1 """); @@ -147,7 +124,7 @@ public override async Task Inline_collection_Contains_with_one_value(bool async) AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`Id` = 2 """); @@ -159,7 +136,7 @@ public override async Task Inline_collection_Contains_with_two_values(bool async AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`Id` IN (2, 999) """); @@ -171,7 +148,7 @@ public override async Task Inline_collection_Contains_with_three_values(bool asy AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`Id` IN (2, 999, 1000) """); @@ -182,13 +159,13 @@ public override async Task Inline_collection_Contains_with_all_parameters(bool a await base.Inline_collection_Contains_with_all_parameters(async); AssertSql( - $""" -@__i_0='2' -@__j_1='999' + """ +@i='2' +@j='999' -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` -WHERE `p`.`Id` IN ({AssertSqlHelper.Parameter("@__i_0")}, {AssertSqlHelper.Parameter("@__j_1")}) +WHERE `p`.`Id` IN (@i, @j) """); } @@ -197,12 +174,12 @@ public override async Task Inline_collection_Contains_with_constant_and_paramete await base.Inline_collection_Contains_with_constant_and_parameter(async); AssertSql( - $""" -@__j_0='999' + """ +@j='999' -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` -WHERE `p`.`Id` IN (2, {AssertSqlHelper.Parameter("@__j_0")}) +WHERE `p`.`Id` IN (2, @j) """); } @@ -211,12 +188,12 @@ public override async Task Inline_collection_Contains_with_mixed_value_types(boo await base.Inline_collection_Contains_with_mixed_value_types(async); AssertSql( - $""" -@__i_0='11' + """ +@i='11' -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` -WHERE `p`.`Int` IN (999, {AssertSqlHelper.Parameter("@__i_0")}, `p`.`Id`, `p`.`Id` + `p`.`Int`) +WHERE `p`.`Int` IN (999, @i, `p`.`Id`, `p`.`Id` + `p`.`Int`) """); } @@ -226,11 +203,11 @@ public override async Task Inline_collection_List_Contains_with_mixed_value_type AssertSql( """ -@__i_0='11' +@i='11' -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` -WHERE `p`.`Int` IN (999, @__i_0, `p`.`Id`, `p`.`Id` + `p`.`Int`) +WHERE `p`.`Int` IN (999, @i, `p`.`Id`, `p`.`Id` + `p`.`Int`) """); } @@ -240,7 +217,7 @@ public override async Task Inline_collection_Contains_as_Any_with_predicate(bool AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`Id` IN (2, 999) """); @@ -252,7 +229,7 @@ public override async Task Inline_collection_negated_Contains_as_All(bool async) AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`Id` NOT IN (2, 999) """); @@ -444,11 +421,11 @@ public override async Task Inline_collection_with_single_parameter_element_Conta AssertSql( """ -@__i_0='2' +@i='2' -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` -WHERE `p`.`Id` = @__i_0 +WHERE `p`.`Id` = @i """); } @@ -458,14 +435,14 @@ public override async Task Inline_collection_with_single_parameter_element_Count AssertSql( """ -@__i_0='2' -@__i_0='2' +@i='2' +@i='2' -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE ( SELECT COUNT(*) - FROM (SELECT IIF(@__i_0 IS NULL, NULL, CLNG(@__i_0)) AS `Value` + FROM (SELECT IIF(@i IS NULL, NULL, CLNG(@i)) AS `Value` FROM (SELECT COUNT(*) FROM `#Dual`) AS `v_0`) AS `v` WHERE `v`.`Value` > `p`.`Id`) = 1 """); @@ -514,13 +491,13 @@ public override async Task Parameter_collection_of_ints_Contains_int(bool async) AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`Int` IN (10, 999) """, // """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`Int` NOT IN (10, 999) """); @@ -532,13 +509,13 @@ public override async Task Parameter_collection_HashSet_of_ints_Contains_int(boo AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`Int` IN (10, 999) """, // """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`Int` NOT IN (10, 999) """); @@ -550,13 +527,13 @@ public override async Task Parameter_collection_ImmutableArray_of_ints_Contains_ AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`Int` IN (10, 999) """, // """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`Int` NOT IN (10, 999) """); @@ -568,67 +545,31 @@ public override async Task Parameter_collection_of_ints_Contains_nullable_int(bo AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`NullableInt` IN (10, 999) """, // """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`NullableInt` NOT IN (10, 999) OR `p`.`NullableInt` IS NULL """); } - public override async Task Parameter_collection_of_nullable_ints_Contains_int(bool async) - { - await base.Parameter_collection_of_nullable_ints_Contains_int(async); - - AssertSql( - """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` -FROM `PrimitiveCollectionsEntity` AS `p` -WHERE `p`.`Int` IN (10, 999) -""", - // - """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` -FROM `PrimitiveCollectionsEntity` AS `p` -WHERE `p`.`Int` NOT IN (10, 999) -"""); - } - - public override async Task Parameter_collection_of_nullable_ints_Contains_nullable_int(bool async) - { - await base.Parameter_collection_of_nullable_ints_Contains_nullable_int(async); - - AssertSql( - """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` -FROM `PrimitiveCollectionsEntity` AS `p` -WHERE `p`.`NullableInt` IS NULL OR `p`.`NullableInt` = 999 -""", - // - """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` -FROM `PrimitiveCollectionsEntity` AS `p` -WHERE `p`.`NullableInt` IS NOT NULL AND `p`.`NullableInt` <> 999 -"""); - } - public override async Task Parameter_collection_of_strings_Contains_string(bool async) { await base.Parameter_collection_of_strings_Contains_string(async); AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`String` IN ('10', '999') """, // """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`String` NOT IN ('10', '999') """); @@ -640,13 +581,13 @@ public override async Task Parameter_collection_of_strings_Contains_nullable_str AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`NullableString` IN ('10', '999') """, // """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`NullableString` NOT IN ('10', '999') OR `p`.`NullableString` IS NULL """); @@ -658,13 +599,13 @@ public override async Task Parameter_collection_of_nullable_strings_Contains_str AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`String` = '10' """, // """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`String` <> '10' """); @@ -676,13 +617,13 @@ public override async Task Parameter_collection_of_nullable_strings_Contains_nul AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`NullableString` IS NULL OR `p`.`NullableString` = '999' """, // """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`NullableString` IS NOT NULL AND `p`.`NullableString` <> '999' """); @@ -694,7 +635,7 @@ public override async Task Parameter_collection_of_DateTimes_Contains(bool async AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`DateTime` IN (#2020-01-10 12:30:00#, #9999-01-01#) """); @@ -706,31 +647,19 @@ public override async Task Parameter_collection_of_bools_Contains(bool async) AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`Bool` = TRUE """); } - public override async Task Parameter_collection_of_enums_Contains(bool async) - { - await base.Parameter_collection_of_enums_Contains(async); - - AssertSql( - """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` -FROM `PrimitiveCollectionsEntity` AS `p` -WHERE `p`.`Enum` IN (0, 3) -"""); - } - public override async Task Parameter_collection_null_Contains(bool async) { await base.Parameter_collection_null_Contains(async); AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE 0 = 1 """); @@ -742,7 +671,7 @@ public override async Task Parameter_collection_Contains_with_EF_Constant(bool a AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`Id` IN (2, 999, 1000) """); @@ -754,7 +683,7 @@ public override async Task Parameter_collection_Where_with_EF_Constant_Where_Any AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE EXISTS ( SELECT 1 @@ -776,7 +705,7 @@ public override async Task Parameter_collection_Count_with_column_predicate_with AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE ( SELECT COUNT(*) @@ -795,13 +724,6 @@ SELECT 1000 AS `Value` public override Task Column_collection_of_ints_Contains(bool async) => AssertTranslationFailedWithDetails(() => base.Column_collection_of_ints_Contains(async), JetStrings.QueryingIntoJsonCollectionsNotSupported()); - public override Task Column_collection_of_nullable_ints_Contains(bool async) - => AssertTranslationFailedWithDetails(() => base.Column_collection_of_nullable_ints_Contains(async), JetStrings.QueryingIntoJsonCollectionsNotSupported()); - - public override Task Column_collection_of_nullable_ints_Contains_null(bool async) - => AssertTranslationFailedWithDetails(() => base.Column_collection_of_nullable_ints_Contains_null(async), JetStrings.QueryingIntoJsonCollectionsNotSupported()); - - public override Task Column_collection_of_strings_contains_null(bool async) => AssertTranslationFailed(() => base.Column_collection_of_strings_contains_null(async)); @@ -1002,12 +924,12 @@ public override async Task Column_collection_equality_parameter_collection(bool await base.Column_collection_equality_parameter_collection(async); AssertSql( - $""" -@__ints_0='[1,10]' (Size = 255) + """ +@ints='[1,10]' (Size = 255) -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` -WHERE `p`.`Ints` = {AssertSqlHelper.Parameter("@__ints_0")} +WHERE `p`.`Ints` = @ints """); } @@ -1024,7 +946,7 @@ public override async Task Column_collection_equality_inline_collection(bool asy AssertSql( """ -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE `p`.`Ints` = '[1,10]' """); @@ -1214,8 +1136,8 @@ public override async Task Nested_contains_with_Lists_and_no_inferred_type_mappi await base.Nested_contains_with_Lists_and_no_inferred_type_mapping(async); AssertSql( -""" -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` + """ +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE IIF(`p`.`Int` IN (1, 2, 3), 'one', 'two') IN ('one', 'two', 'three') """); @@ -1226,13 +1148,152 @@ public override async Task Nested_contains_with_arrays_and_no_inferred_type_mapp await base.Nested_contains_with_arrays_and_no_inferred_type_mapping(async); AssertSql( -""" -SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`String`, `p`.`Strings` + """ +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` FROM `PrimitiveCollectionsEntity` AS `p` WHERE IIF(`p`.`Int` IN (1, 2, 3), 'one', 'two') IN ('one', 'two', 'three') """); } + public override async Task Parameter_collection_of_structs_Contains_struct(bool async) + { + await base.Parameter_collection_of_structs_Contains_struct(async); + + AssertSql( + """ +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`WrappedId` IN (22, 33) +""", + // + """ +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`WrappedId` NOT IN (11, 44) +"""); + } + + public override async Task Parameter_collection_of_structs_Contains_nullable_struct(bool async) + { + await base.Parameter_collection_of_structs_Contains_nullable_struct(async); + + AssertSql( + """ +@values1='22' +@values2='33' + +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[NullableWrappedId] IN (@values1, @values2) +""", + // + """ +@values1='11' +@values2='44' + +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[NullableWrappedId] NOT IN (@values1, @values2) OR [p].[NullableWrappedId] IS NULL +"""); + } + + public override async Task Parameter_collection_of_structs_Contains_nullable_struct_with_nullable_comparer(bool async) + { + await base.Parameter_collection_of_structs_Contains_nullable_struct_with_nullable_comparer(async); + + AssertSql( + """ +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`NullableWrappedIdWithNullableComparer` IN (22, 33) +""", + // + """ +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`NullableWrappedId` NOT IN (11, 44) OR `p`.`NullableWrappedId` IS NULL +"""); + } + + public override async Task Parameter_collection_of_nullable_structs_Contains_struct(bool async) + { + await base.Parameter_collection_of_nullable_structs_Contains_struct(async); + + AssertSql( + """ +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`WrappedId` = 22 +""", + // + """ +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`WrappedId` NOT IN (11, 44) +"""); + } + + public override async Task Parameter_collection_of_nullable_structs_Contains_nullable_struct(bool async) + { + await base.Parameter_collection_of_nullable_structs_Contains_nullable_struct(async); + + AssertSql( + """ +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`NullableWrappedId` IS NULL OR `p`.`NullableWrappedId` = 22 +""", + // + """ +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`NullableWrappedId` NOT IN (11, 44) OR `p`.`NullableWrappedId` IS NULL +"""); + } + + public override async Task Parameter_collection_of_nullable_structs_Contains_nullable_struct_with_nullable_comparer(bool async) + { + await base.Parameter_collection_of_nullable_structs_Contains_nullable_struct_with_nullable_comparer(async); + + AssertSql( + """ +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`NullableWrappedIdWithNullableComparer` IS NULL OR `p`.`NullableWrappedIdWithNullableComparer` = 22 +""", + // + """ +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`NullableWrappedIdWithNullableComparer` NOT IN (11, 44) OR `p`.`NullableWrappedIdWithNullableComparer` IS NULL +"""); + } + + public override async Task Values_of_enum_casted_to_underlying_value(bool async) + { + await base.Values_of_enum_casted_to_underlying_value(async); + + AssertSql( + """ +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE ( + SELECT COUNT(*) + FROM (SELECT CLNG(0) AS `Value` + FROM (SELECT COUNT(*) FROM `#Dual`) AS `v_0` + UNION + SELECT 1 AS `Value` + FROM (SELECT COUNT(*) FROM `#Dual`) AS `v_1` + UNION + SELECT 2 AS `Value` + FROM (SELECT COUNT(*) FROM `#Dual`) AS `v_2` + UNION + SELECT 3 AS `Value` + FROM (SELECT COUNT(*) FROM `#Dual`) AS `v_3`) AS `v` + WHERE `v`.`Value` = `p`.`Int`) > 0 +"""); + } + [ConditionalFact] public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); diff --git a/test/EFCore.Jet.FunctionalTests/Query/QueryFilterFuncletizationJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/QueryFilterFuncletizationJetTest.cs index 39b9ea6c..36b23d52 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/QueryFilterFuncletizationJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/QueryFilterFuncletizationJetTest.cs @@ -24,14 +24,14 @@ public override void DbContext_property_parameter_does_not_clash_with_closure_pa base.DbContext_property_parameter_does_not_clash_with_closure_parameter_name(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Field_0='False'")} - {AssertSqlHelper.Declaration("@__Field_0='False'")} - - SELECT `f`.`Id`, `f`.`IsEnabled` - FROM `FieldFilter` AS `f` - WHERE `f`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Field_0")} AND `f`.`IsEnabled` = {AssertSqlHelper.Parameter("@__Field_0")} - """); + """ +@ef_filter__Field='False' +@Field='False' + +SELECT `f`.`Id`, `f`.`IsEnabled` +FROM `FieldFilter` AS `f` +WHERE `f`.`IsEnabled` = @ef_filter__Field AND `f`.`IsEnabled` = @Field +"""); } public override void DbContext_field_is_parameterized() @@ -39,21 +39,21 @@ public override void DbContext_field_is_parameterized() base.DbContext_field_is_parameterized(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Field_0='False'")} - - SELECT `f`.`Id`, `f`.`IsEnabled` - FROM `FieldFilter` AS `f` - WHERE `f`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Field_0")} - """, + """ +@ef_filter__Field='False' + +SELECT `f`.`Id`, `f`.`IsEnabled` +FROM `FieldFilter` AS `f` +WHERE `f`.`IsEnabled` = @ef_filter__Field +""", // - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Field_0='True'")} - - SELECT `f`.`Id`, `f`.`IsEnabled` - FROM `FieldFilter` AS `f` - WHERE `f`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Field_0")} - """); + """ +@ef_filter__Field='True' + +SELECT `f`.`Id`, `f`.`IsEnabled` +FROM `FieldFilter` AS `f` +WHERE `f`.`IsEnabled` = @ef_filter__Field +"""); } public override void DbContext_property_is_parameterized() @@ -61,21 +61,21 @@ public override void DbContext_property_is_parameterized() base.DbContext_property_is_parameterized(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Property_0='False'")} - - SELECT `p`.`Id`, `p`.`IsEnabled` - FROM `PropertyFilter` AS `p` - WHERE `p`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Property_0")} - """, + """ +@ef_filter__Property='False' + +SELECT `p`.`Id`, `p`.`IsEnabled` +FROM `PropertyFilter` AS `p` +WHERE `p`.`IsEnabled` = @ef_filter__Property +""", // - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Property_0='True'")} - - SELECT `p`.`Id`, `p`.`IsEnabled` - FROM `PropertyFilter` AS `p` - WHERE `p`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Property_0")} - """); + """ +@ef_filter__Property='True' + +SELECT `p`.`Id`, `p`.`IsEnabled` +FROM `PropertyFilter` AS `p` +WHERE `p`.`IsEnabled` = @ef_filter__Property +"""); } public override void DbContext_method_call_is_parameterized() @@ -83,13 +83,13 @@ public override void DbContext_method_call_is_parameterized() base.DbContext_method_call_is_parameterized(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__p_0='2'")} - - SELECT `m`.`Id`, `m`.`Tenant` - FROM `MethodCallFilter` AS `m` - WHERE `m`.`Tenant` = {AssertSqlHelper.Parameter("@__ef_filter__p_0")} - """); + """ +@ef_filter__p='2' + +SELECT `m`.`Id`, `m`.`Tenant` +FROM `MethodCallFilter` AS `m` +WHERE `m`.`Tenant` = @ef_filter__p +"""); } public override void DbContext_list_is_parameterized() @@ -127,21 +127,21 @@ public override void DbContext_property_chain_is_parameterized() base.DbContext_property_chain_is_parameterized(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Enabled_0='False'")} - - SELECT `p`.`Id`, `p`.`IsEnabled` - FROM `PropertyChainFilter` AS `p` - WHERE `p`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Enabled_0")} - """, + """ +@ef_filter__Enabled='False' + +SELECT `p`.`Id`, `p`.`IsEnabled` +FROM `PropertyChainFilter` AS `p` +WHERE `p`.`IsEnabled` = @ef_filter__Enabled +""", // - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Enabled_0='True'")} - - SELECT `p`.`Id`, `p`.`IsEnabled` - FROM `PropertyChainFilter` AS `p` - WHERE `p`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Enabled_0")} - """); + """ +@ef_filter__Enabled='True' + +SELECT `p`.`Id`, `p`.`IsEnabled` +FROM `PropertyChainFilter` AS `p` +WHERE `p`.`IsEnabled` = @ef_filter__Enabled +"""); } public override void DbContext_property_method_call_is_parameterized() @@ -149,13 +149,13 @@ public override void DbContext_property_method_call_is_parameterized() base.DbContext_property_method_call_is_parameterized(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__p_0='2'")} - - SELECT `p`.`Id`, `p`.`Tenant` - FROM `PropertyMethodCallFilter` AS `p` - WHERE `p`.`Tenant` = {AssertSqlHelper.Parameter("@__ef_filter__p_0")} - """); + """ +@ef_filter__p='2' + +SELECT `p`.`Id`, `p`.`Tenant` +FROM `PropertyMethodCallFilter` AS `p` +WHERE `p`.`Tenant` = @ef_filter__p +"""); } public override void DbContext_method_call_chain_is_parameterized() @@ -163,13 +163,13 @@ public override void DbContext_method_call_chain_is_parameterized() base.DbContext_method_call_chain_is_parameterized(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__p_0='2'")} - - SELECT `m`.`Id`, `m`.`Tenant` - FROM `MethodCallChainFilter` AS `m` - WHERE `m`.`Tenant` = {AssertSqlHelper.Parameter("@__ef_filter__p_0")} - """); + """ +@ef_filter__p='2' + +SELECT `m`.`Id`, `m`.`Tenant` +FROM `MethodCallChainFilter` AS `m` +WHERE `m`.`Tenant` = @ef_filter__p +"""); } public override void DbContext_complex_expression_is_parameterized() @@ -177,32 +177,32 @@ public override void DbContext_complex_expression_is_parameterized() base.DbContext_complex_expression_is_parameterized(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Property_0='False'")} - {AssertSqlHelper.Declaration("@__ef_filter__p_1='True'")} - - SELECT `c`.`Id`, `c`.`IsEnabled` - FROM `ComplexFilter` AS `c` - WHERE `c`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Property_0")} AND {AssertSqlHelper.Parameter("@__ef_filter__p_1")} = TRUE - """, + """ +@ef_filter__Property='False' +@ef_filter__p0='True' + +SELECT `c`.`Id`, `c`.`IsEnabled` +FROM `ComplexFilter` AS `c` +WHERE `c`.`IsEnabled` = @ef_filter__Property AND @ef_filter__p0 = TRUE +""", // - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Property_0='True'")} - {AssertSqlHelper.Declaration("@__ef_filter__p_1='True'")} - - SELECT `c`.`Id`, `c`.`IsEnabled` - FROM `ComplexFilter` AS `c` - WHERE `c`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Property_0")} AND {AssertSqlHelper.Parameter("@__ef_filter__p_1")} = TRUE - """, + """ +@ef_filter__Property='True' +@ef_filter__p0='True' + +SELECT `c`.`Id`, `c`.`IsEnabled` +FROM `ComplexFilter` AS `c` +WHERE `c`.`IsEnabled` = @ef_filter__Property AND @ef_filter__p0 = TRUE +""", // - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Property_0='True'")} - {AssertSqlHelper.Declaration("@__ef_filter__p_1='False'")} - - SELECT `c`.`Id`, `c`.`IsEnabled` - FROM `ComplexFilter` AS `c` - WHERE `c`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Property_0")} AND {AssertSqlHelper.Parameter("@__ef_filter__p_1")} = TRUE - """); + """ +@ef_filter__Property='True' +@ef_filter__p0='False' + +SELECT `c`.`Id`, `c`.`IsEnabled` +FROM `ComplexFilter` AS `c` +WHERE `c`.`IsEnabled` = @ef_filter__Property AND @ef_filter__p0 = TRUE +"""); } public override void DbContext_property_based_filter_does_not_short_circuit() @@ -210,30 +210,30 @@ public override void DbContext_property_based_filter_does_not_short_circuit() base.DbContext_property_based_filter_does_not_short_circuit(); AssertSql( - $""" -@__ef_filter__p_1='False' -@__ef_filter__IsModerated_0='True' (Nullable = true) + """ +@ef_filter__p0='False' +@ef_filter__IsModerated='True' (Nullable = true) SELECT `s`.`Id`, `s`.`IsDeleted`, `s`.`IsModerated` FROM `ShortCircuitFilter` AS `s` -WHERE `s`.`IsDeleted` = FALSE AND ({AssertSqlHelper.Parameter("@__ef_filter__p_1")} = TRUE OR {AssertSqlHelper.Parameter("@__ef_filter__IsModerated_0")} = `s`.`IsModerated`) +WHERE `s`.`IsDeleted` = FALSE AND (@ef_filter__p0 = TRUE OR @ef_filter__IsModerated = `s`.`IsModerated`) """, // - $""" -@__ef_filter__p_1='False' -@__ef_filter__IsModerated_0='False' (Nullable = true) + """ +@ef_filter__p0='False' +@ef_filter__IsModerated='False' (Nullable = true) SELECT `s`.`Id`, `s`.`IsDeleted`, `s`.`IsModerated` FROM `ShortCircuitFilter` AS `s` -WHERE `s`.`IsDeleted` = FALSE AND ({AssertSqlHelper.Parameter("@__ef_filter__p_1")} = TRUE OR {AssertSqlHelper.Parameter("@__ef_filter__IsModerated_0")} = `s`.`IsModerated`) +WHERE `s`.`IsDeleted` = FALSE AND (@ef_filter__p0 = TRUE OR @ef_filter__IsModerated = `s`.`IsModerated`) """, // - $""" -@__ef_filter__p_1='True' + """ +@ef_filter__p0='True' SELECT `s`.`Id`, `s`.`IsDeleted`, `s`.`IsModerated` FROM `ShortCircuitFilter` AS `s` -WHERE `s`.`IsDeleted` = FALSE AND {AssertSqlHelper.Parameter("@__ef_filter__p_1")} = TRUE +WHERE `s`.`IsDeleted` = FALSE AND @ef_filter__p0 = TRUE """); } @@ -242,21 +242,21 @@ public override void EntityTypeConfiguration_DbContext_field_is_parameterized() base.EntityTypeConfiguration_DbContext_field_is_parameterized(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Field_0='False'")} - - SELECT `e`.`Id`, `e`.`IsEnabled` - FROM `EntityTypeConfigurationFieldFilter` AS `e` - WHERE `e`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Field_0")} - """, + """ +@ef_filter__Field='False' + +SELECT `e`.`Id`, `e`.`IsEnabled` +FROM `EntityTypeConfigurationFieldFilter` AS `e` +WHERE `e`.`IsEnabled` = @ef_filter__Field +""", // - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Field_0='True'")} - - SELECT `e`.`Id`, `e`.`IsEnabled` - FROM `EntityTypeConfigurationFieldFilter` AS `e` - WHERE `e`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Field_0")} - """); + """ +@ef_filter__Field='True' + +SELECT `e`.`Id`, `e`.`IsEnabled` +FROM `EntityTypeConfigurationFieldFilter` AS `e` +WHERE `e`.`IsEnabled` = @ef_filter__Field +"""); } public override void EntityTypeConfiguration_DbContext_property_is_parameterized() @@ -264,21 +264,21 @@ public override void EntityTypeConfiguration_DbContext_property_is_parameterized base.EntityTypeConfiguration_DbContext_property_is_parameterized(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Property_0='False'")} - - SELECT `e`.`Id`, `e`.`IsEnabled` - FROM `EntityTypeConfigurationPropertyFilter` AS `e` - WHERE `e`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Property_0")} - """, + """ +@ef_filter__Property='False' + +SELECT `e`.`Id`, `e`.`IsEnabled` +FROM `EntityTypeConfigurationPropertyFilter` AS `e` +WHERE `e`.`IsEnabled` = @ef_filter__Property +""", // - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Property_0='True'")} - - SELECT `e`.`Id`, `e`.`IsEnabled` - FROM `EntityTypeConfigurationPropertyFilter` AS `e` - WHERE `e`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Property_0")} - """); + """ +@ef_filter__Property='True' + +SELECT `e`.`Id`, `e`.`IsEnabled` +FROM `EntityTypeConfigurationPropertyFilter` AS `e` +WHERE `e`.`IsEnabled` = @ef_filter__Property +"""); } public override void EntityTypeConfiguration_DbContext_method_call_is_parameterized() @@ -286,13 +286,13 @@ public override void EntityTypeConfiguration_DbContext_method_call_is_parameteri base.EntityTypeConfiguration_DbContext_method_call_is_parameterized(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__p_0='2'")} - - SELECT `e`.`Id`, `e`.`Tenant` - FROM `EntityTypeConfigurationMethodCallFilter` AS `e` - WHERE `e`.`Tenant` = {AssertSqlHelper.Parameter("@__ef_filter__p_0")} - """); + """ +@ef_filter__p='2' + +SELECT `e`.`Id`, `e`.`Tenant` +FROM `EntityTypeConfigurationMethodCallFilter` AS `e` +WHERE `e`.`Tenant` = @ef_filter__p +"""); } public override void EntityTypeConfiguration_DbContext_property_chain_is_parameterized() @@ -300,21 +300,21 @@ public override void EntityTypeConfiguration_DbContext_property_chain_is_paramet base.EntityTypeConfiguration_DbContext_property_chain_is_parameterized(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Enabled_0='False'")} - - SELECT `e`.`Id`, `e`.`IsEnabled` - FROM `EntityTypeConfigurationPropertyChainFilter` AS `e` - WHERE `e`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Enabled_0")} - """, + """ +@ef_filter__Enabled='False' + +SELECT `e`.`Id`, `e`.`IsEnabled` +FROM `EntityTypeConfigurationPropertyChainFilter` AS `e` +WHERE `e`.`IsEnabled` = @ef_filter__Enabled +""", // - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Enabled_0='True'")} - - SELECT `e`.`Id`, `e`.`IsEnabled` - FROM `EntityTypeConfigurationPropertyChainFilter` AS `e` - WHERE `e`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Enabled_0")} - """); + """ +@ef_filter__Enabled='True' + +SELECT `e`.`Id`, `e`.`IsEnabled` +FROM `EntityTypeConfigurationPropertyChainFilter` AS `e` +WHERE `e`.`IsEnabled` = @ef_filter__Enabled +"""); } public override void Local_method_DbContext_field_is_parameterized() @@ -322,21 +322,21 @@ public override void Local_method_DbContext_field_is_parameterized() base.Local_method_DbContext_field_is_parameterized(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Field_0='False'")} - - SELECT `l`.`Id`, `l`.`IsEnabled` - FROM `LocalMethodFilter` AS `l` - WHERE `l`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Field_0")} - """, + """ +@ef_filter__Field='False' + +SELECT `l`.`Id`, `l`.`IsEnabled` +FROM `LocalMethodFilter` AS `l` +WHERE `l`.`IsEnabled` = @ef_filter__Field +""", // - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Field_0='True'")} - - SELECT `l`.`Id`, `l`.`IsEnabled` - FROM `LocalMethodFilter` AS `l` - WHERE `l`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Field_0")} - """); + """ +@ef_filter__Field='True' + +SELECT `l`.`Id`, `l`.`IsEnabled` +FROM `LocalMethodFilter` AS `l` +WHERE `l`.`IsEnabled` = @ef_filter__Field +"""); } public override void Local_static_method_DbContext_property_is_parameterized() @@ -344,21 +344,21 @@ public override void Local_static_method_DbContext_property_is_parameterized() base.Local_static_method_DbContext_property_is_parameterized(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Property_0='False'")} - - SELECT `l`.`Id`, `l`.`IsEnabled` - FROM `LocalMethodParamsFilter` AS `l` - WHERE `l`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Property_0")} - """, + """ +@ef_filter__Property='False' + +SELECT `l`.`Id`, `l`.`IsEnabled` +FROM `LocalMethodParamsFilter` AS `l` +WHERE `l`.`IsEnabled` = @ef_filter__Property +""", // - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Property_0='True'")} - - SELECT `l`.`Id`, `l`.`IsEnabled` - FROM `LocalMethodParamsFilter` AS `l` - WHERE `l`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Property_0")} - """); + """ +@ef_filter__Property='True' + +SELECT `l`.`Id`, `l`.`IsEnabled` +FROM `LocalMethodParamsFilter` AS `l` +WHERE `l`.`IsEnabled` = @ef_filter__Property +"""); } public override void Remote_method_DbContext_property_method_call_is_parameterized() @@ -366,13 +366,13 @@ public override void Remote_method_DbContext_property_method_call_is_parameteriz base.Remote_method_DbContext_property_method_call_is_parameterized(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__p_0='2'")} - - SELECT `r`.`Id`, `r`.`Tenant` - FROM `RemoteMethodParamsFilter` AS `r` - WHERE `r`.`Tenant` = {AssertSqlHelper.Parameter("@__ef_filter__p_0")} - """); + """ +@ef_filter__p='2' + +SELECT `r`.`Id`, `r`.`Tenant` +FROM `RemoteMethodParamsFilter` AS `r` +WHERE `r`.`Tenant` = @ef_filter__p +"""); } public override void Extension_method_DbContext_field_is_parameterized() @@ -380,21 +380,21 @@ public override void Extension_method_DbContext_field_is_parameterized() base.Extension_method_DbContext_field_is_parameterized(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Field_0='False'")} - - SELECT `e`.`Id`, `e`.`IsEnabled` - FROM `ExtensionBuilderFilter` AS `e` - WHERE `e`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Field_0")} - """, + """ +@ef_filter__Field='False' + +SELECT `e`.`Id`, `e`.`IsEnabled` +FROM `ExtensionBuilderFilter` AS `e` +WHERE `e`.`IsEnabled` = @ef_filter__Field +""", // - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Field_0='True'")} - - SELECT `e`.`Id`, `e`.`IsEnabled` - FROM `ExtensionBuilderFilter` AS `e` - WHERE `e`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Field_0")} - """); + """ +@ef_filter__Field='True' + +SELECT `e`.`Id`, `e`.`IsEnabled` +FROM `ExtensionBuilderFilter` AS `e` +WHERE `e`.`IsEnabled` = @ef_filter__Field +"""); } public override void Extension_method_DbContext_property_chain_is_parameterized() @@ -402,21 +402,21 @@ public override void Extension_method_DbContext_property_chain_is_parameterized( base.Extension_method_DbContext_property_chain_is_parameterized(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Enabled_0='False'")} - - SELECT `e`.`Id`, `e`.`IsEnabled` - FROM `ExtensionContextFilter` AS `e` - WHERE `e`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Enabled_0")} - """, + """ +@ef_filter__Enabled='False' + +SELECT `e`.`Id`, `e`.`IsEnabled` +FROM `ExtensionContextFilter` AS `e` +WHERE `e`.`IsEnabled` = @ef_filter__Enabled +""", // - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Enabled_0='True'")} - - SELECT `e`.`Id`, `e`.`IsEnabled` - FROM `ExtensionContextFilter` AS `e` - WHERE `e`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Enabled_0")} - """); + """ +@ef_filter__Enabled='True' + +SELECT `e`.`Id`, `e`.`IsEnabled` +FROM `ExtensionContextFilter` AS `e` +WHERE `e`.`IsEnabled` = @ef_filter__Enabled +"""); } public override void Using_DbSet_in_filter_works() @@ -424,19 +424,19 @@ public override void Using_DbSet_in_filter_works() base.Using_DbSet_in_filter_works(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Property_0='False'")} - - SELECT `p`.`Id`, `p`.`Filler` - FROM `PrincipalSetFilter` AS `p` - WHERE EXISTS ( - SELECT 1 - FROM `Dependents` AS `d` - WHERE EXISTS ( - SELECT 1 - FROM `MultiContextFilter` AS `m` - WHERE `m`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Property_0")} AND `m`.`BossId` = 1 AND `m`.`BossId` = `d`.`PrincipalSetFilterId`) AND `d`.`PrincipalSetFilterId` = `p`.`Id`) - """); + """ +@ef_filter__Property='False' + +SELECT `p`.`Id`, `p`.`Filler` +FROM `PrincipalSetFilter` AS `p` +WHERE EXISTS ( + SELECT 1 + FROM `Dependents` AS `d` + WHERE EXISTS ( + SELECT 1 + FROM `MultiContextFilter` AS `m` + WHERE `m`.`IsEnabled` = @ef_filter__Property AND `m`.`BossId` = 1 AND `m`.`BossId` = `d`.`PrincipalSetFilterId`) AND `d`.`PrincipalSetFilterId` = `p`.`Id`) +"""); } public override void Using_Context_set_method_in_filter_works() @@ -444,16 +444,16 @@ public override void Using_Context_set_method_in_filter_works() base.Using_Context_set_method_in_filter_works(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Property_0='False'")} - - SELECT `d`.`Id`, `d`.`PrincipalSetFilterId` - FROM `Dependents` AS `d` - WHERE EXISTS ( - SELECT 1 - FROM `MultiContextFilter` AS `m` - WHERE `m`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Property_0")} AND `m`.`BossId` = 1 AND `m`.`BossId` = `d`.`PrincipalSetFilterId`) - """); + """ +@ef_filter__Property='False' + +SELECT `d`.`Id`, `d`.`PrincipalSetFilterId` +FROM `Dependents` AS `d` +WHERE EXISTS ( + SELECT 1 + FROM `MultiContextFilter` AS `m` + WHERE `m`.`IsEnabled` = @ef_filter__Property AND `m`.`BossId` = 1 AND `m`.`BossId` = `d`.`PrincipalSetFilterId`) +"""); } public override void Static_member_from_dbContext_is_inlined() @@ -509,21 +509,21 @@ public override void Using_multiple_context_in_filter_parametrize_only_current_c base.Using_multiple_context_in_filter_parametrize_only_current_context(); AssertSql( - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Property_0='False'")} - - SELECT `m`.`Id`, `m`.`BossId`, `m`.`IsEnabled` - FROM `MultiContextFilter` AS `m` - WHERE `m`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Property_0")} AND `m`.`BossId` = 1 - """, + """ +@ef_filter__Property='False' + +SELECT `m`.`Id`, `m`.`BossId`, `m`.`IsEnabled` +FROM `MultiContextFilter` AS `m` +WHERE `m`.`IsEnabled` = @ef_filter__Property AND `m`.`BossId` = 1 +""", // - $""" - {AssertSqlHelper.Declaration("@__ef_filter__Property_0='True'")} - - SELECT `m`.`Id`, `m`.`BossId`, `m`.`IsEnabled` - FROM `MultiContextFilter` AS `m` - WHERE `m`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Property_0")} AND `m`.`BossId` = 1 - """); + """ +@ef_filter__Property='True' + +SELECT `m`.`Id`, `m`.`BossId`, `m`.`IsEnabled` +FROM `MultiContextFilter` AS `m` +WHERE `m`.`IsEnabled` = @ef_filter__Property AND `m`.`BossId` = 1 +"""); } private void AssertSql(params string[] expected) diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/ComplexRelationshipsJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/ComplexRelationshipsJetFixture.cs new file mode 100644 index 00000000..00e77324 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/ComplexRelationshipsJetFixture.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore.Query.Relationships; +using Microsoft.EntityFrameworkCore.TestUtilities; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships; + +public class ComplexRelationshipsJetFixture : ComplexRelationshipsRelationalFixtureBase, ITestSqlLoggerFactory +{ + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; + + public TestSqlLoggerFactory TestSqlLoggerFactory + => (TestSqlLoggerFactory)ListLoggerFactory; +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Include/NavigationIncludeJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Include/NavigationIncludeJetTest.cs new file mode 100644 index 00000000..e3ff0cce --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Include/NavigationIncludeJetTest.cs @@ -0,0 +1,153 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Relationships; +using Microsoft.EntityFrameworkCore.Query.Relationships.Include; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include; + +public class NavigationIncludeJetTest + : NavigationIncludeRelationalTestBase +{ + public NavigationIncludeJetTest(NavigationRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Include_trunk_required(bool async) + { + await base.Include_trunk_required(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId` +FROM `RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id` +"""); + } + + public override async Task Include_trunk_optional(bool async) + { + await base.Include_trunk_optional(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId` +FROM `RootEntities` AS `r` +LEFT JOIN `TrunkEntities` AS `t` ON `r`.`OptionalReferenceTrunkId` = `t`.`Id` +"""); + } + + public override async Task Include_trunk_collection(bool async) + { + await base.Include_trunk_collection(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId` +FROM `RootEntities` AS `r` +LEFT JOIN `TrunkEntities` AS `t` ON `r`.`Id` = `t`.`CollectionRootId` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Include_trunk_required_optional_and_collection(bool async) + { + await base.Include_trunk_required_optional_and_collection(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `t0`.`Id`, `t0`.`CollectionRootId`, `t0`.`Name`, `t0`.`OptionalReferenceBranchId`, `t0`.`RequiredReferenceBranchId`, `t1`.`Id`, `t1`.`CollectionRootId`, `t1`.`Name`, `t1`.`OptionalReferenceBranchId`, `t1`.`RequiredReferenceBranchId` +FROM ((`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `TrunkEntities` AS `t0` ON `r`.`OptionalReferenceTrunkId` = `t0`.`Id`) +LEFT JOIN `TrunkEntities` AS `t1` ON `r`.`Id` = `t1`.`CollectionRootId` +ORDER BY `r`.`Id`, `t`.`Id`, `t0`.`Id` +"""); + } + + public override async Task Include_branch_required_required(bool async) + { + await base.Include_branch_required_required(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`RequiredReferenceBranchId` = `b`.`Id` +WHERE `t`.`RequiredReferenceBranchId` IS NOT NULL AND `b`.`Id` IS NOT NULL +"""); + } + + public override async Task Include_branch_required_collection(bool async) + { + await base.Include_branch_required_collection(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`Id` = `b`.`CollectionTrunkId` +ORDER BY `r`.`Id`, `t`.`Id` +"""); + } + + public override async Task Include_branch_optional_optional(bool async) + { + await base.Include_branch_optional_optional(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +LEFT JOIN `TrunkEntities` AS `t` ON `r`.`OptionalReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`OptionalReferenceBranchId` = `b`.`Id` +"""); + } + + public override async Task Include_branch_optional_collection(bool async) + { + await base.Include_branch_optional_collection(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +LEFT JOIN `TrunkEntities` AS `t` ON `r`.`OptionalReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`Id` = `b`.`CollectionTrunkId` +ORDER BY `r`.`Id`, `t`.`Id` +"""); + } + + public override async Task Include_branch_collection_collection(bool async) + { + await base.Include_branch_collection_collection(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s`.`Id`, `s`.`CollectionRootId`, `s`.`Name`, `s`.`OptionalReferenceBranchId`, `s`.`RequiredReferenceBranchId`, `s`.`Id0`, `s`.`CollectionTrunkId`, `s`.`Name0`, `s`.`OptionalReferenceLeafId`, `s`.`RequiredReferenceLeafId` +FROM `RootEntities` AS `r` +LEFT JOIN ( + SELECT `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `b`.`Id` AS `Id0`, `b`.`CollectionTrunkId`, `b`.`Name` AS `Name0`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` + FROM `TrunkEntities` AS `t` + LEFT JOIN `BranchEntities` AS `b` ON `t`.`Id` = `b`.`CollectionTrunkId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId` +ORDER BY `r`.`Id`, `s`.`Id` +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/NavigationRelationshipsJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/NavigationRelationshipsJetFixture.cs new file mode 100644 index 00000000..f54abd79 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/NavigationRelationshipsJetFixture.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore.Query.Relationships; +using Microsoft.EntityFrameworkCore.TestUtilities; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships; + +public class NavigationRelationshipsJetFixture : NavigationRelationshipsRelationalFixtureBase, ITestSqlLoggerFactory +{ + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; + + public TestSqlLoggerFactory TestSqlLoggerFactory + => (TestSqlLoggerFactory)ListLoggerFactory; +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/OwnedJsonRelationshipsJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/OwnedJsonRelationshipsJetFixture.cs new file mode 100644 index 00000000..cc00c77f --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/OwnedJsonRelationshipsJetFixture.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore.Query.Relationships; +using Microsoft.EntityFrameworkCore.TestUtilities; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships; + +public class OwnedJsonRelationshipsJetFixture : OwnedJsonRelationshipsRelationalFixtureBase, ITestSqlLoggerFactory +{ + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; + + public TestSqlLoggerFactory TestSqlLoggerFactory + => (TestSqlLoggerFactory)ListLoggerFactory; +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/OwnedJsonTypeRelationshipsJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/OwnedJsonTypeRelationshipsJetFixture.cs new file mode 100644 index 00000000..82d1a3ff --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/OwnedJsonTypeRelationshipsJetFixture.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Relationships; +using Microsoft.EntityFrameworkCore.TestModels.RelationshipsModel; +using Microsoft.EntityFrameworkCore.TestUtilities; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships; + +public class OwnedJsonTypeRelationshipsJetFixture : OwnedJsonRelationshipsRelationalFixtureBase, ITestSqlLoggerFactory +{ + protected override string StoreName => "JsonTypeRelationshipsQueryTest"; + + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; + + public TestSqlLoggerFactory TestSqlLoggerFactory + => (TestSqlLoggerFactory)ListLoggerFactory; + + protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) + { + base.OnModelCreating(modelBuilder, context); + + modelBuilder.Entity().OwnsOne(x => x.RequiredReferenceTrunk).HasColumnType("json"); + modelBuilder.Entity().OwnsOne(x => x.OptionalReferenceTrunk).HasColumnType("json"); + modelBuilder.Entity().OwnsMany(x => x.CollectionTrunk).HasColumnType("json"); + } + + public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) + => base.AddOptions(builder); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/OwnedRelationshipsJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/OwnedRelationshipsJetFixture.cs new file mode 100644 index 00000000..672eae35 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/OwnedRelationshipsJetFixture.cs @@ -0,0 +1,44 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Relationships; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships; + +public class OwnedRelationshipsJetFixture : OwnedRelationshipsRelationalFixtureBase, ITestSqlLoggerFactory +{ + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; + + public TestSqlLoggerFactory TestSqlLoggerFactory + => (TestSqlLoggerFactory)ListLoggerFactory; + + protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) + { + base.OnModelCreating(modelBuilder, context); + foreach (var entity in modelBuilder.Model.GetEntityTypes()) + { + if (entity.GetTableName() == "Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf") + { + entity.SetTableName("Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840"); + } + if (entity.GetTableName() == "Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf") + { + entity.SetTableName("Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840"); + } + if (entity.GetTableName() == "Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollectionLeaf") + { + entity.SetTableName("Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB7BC1840"); + } + if (entity.GetTableName() == "Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollectionLeaf") + { + entity.SetTableName("Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollB7BC1840"); + } + + } + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/OwnedTableSplittingRelationshipsJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/OwnedTableSplittingRelationshipsJetFixture.cs new file mode 100644 index 00000000..7ff4d196 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/OwnedTableSplittingRelationshipsJetFixture.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore.Query.Relationships; +using Microsoft.EntityFrameworkCore.TestUtilities; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships; + +public class OwnedTableSplittingRelationshipsJetFixture : OwnedTableSplittingRelationshipsRelationalFixtureBase, ITestSqlLoggerFactory +{ + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; + + public TestSqlLoggerFactory TestSqlLoggerFactory + => (TestSqlLoggerFactory)ListLoggerFactory; +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/ComplexNoTrackingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/ComplexNoTrackingProjectionJetTest.cs new file mode 100644 index 00000000..a3d1bf7f --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/ComplexNoTrackingProjectionJetTest.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +public class ComplexNoTrackingProjectionJetTest + : ComplexNoTrackingProjectionRelationalTestBase +{ + public ComplexNoTrackingProjectionJetTest(ComplexRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Select_everything(bool async) + { + await base.Select_everything(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `t`.`RequiredReferenceBranch_Name`, `t`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` +FROM `RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`Id` = `t`.`Id` +"""); + } + + public override async Task Select_root(bool async) + { + await base.Select_root(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId` +FROM `RootEntities` AS `r` +"""); + } + + public override async Task Select_trunk_optional(bool async) + { + await base.Select_trunk_optional(async); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `t`.`RequiredReferenceBranch_Name`, `t`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` +FROM `RootEntities` AS `r` +LEFT JOIN `TrunkEntities` AS `t` ON `r`.`OptionalReferenceTrunkId` = `t`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_trunk_required(bool async) + { + await base.Select_trunk_required(async); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `t`.`RequiredReferenceBranch_Name`, `t`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` +FROM `RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_branch_required_required(bool async) + { + await base.Select_branch_required_required(async); + + AssertSql( + """ +SELECT `t`.`RequiredReferenceBranch_Name`, `t`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` +FROM `RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_branch_required_optional(bool async) + { + await base.Select_branch_required_optional(async); + + AssertSql(); + } + + public override async Task Select_branch_optional_required(bool async) + { + await base.Select_branch_optional_required(async); + + AssertSql(); + } + + public override async Task Select_branch_optional_optional(bool async) + { + await base.Select_branch_optional_optional(async); + + AssertSql(); + } + + public override async Task Select_root_duplicated(bool async) + { + await base.Select_root_duplicated(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId` +FROM `RootEntities` AS `r` +"""); + } + + public override async Task Select_trunk_and_branch_duplicated(bool async) + { + await base.Select_trunk_and_branch_duplicated(async); + + AssertSql(); + } + + public override async Task Select_trunk_and_trunk_duplicated(bool async) + { + await base.Select_trunk_and_trunk_duplicated(async); + + AssertSql(); + } + + public override async Task Select_leaf_trunk_root(bool async) + { + await base.Select_leaf_trunk_root(async); + + AssertSql( + """ +SELECT `t`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `t`.`RequiredReferenceBranch_Name`, `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId` +FROM `RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id` +"""); + } + + public override async Task Select_subquery_root_set_required_trunk_FirstOrDefault_branch(bool async) + { + await base.Select_subquery_root_set_required_trunk_FirstOrDefault_branch(async); + + AssertSql(); + } + + public override async Task Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(bool async) + { + await base.Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(async); + + AssertSql(); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/ComplexProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/ComplexProjectionJetTest.cs new file mode 100644 index 00000000..555eb4de --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/ComplexProjectionJetTest.cs @@ -0,0 +1,162 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +public class ComplexProjectionJetTest + : ComplexProjectionRelationalTestBase +{ + public ComplexProjectionJetTest(ComplexRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Select_everything(bool async) + { + await base.Select_everything(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `t`.`RequiredReferenceBranch_Name`, `t`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` +FROM `RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`Id` = `t`.`Id` +"""); + } + + public override async Task Select_root(bool async) + { + await base.Select_root(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId` +FROM `RootEntities` AS `r` +"""); + } + + public override async Task Select_trunk_optional(bool async) + { + await base.Select_trunk_optional(async); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `t`.`RequiredReferenceBranch_Name`, `t`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` +FROM `RootEntities` AS `r` +LEFT JOIN `TrunkEntities` AS `t` ON `r`.`OptionalReferenceTrunkId` = `t`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_trunk_required(bool async) + { + await base.Select_trunk_required(async); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `t`.`RequiredReferenceBranch_Name`, `t`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` +FROM `RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_branch_required_required(bool async) + { + await base.Select_branch_required_required(async); + + AssertSql( + """ +SELECT `t`.`RequiredReferenceBranch_Name`, `t`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` +FROM `RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_branch_required_optional(bool async) + { + await base.Select_branch_required_optional(async); + + AssertSql(); + } + + public override async Task Select_branch_optional_required(bool async) + { + await base.Select_branch_optional_required(async); + + AssertSql(); + } + + public override async Task Select_branch_optional_optional(bool async) + { + await base.Select_branch_optional_optional(async); + + AssertSql(); + } + + public override async Task Select_root_duplicated(bool async) + { + await base.Select_root_duplicated(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId` +FROM `RootEntities` AS `r` +"""); + } + + public override async Task Select_trunk_and_branch_duplicated(bool async) + { + await base.Select_trunk_and_branch_duplicated(async); + + AssertSql(); + } + + public override async Task Select_trunk_and_trunk_duplicated(bool async) + { + await base.Select_trunk_and_trunk_duplicated(async); + + AssertSql(); + } + + public override async Task Select_leaf_trunk_root(bool async) + { + await base.Select_leaf_trunk_root(async); + + AssertSql( + """ +SELECT `t`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `t`.`RequiredReferenceBranch_Name`, `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId` +FROM `RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id` +"""); + } + + public override async Task Select_subquery_root_set_required_trunk_FirstOrDefault_branch(bool async) + { + await base.Select_subquery_root_set_required_trunk_FirstOrDefault_branch(async); + + AssertSql(); + } + + public override async Task Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(bool async) + { + await base.Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(async); + + AssertSql(); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/NavigationNoTrackingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/NavigationNoTrackingProjectionJetTest.cs new file mode 100644 index 00000000..b97f754b --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/NavigationNoTrackingProjectionJetTest.cs @@ -0,0 +1,202 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + + +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +public class NavigationNoTrackingProjectionJetTest + : NavigationNoTrackingProjectionRelationalTestBase +{ + public NavigationNoTrackingProjectionJetTest(NavigationRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Select_everything_using_joins(bool async) + { + await base.Select_everything_using_joins(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId`, `l`.`Id`, `l`.`CollectionBranchId`, `l`.`Name` +FROM ((`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`Id` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`Id` = `b`.`Id`) +LEFT JOIN `LeafEntities` AS `l` ON `b`.`Id` = `l`.`Id` +WHERE `t`.`Id` IS NOT NULL AND `b`.`Id` IS NOT NULL AND `b`.`Id` IS NOT NULL AND `l`.`Id` IS NOT NULL +"""); + } + + public override async Task Select_trunk_collection(bool async) + { + await base.Select_trunk_collection(async); + AssertSql( + """ +SELECT `r`.`Id`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId` +FROM `RootEntities` AS `r` +LEFT JOIN `TrunkEntities` AS `t` ON `r`.`Id` = `t`.`CollectionRootId` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_branch_required_collection(bool async) + { + await base.Select_branch_required_collection(async); + + AssertSql( + """ +SELECT `r`.`Id`, `t`.`Id`, `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`Id` = `b`.`CollectionTrunkId` +ORDER BY `r`.`Id`, `t`.`Id` +"""); + } + + public override async Task Select_branch_optional_collection(bool async) + { + await base.Select_branch_optional_collection(async); + + AssertSql( + """ +SELECT `r`.`Id`, `t`.`Id`, `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`Id` = `b`.`CollectionTrunkId` +ORDER BY `r`.`Id`, `t`.`Id` +"""); + } + + public override async Task Select_multiple_branch_leaf(bool async) + { + await base.Select_multiple_branch_leaf(async); + + AssertSql( + """ +SELECT `r`.`Id`, `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId`, `l`.`Id`, `l`.`CollectionBranchId`, `l`.`Name`, `t`.`Id`, `l0`.`Id`, `l0`.`CollectionBranchId`, `l0`.`Name`, `b0`.`Id`, `b0`.`CollectionTrunkId`, `b0`.`Name`, `b0`.`OptionalReferenceLeafId`, `b0`.`RequiredReferenceLeafId` +FROM ((((`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`RequiredReferenceBranchId` = `b`.`Id`) +LEFT JOIN `LeafEntities` AS `l` ON `b`.`OptionalReferenceLeafId` = `l`.`Id`) +LEFT JOIN `LeafEntities` AS `l0` ON `b`.`Id` = `l0`.`CollectionBranchId`) +LEFT JOIN `BranchEntities` AS `b0` ON `t`.`Id` = `b0`.`CollectionTrunkId` +WHERE `t`.`RequiredReferenceBranchId` IS NOT NULL AND `b`.`Id` IS NOT NULL +ORDER BY `r`.`Id`, `t`.`Id`, `b`.`Id`, `l`.`Id`, `l0`.`Id` +"""); + } + + public override async Task Select_subquery_root_set_trunk_FirstOrDefault_collection(bool async) + { + await base.Select_subquery_root_set_trunk_FirstOrDefault_collection(async); + + AssertSql( + """ +SELECT [r].[Id], [s].[Id], [s].[Id0], [b].[Id], [b].[CollectionTrunkId], [b].[Name], [b].[OptionalReferenceLeafId], [b].[RequiredReferenceLeafId], [s].[c] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) 1 AS [c], [r0].[Id], [t].[Id] AS [Id0] + FROM [RootEntities] AS [r0] + INNER JOIN [TrunkEntities] AS [t] ON [r0].[RequiredReferenceTrunkId] = [t].[Id] + ORDER BY [r0].[Id] +) AS [s] +LEFT JOIN [BranchEntities] AS [b] ON [s].[Id0] = [b].[CollectionTrunkId] +ORDER BY [r].[Id], [s].[Id], [s].[Id0] +"""); + } + + public override async Task Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(bool async) + { + await base.Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(async); + + AssertSql( + """ +SELECT [r].[Id], [t].[Id], [b].[Id], [s].[Id1], [s].[Id], [s].[Id0], [b1].[Id], [b1].[CollectionTrunkId], [b1].[Name], [b1].[OptionalReferenceLeafId], [b1].[RequiredReferenceLeafId], [s].[CollectionRootId], [s].[Name], [s].[OptionalReferenceBranchId], [s].[RequiredReferenceBranchId], [s].[CollectionTrunkId], [s].[Name0], [s].[OptionalReferenceLeafId], [s].[RequiredReferenceLeafId], [s].[Name1], [s].[c] +FROM [RootEntities] AS [r] +INNER JOIN [TrunkEntities] AS [t] ON [r].[RequiredReferenceTrunkId] = [t].[Id] +INNER JOIN [BranchEntities] AS [b] ON [t].[RequiredReferenceBranchId] = [b].[Id] +OUTER APPLY ( + SELECT TOP(1) [t0].[Id], [t0].[CollectionRootId], [t0].[Name], [t0].[OptionalReferenceBranchId], [t0].[RequiredReferenceBranchId], [b0].[Id] AS [Id0], [b0].[CollectionTrunkId], [b0].[Name] AS [Name0], [b0].[OptionalReferenceLeafId], [b0].[RequiredReferenceLeafId], [b].[Name] AS [Name1], 1 AS [c], [r0].[Id] AS [Id1] + FROM [RootEntities] AS [r0] + INNER JOIN [TrunkEntities] AS [t0] ON [r0].[RequiredReferenceTrunkId] = [t0].[Id] + INNER JOIN [BranchEntities] AS [b0] ON [t0].[RequiredReferenceBranchId] = [b0].[Id] + ORDER BY [r0].[Id] +) AS [s] +LEFT JOIN [BranchEntities] AS [b1] ON [t].[Id] = [b1].[CollectionTrunkId] +ORDER BY [r].[Id], [t].[Id], [b].[Id], [s].[Id1], [s].[Id], [s].[Id0] +"""); + } + + public override async Task Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(bool async) + { + await base.Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(async); + + AssertSql( + """ +SELECT [r].[Id], [t].[Id], [r1].[Id], [b].[Id], [b].[CollectionTrunkId], [b].[Name], [b].[OptionalReferenceLeafId], [b].[RequiredReferenceLeafId], [r1].[c] +FROM [RootEntities] AS [r] +INNER JOIN [TrunkEntities] AS [t] ON [r].[RequiredReferenceTrunkId] = [t].[Id] +OUTER APPLY ( + SELECT TOP(1) 1 AS [c], [r0].[Id] + FROM [RootEntities] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +LEFT JOIN [BranchEntities] AS [b] ON [t].[Id] = [b].[CollectionTrunkId] +ORDER BY [r].[Id], [t].[Id], [r1].[Id] +"""); + } + + public override async Task SelectMany_trunk_collection(bool async) + { + await base.SelectMany_trunk_collection(async); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId` +FROM `RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`Id` = `t`.`CollectionRootId` +"""); + } + + public override async Task SelectMany_required_trunk_reference_branch_collection(bool async) + { + await base.SelectMany_required_trunk_reference_branch_collection(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`Id` = `b`.`CollectionTrunkId` +WHERE `t`.`Id` IS NOT NULL AND `b`.`CollectionTrunkId` IS NOT NULL +"""); + } + + public override async Task SelectMany_optional_trunk_reference_branch_collection(bool async) + { + await base.SelectMany_optional_trunk_reference_branch_collection(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +LEFT JOIN `TrunkEntities` AS `t` ON `r`.`OptionalReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`Id` = `b`.`CollectionTrunkId` +WHERE `t`.`Id` IS NOT NULL AND `b`.`CollectionTrunkId` IS NOT NULL +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/NavigationProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/NavigationProjectionJetTest.cs new file mode 100644 index 00000000..67ded051 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/NavigationProjectionJetTest.cs @@ -0,0 +1,202 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +public class NavigationProjectionJetTest + : NavigationProjectionRelationalTestBase +{ + public NavigationProjectionJetTest(NavigationRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Select_everything_using_joins(bool async) + { + await base.Select_everything_using_joins(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId`, `l`.`Id`, `l`.`CollectionBranchId`, `l`.`Name` +FROM ((`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`Id` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`Id` = `b`.`Id`) +LEFT JOIN `LeafEntities` AS `l` ON `b`.`Id` = `l`.`Id` +WHERE `t`.`Id` IS NOT NULL AND `b`.`Id` IS NOT NULL AND `b`.`Id` IS NOT NULL AND `l`.`Id` IS NOT NULL +"""); + } + + public override async Task Select_trunk_collection(bool async) + { + await base.Select_trunk_collection(async); + + AssertSql( + """ +SELECT `r`.`Id`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId` +FROM `RootEntities` AS `r` +LEFT JOIN `TrunkEntities` AS `t` ON `r`.`Id` = `t`.`CollectionRootId` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_branch_required_collection(bool async) + { + await base.Select_branch_required_collection(async); + + AssertSql( + """ +SELECT `r`.`Id`, `t`.`Id`, `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`Id` = `b`.`CollectionTrunkId` +ORDER BY `r`.`Id`, `t`.`Id` +"""); + } + + public override async Task Select_branch_optional_collection(bool async) + { + await base.Select_branch_optional_collection(async); + + AssertSql( + """ +SELECT `r`.`Id`, `t`.`Id`, `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`Id` = `b`.`CollectionTrunkId` +ORDER BY `r`.`Id`, `t`.`Id` +"""); + } + + public override async Task Select_multiple_branch_leaf(bool async) + { + await base.Select_multiple_branch_leaf(async); + + AssertSql( + """ +SELECT `r`.`Id`, `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId`, `l`.`Id`, `l`.`CollectionBranchId`, `l`.`Name`, `t`.`Id`, `l0`.`Id`, `l0`.`CollectionBranchId`, `l0`.`Name`, `b0`.`Id`, `b0`.`CollectionTrunkId`, `b0`.`Name`, `b0`.`OptionalReferenceLeafId`, `b0`.`RequiredReferenceLeafId` +FROM ((((`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`RequiredReferenceBranchId` = `b`.`Id`) +LEFT JOIN `LeafEntities` AS `l` ON `b`.`OptionalReferenceLeafId` = `l`.`Id`) +LEFT JOIN `LeafEntities` AS `l0` ON `b`.`Id` = `l0`.`CollectionBranchId`) +LEFT JOIN `BranchEntities` AS `b0` ON `t`.`Id` = `b0`.`CollectionTrunkId` +WHERE `t`.`RequiredReferenceBranchId` IS NOT NULL AND `b`.`Id` IS NOT NULL +ORDER BY `r`.`Id`, `t`.`Id`, `b`.`Id`, `l`.`Id`, `l0`.`Id` +"""); + } + + public override async Task Select_subquery_root_set_trunk_FirstOrDefault_collection(bool async) + { + await base.Select_subquery_root_set_trunk_FirstOrDefault_collection(async); + + AssertSql( + """ +SELECT [r].[Id], [s].[Id], [s].[Id0], [b].[Id], [b].[CollectionTrunkId], [b].[Name], [b].[OptionalReferenceLeafId], [b].[RequiredReferenceLeafId], [s].[c] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) 1 AS [c], [r0].[Id], [t].[Id] AS [Id0] + FROM [RootEntities] AS [r0] + INNER JOIN [TrunkEntities] AS [t] ON [r0].[RequiredReferenceTrunkId] = [t].[Id] + ORDER BY [r0].[Id] +) AS [s] +LEFT JOIN [BranchEntities] AS [b] ON [s].[Id0] = [b].[CollectionTrunkId] +ORDER BY [r].[Id], [s].[Id], [s].[Id0] +"""); + } + + public override async Task Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(bool async) + { + await base.Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(async); + + AssertSql( + """ +SELECT [r].[Id], [t].[Id], [b].[Id], [s].[Id1], [s].[Id], [s].[Id0], [b1].[Id], [b1].[CollectionTrunkId], [b1].[Name], [b1].[OptionalReferenceLeafId], [b1].[RequiredReferenceLeafId], [s].[CollectionRootId], [s].[Name], [s].[OptionalReferenceBranchId], [s].[RequiredReferenceBranchId], [s].[CollectionTrunkId], [s].[Name0], [s].[OptionalReferenceLeafId], [s].[RequiredReferenceLeafId], [s].[Name1], [s].[c] +FROM [RootEntities] AS [r] +INNER JOIN [TrunkEntities] AS [t] ON [r].[RequiredReferenceTrunkId] = [t].[Id] +INNER JOIN [BranchEntities] AS [b] ON [t].[RequiredReferenceBranchId] = [b].[Id] +OUTER APPLY ( + SELECT TOP(1) [t0].[Id], [t0].[CollectionRootId], [t0].[Name], [t0].[OptionalReferenceBranchId], [t0].[RequiredReferenceBranchId], [b0].[Id] AS [Id0], [b0].[CollectionTrunkId], [b0].[Name] AS [Name0], [b0].[OptionalReferenceLeafId], [b0].[RequiredReferenceLeafId], [b].[Name] AS [Name1], 1 AS [c], [r0].[Id] AS [Id1] + FROM [RootEntities] AS [r0] + INNER JOIN [TrunkEntities] AS [t0] ON [r0].[RequiredReferenceTrunkId] = [t0].[Id] + INNER JOIN [BranchEntities] AS [b0] ON [t0].[RequiredReferenceBranchId] = [b0].[Id] + ORDER BY [r0].[Id] +) AS [s] +LEFT JOIN [BranchEntities] AS [b1] ON [t].[Id] = [b1].[CollectionTrunkId] +ORDER BY [r].[Id], [t].[Id], [b].[Id], [s].[Id1], [s].[Id], [s].[Id0] +"""); + } + + public override async Task Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(bool async) + { + await base.Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(async); + + AssertSql( + """ +SELECT [r].[Id], [t].[Id], [r1].[Id], [b].[Id], [b].[CollectionTrunkId], [b].[Name], [b].[OptionalReferenceLeafId], [b].[RequiredReferenceLeafId], [r1].[c] +FROM [RootEntities] AS [r] +INNER JOIN [TrunkEntities] AS [t] ON [r].[RequiredReferenceTrunkId] = [t].[Id] +OUTER APPLY ( + SELECT TOP(1) 1 AS [c], [r0].[Id] + FROM [RootEntities] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +LEFT JOIN [BranchEntities] AS [b] ON [t].[Id] = [b].[CollectionTrunkId] +ORDER BY [r].[Id], [t].[Id], [r1].[Id] +"""); + } + + public override async Task SelectMany_trunk_collection(bool async) + { + await base.SelectMany_trunk_collection(async); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId` +FROM `RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`Id` = `t`.`CollectionRootId` +"""); + } + + public override async Task SelectMany_required_trunk_reference_branch_collection(bool async) + { + await base.SelectMany_required_trunk_reference_branch_collection(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`Id` = `b`.`CollectionTrunkId` +WHERE `t`.`Id` IS NOT NULL AND `b`.`CollectionTrunkId` IS NOT NULL +"""); + } + + public override async Task SelectMany_optional_trunk_reference_branch_collection(bool async) + { + await base.SelectMany_optional_trunk_reference_branch_collection(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +LEFT JOIN `TrunkEntities` AS `t` ON `r`.`OptionalReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`Id` = `b`.`CollectionTrunkId` +WHERE `t`.`Id` IS NOT NULL AND `b`.`CollectionTrunkId` IS NOT NULL +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/NavigationReferenceNoTrackingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/NavigationReferenceNoTrackingProjectionJetTest.cs new file mode 100644 index 00000000..73ab8954 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/NavigationReferenceNoTrackingProjectionJetTest.cs @@ -0,0 +1,231 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +public class NavigationReferenceNoTrackingProjectionJetTest + : NavigationReferenceNoTrackingProjectionRelationalTestBase +{ + public NavigationReferenceNoTrackingProjectionJetTest(NavigationRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Select_everything(bool async) + { + await base.Select_everything(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId`, `l`.`Id`, `l`.`CollectionBranchId`, `l`.`Name` +FROM ((`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`Id` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`Id` = `b`.`Id`) +LEFT JOIN `LeafEntities` AS `l` ON `b`.`Id` = `l`.`Id` +WHERE `t`.`Id` IS NOT NULL AND `b`.`Id` IS NOT NULL AND `b`.`Id` IS NOT NULL AND `l`.`Id` IS NOT NULL +"""); + } + + public override async Task Select_root(bool async) + { + await base.Select_root(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId` +FROM `RootEntities` AS `r` +"""); + } + + public override async Task Select_trunk_optional(bool async) + { + await base.Select_trunk_optional(async); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId` +FROM `RootEntities` AS `r` +LEFT JOIN `TrunkEntities` AS `t` ON `r`.`OptionalReferenceTrunkId` = `t`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_trunk_required(bool async) + { + await base.Select_trunk_required(async); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId` +FROM `RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_branch_required_required(bool async) + { + await base.Select_branch_required_required(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`RequiredReferenceBranchId` = `b`.`Id` +WHERE `t`.`RequiredReferenceBranchId` IS NOT NULL AND `b`.`Id` IS NOT NULL +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_branch_required_optional(bool async) + { + await base.Select_branch_required_optional(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`OptionalReferenceBranchId` = `b`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_branch_optional_required(bool async) + { + await base.Select_branch_optional_required(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`RequiredReferenceBranchId` = `b`.`Id` +WHERE `t`.`RequiredReferenceBranchId` IS NOT NULL AND `b`.`Id` IS NOT NULL +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_branch_optional_optional(bool async) + { + await base.Select_branch_optional_optional(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`OptionalReferenceBranchId` = `b`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_root_duplicated(bool async) + { + await base.Select_root_duplicated(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId` +FROM `RootEntities` AS `r` +"""); + } + + public override async Task Select_trunk_and_branch_duplicated(bool async) + { + await base.Select_trunk_and_branch_duplicated(async); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +LEFT JOIN `TrunkEntities` AS `t` ON `r`.`OptionalReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`RequiredReferenceBranchId` = `b`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_trunk_and_trunk_duplicated(bool async) + { + await base.Select_trunk_and_trunk_duplicated(async); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `l`.`Id`, `l`.`CollectionBranchId`, `l`.`Name` +FROM ((`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`OptionalReferenceBranchId` = `b`.`Id`) +LEFT JOIN `LeafEntities` AS `l` ON `b`.`RequiredReferenceLeafId` = `l`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_leaf_trunk_root(bool async) + { + await base.Select_leaf_trunk_root(async); + + AssertSql( + """ +SELECT `l`.`Id`, `l`.`CollectionBranchId`, `l`.`Name`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId` +FROM ((`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`RequiredReferenceBranchId` = `b`.`Id`) +LEFT JOIN `LeafEntities` AS `l` ON `b`.`RequiredReferenceLeafId` = `l`.`Id` +WHERE `t`.`RequiredReferenceBranchId` IS NOT NULL AND `b`.`Id` IS NOT NULL AND `b`.`RequiredReferenceLeafId` IS NOT NULL AND `l`.`Id` IS NOT NULL +"""); + } + + public override async Task Select_subquery_root_set_required_trunk_FirstOrDefault_branch(bool async) + { + await base.Select_subquery_root_set_required_trunk_FirstOrDefault_branch(async); + + AssertSql( + """ +SELECT [s].[Id], [s].[CollectionTrunkId], [s].[Name], [s].[OptionalReferenceLeafId], [s].[RequiredReferenceLeafId] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) [b].[Id], [b].[CollectionTrunkId], [b].[Name], [b].[OptionalReferenceLeafId], [b].[RequiredReferenceLeafId] + FROM [RootEntities] AS [r0] + INNER JOIN [TrunkEntities] AS [t] ON [r0].[RequiredReferenceTrunkId] = [t].[Id] + INNER JOIN [BranchEntities] AS [b] ON [t].[RequiredReferenceBranchId] = [b].[Id] + ORDER BY [r0].[Id] +) AS [s] +ORDER BY [r].[Id] +"""); + } + + public override async Task Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(bool async) + { + await base.Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(async); + + AssertSql( + """ +SELECT [s].[Id], [s].[CollectionTrunkId], [s].[Name], [s].[OptionalReferenceLeafId], [s].[RequiredReferenceLeafId] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) [b].[Id], [b].[CollectionTrunkId], [b].[Name], [b].[OptionalReferenceLeafId], [b].[RequiredReferenceLeafId] + FROM [RootEntities] AS [r0] + LEFT JOIN [TrunkEntities] AS [t] ON [r0].[OptionalReferenceTrunkId] = [t].[Id] + LEFT JOIN [BranchEntities] AS [b] ON [t].[OptionalReferenceBranchId] = [b].[Id] + ORDER BY [r0].[Id] +) AS [s] +ORDER BY [r].[Id] +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/NavigationReferenceProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/NavigationReferenceProjectionJetTest.cs new file mode 100644 index 00000000..db2d6804 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/NavigationReferenceProjectionJetTest.cs @@ -0,0 +1,231 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +public class NavigationReferenceProjectionJetTest + : NavigationReferenceProjectionRelationalTestBase +{ + public NavigationReferenceProjectionJetTest(NavigationRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Select_everything(bool async) + { + await base.Select_everything(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId`, `l`.`Id`, `l`.`CollectionBranchId`, `l`.`Name` +FROM ((`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`Id` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`Id` = `b`.`Id`) +LEFT JOIN `LeafEntities` AS `l` ON `b`.`Id` = `l`.`Id` +WHERE `t`.`Id` IS NOT NULL AND `b`.`Id` IS NOT NULL AND `b`.`Id` IS NOT NULL AND `l`.`Id` IS NOT NULL +"""); + } + + public override async Task Select_root(bool async) + { + await base.Select_root(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId` +FROM `RootEntities` AS `r` +"""); + } + + public override async Task Select_trunk_optional(bool async) + { + await base.Select_trunk_optional(async); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId` +FROM `RootEntities` AS `r` +LEFT JOIN `TrunkEntities` AS `t` ON `r`.`OptionalReferenceTrunkId` = `t`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_trunk_required(bool async) + { + await base.Select_trunk_required(async); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId` +FROM `RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_branch_required_required(bool async) + { + await base.Select_branch_required_required(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`RequiredReferenceBranchId` = `b`.`Id` +WHERE `t`.`RequiredReferenceBranchId` IS NOT NULL AND `b`.`Id` IS NOT NULL +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_branch_required_optional(bool async) + { + await base.Select_branch_required_optional(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`OptionalReferenceBranchId` = `b`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_branch_optional_required(bool async) + { + await base.Select_branch_optional_required(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`RequiredReferenceBranchId` = `b`.`Id` +WHERE `t`.`RequiredReferenceBranchId` IS NOT NULL AND `b`.`Id` IS NOT NULL +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_branch_optional_optional(bool async) + { + await base.Select_branch_optional_optional(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`OptionalReferenceBranchId` = `b`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_root_duplicated(bool async) + { + await base.Select_root_duplicated(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId` +FROM `RootEntities` AS `r` +"""); + } + + public override async Task Select_trunk_and_branch_duplicated(bool async) + { + await base.Select_trunk_and_branch_duplicated(async); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `b`.`Id`, `b`.`CollectionTrunkId`, `b`.`Name`, `b`.`OptionalReferenceLeafId`, `b`.`RequiredReferenceLeafId` +FROM (`RootEntities` AS `r` +LEFT JOIN `TrunkEntities` AS `t` ON `r`.`OptionalReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`RequiredReferenceBranchId` = `b`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_trunk_and_trunk_duplicated(bool async) + { + await base.Select_trunk_and_trunk_duplicated(async); + + AssertSql( + """ +SELECT `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `l`.`Id`, `l`.`CollectionBranchId`, `l`.`Name` +FROM ((`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`OptionalReferenceBranchId` = `b`.`Id`) +LEFT JOIN `LeafEntities` AS `l` ON `b`.`RequiredReferenceLeafId` = `l`.`Id` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_leaf_trunk_root(bool async) + { + await base.Select_leaf_trunk_root(async); + + AssertSql( + """ +SELECT `l`.`Id`, `l`.`CollectionBranchId`, `l`.`Name`, `t`.`Id`, `t`.`CollectionRootId`, `t`.`Name`, `t`.`OptionalReferenceBranchId`, `t`.`RequiredReferenceBranchId`, `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId` +FROM ((`RootEntities` AS `r` +INNER JOIN `TrunkEntities` AS `t` ON `r`.`RequiredReferenceTrunkId` = `t`.`Id`) +LEFT JOIN `BranchEntities` AS `b` ON `t`.`RequiredReferenceBranchId` = `b`.`Id`) +LEFT JOIN `LeafEntities` AS `l` ON `b`.`RequiredReferenceLeafId` = `l`.`Id` +WHERE `t`.`RequiredReferenceBranchId` IS NOT NULL AND `b`.`Id` IS NOT NULL AND `b`.`RequiredReferenceLeafId` IS NOT NULL AND `l`.`Id` IS NOT NULL +"""); + } + + public override async Task Select_subquery_root_set_required_trunk_FirstOrDefault_branch(bool async) + { + await base.Select_subquery_root_set_required_trunk_FirstOrDefault_branch(async); + + AssertSql( + """ +SELECT [s].[Id], [s].[CollectionTrunkId], [s].[Name], [s].[OptionalReferenceLeafId], [s].[RequiredReferenceLeafId] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) [b].[Id], [b].[CollectionTrunkId], [b].[Name], [b].[OptionalReferenceLeafId], [b].[RequiredReferenceLeafId] + FROM [RootEntities] AS [r0] + INNER JOIN [TrunkEntities] AS [t] ON [r0].[RequiredReferenceTrunkId] = [t].[Id] + INNER JOIN [BranchEntities] AS [b] ON [t].[RequiredReferenceBranchId] = [b].[Id] + ORDER BY [r0].[Id] +) AS [s] +ORDER BY [r].[Id] +"""); + } + + public override async Task Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(bool async) + { + await base.Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(async); + + AssertSql( + """ +SELECT [s].[Id], [s].[CollectionTrunkId], [s].[Name], [s].[OptionalReferenceLeafId], [s].[RequiredReferenceLeafId] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) [b].[Id], [b].[CollectionTrunkId], [b].[Name], [b].[OptionalReferenceLeafId], [b].[RequiredReferenceLeafId] + FROM [RootEntities] AS [r0] + LEFT JOIN [TrunkEntities] AS [t] ON [r0].[OptionalReferenceTrunkId] = [t].[Id] + LEFT JOIN [BranchEntities] AS [b] ON [t].[OptionalReferenceBranchId] = [b].[Id] + ORDER BY [r0].[Id] +) AS [s] +ORDER BY [r].[Id] +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonNoTrackingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonNoTrackingProjectionJetTest.cs new file mode 100644 index 00000000..cc637ed3 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonNoTrackingProjectionJetTest.cs @@ -0,0 +1,189 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +public class OwnedJsonNoTrackingProjectionJetTest + : OwnedJsonNoTrackingProjectionRelationalTestBase +{ + public OwnedJsonNoTrackingProjectionJetTest(OwnedJsonRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Select_trunk_collection(bool async) + { + await base.Select_trunk_collection(async); + + AssertSql( + """ +SELECT `r`.`CollectionTrunk`, `r`.`Id` +FROM `RootEntities` AS `r` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_branch_required_collection(bool async) + { + await base.Select_branch_required_collection(async); + + AssertSql( + """ +SELECT JSON_QUERY([r].[RequiredReferenceTrunk], '$.CollectionBranch'), [r].[Id] +FROM [RootEntities] AS [r] +ORDER BY [r].[Id] +"""); + } + + public override async Task Select_branch_optional_collection(bool async) + { + await base.Select_branch_optional_collection(async); + + AssertSql( + """ +SELECT JSON_QUERY([r].[RequiredReferenceTrunk], '$.CollectionBranch'), [r].[Id] +FROM [RootEntities] AS [r] +ORDER BY [r].[Id] +"""); + } + + public override async Task Select_multiple_branch_leaf(bool async) + { + await base.Select_multiple_branch_leaf(async); + + AssertSql( + """ +SELECT [r].[Id], JSON_QUERY([r].[RequiredReferenceTrunk], '$.RequiredReferenceBranch'), JSON_QUERY([r].[RequiredReferenceTrunk], '$.RequiredReferenceBranch.OptionalReferenceLeaf'), JSON_QUERY([r].[RequiredReferenceTrunk], '$.RequiredReferenceBranch.CollectionLeaf'), JSON_QUERY([r].[RequiredReferenceTrunk], '$.CollectionBranch'), JSON_VALUE([r].[RequiredReferenceTrunk], '$.RequiredReferenceBranch.OptionalReferenceLeaf.Name') +FROM [RootEntities] AS [r] +"""); + } + + public override async Task Select_subquery_root_set_trunk_FirstOrDefault_collection(bool async) + { + await base.Select_subquery_root_set_trunk_FirstOrDefault_collection(async); + + AssertSql( + """ +SELECT [r1].[c], [r1].[Id], [r1].[c0] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) JSON_QUERY([r0].[RequiredReferenceTrunk], '$.CollectionBranch') AS [c], [r0].[Id], 1 AS [c0] + FROM [RootEntities] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +ORDER BY [r].[Id] +"""); + } + + public override async Task Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(bool async) + { + await base.Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(async); + + AssertSql( + """ +SELECT [r1].[c], [r1].[Id], [r1].[c0], [r1].[Id0], [r1].[c1], [r1].[c2], [r1].[c3], [r1].[c4] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) JSON_QUERY([r].[RequiredReferenceTrunk], '$.CollectionBranch') AS [c], [r].[Id], [r0].[RequiredReferenceTrunk] AS [c0], [r0].[Id] AS [Id0], JSON_QUERY([r0].[RequiredReferenceTrunk], '$.RequiredReferenceBranch') AS [c1], JSON_VALUE([r0].[RequiredReferenceTrunk], '$.Name') AS [c2], JSON_VALUE([r].[RequiredReferenceTrunk], '$.RequiredReferenceBranch.Name') AS [c3], 1 AS [c4] + FROM [RootEntities] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +ORDER BY [r].[Id] +"""); + } + + public override async Task Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(bool async) + { + await base.Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(async); + + AssertSql( + """ +SELECT [r1].[c], [r1].[Id], [r1].[c0] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) JSON_QUERY([r].[RequiredReferenceTrunk], '$.CollectionBranch') AS [c], [r].[Id], 1 AS [c0] + FROM [RootEntities] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +ORDER BY [r].[Id] +"""); + } + + public override async Task SelectMany_trunk_collection(bool async) + { + await base.SelectMany_trunk_collection(async); + + AssertSql( + """ +SELECT [r].[Id], [c].[Name], [c].[CollectionBranch], [c].[OptionalReferenceBranch], [c].[RequiredReferenceBranch] +FROM [RootEntities] AS [r] +CROSS APPLY OPENJSON([r].[CollectionTrunk], '$') WITH ( + [Name] nvarchar(max) '$.Name', + [CollectionBranch] nvarchar(max) '$.CollectionBranch' AS JSON, + [OptionalReferenceBranch] nvarchar(max) '$.OptionalReferenceBranch' AS JSON, + [RequiredReferenceBranch] nvarchar(max) '$.RequiredReferenceBranch' AS JSON +) AS [c] +"""); + } + + public override async Task SelectMany_required_trunk_reference_branch_collection(bool async) + { + await base.SelectMany_required_trunk_reference_branch_collection(async); + + AssertSql( + """ +SELECT [r].[Id], [c].[Name], [c].[CollectionLeaf], [c].[OptionalReferenceLeaf], [c].[RequiredReferenceLeaf] +FROM [RootEntities] AS [r] +CROSS APPLY OPENJSON([r].[RequiredReferenceTrunk], '$.CollectionBranch') WITH ( + [Name] nvarchar(max) '$.Name', + [CollectionLeaf] nvarchar(max) '$.CollectionLeaf' AS JSON, + [OptionalReferenceLeaf] nvarchar(max) '$.OptionalReferenceLeaf' AS JSON, + [RequiredReferenceLeaf] nvarchar(max) '$.RequiredReferenceLeaf' AS JSON +) AS [c] +"""); + } + + public override async Task SelectMany_optional_trunk_reference_branch_collection(bool async) + { + await base.SelectMany_optional_trunk_reference_branch_collection(async); + + AssertSql( + """ +SELECT [r].[Id], [c].[Name], [c].[CollectionLeaf], [c].[OptionalReferenceLeaf], [c].[RequiredReferenceLeaf] +FROM [RootEntities] AS [r] +CROSS APPLY OPENJSON([r].[OptionalReferenceTrunk], '$.CollectionBranch') WITH ( + [Name] nvarchar(max) '$.Name', + [CollectionLeaf] nvarchar(max) '$.CollectionLeaf' AS JSON, + [OptionalReferenceLeaf] nvarchar(max) '$.OptionalReferenceLeaf' AS JSON, + [RequiredReferenceLeaf] nvarchar(max) '$.RequiredReferenceLeaf' AS JSON +) AS [c] +"""); + } + + public override async Task Project_branch_collection_element_using_indexer_constant(bool async) + { + await base.Project_branch_collection_element_using_indexer_constant(async); + + AssertSql( + """ +SELECT JSON_QUERY([r].[RequiredReferenceTrunk], '$.CollectionBranch'), [r].[Id] +FROM [RootEntities] AS [r] +ORDER BY [r].[Id] +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonProjectionJetTest.cs new file mode 100644 index 00000000..9dd8ecd4 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonProjectionJetTest.cs @@ -0,0 +1,71 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Diagnostics; +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +public class OwnedJsonProjectionJetTest + : OwnedJsonProjectionRelationalTestBase +{ + public OwnedJsonProjectionJetTest(OwnedJsonRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override Task Select_trunk_collection(bool async) + => AssertCantTrackJson(() => base.Select_trunk_collection(async)); + + public override Task Select_branch_required_collection(bool async) + => AssertCantTrackJson(() => base.Select_branch_required_collection(async)); + + public override Task Select_branch_optional_collection(bool async) + => AssertCantTrackJson(() => base.Select_branch_optional_collection(async)); + + public override Task Project_branch_collection_element_using_indexer_constant(bool async) + => AssertCantTrackJson(() => base.Project_branch_collection_element_using_indexer_constant(async)); + + public override Task Select_multiple_branch_leaf(bool async) + => AssertCantTrackJson(() => base.Select_multiple_branch_leaf(async)); + + public override Task Select_subquery_root_set_trunk_FirstOrDefault_collection(bool async) + => AssertCantTrackJson(() => base.Select_subquery_root_set_trunk_FirstOrDefault_collection(async)); + + public override Task Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(bool async) + => AssertCantTrackJson(() => base.Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(async)); + + public override Task Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(bool async) + => AssertCantTrackJson(() => base.Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(async)); + + public override Task SelectMany_trunk_collection(bool async) + => AssertCantTrackJson(() => base.SelectMany_trunk_collection(async)); + + public override Task SelectMany_required_trunk_reference_branch_collection(bool async) + => AssertCantTrackJson(() => base.SelectMany_required_trunk_reference_branch_collection(async)); + + public override Task SelectMany_optional_trunk_reference_branch_collection(bool async) + => AssertCantTrackJson(() => base.SelectMany_optional_trunk_reference_branch_collection(async)); + + private async Task AssertCantTrackJson(Func test) + { + var message = (await Assert.ThrowsAsync(test)).Message; + + Assert.Equal(RelationalStrings.JsonEntityOrCollectionProjectedAtRootLevelInTrackingQuery("AsNoTracking"), message); + AssertSql(); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonReferenceNoTrackingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonReferenceNoTrackingProjectionJetTest.cs new file mode 100644 index 00000000..45c8602f --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonReferenceNoTrackingProjectionJetTest.cs @@ -0,0 +1,191 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +public class OwnedJsonReferenceNoTrackingProjectionJetTest + : OwnedJsonReferenceNoTrackingProjectionRelationalTestBase +{ + public OwnedJsonReferenceNoTrackingProjectionJetTest(OwnedJsonRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Select_root(bool async) + { + await base.Select_root(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `r`.`CollectionTrunk`, `r`.`OptionalReferenceTrunk`, `r`.`RequiredReferenceTrunk` +FROM `RootEntities` AS `r` +"""); + } + + public override async Task Select_trunk_optional(bool async) + { + await base.Select_trunk_optional(async); + + AssertSql( + """ +SELECT `r`.`OptionalReferenceTrunk`, `r`.`Id` +FROM `RootEntities` AS `r` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_trunk_required(bool async) + { + await base.Select_trunk_required(async); + + AssertSql( + """ +SELECT `r`.`RequiredReferenceTrunk`, `r`.`Id` +FROM `RootEntities` AS `r` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_branch_required_required(bool async) + { + await base.Select_branch_required_required(async); + + AssertSql( + """ +SELECT JSON_QUERY([r].[RequiredReferenceTrunk], '$.RequiredReferenceBranch'), [r].[Id] +FROM [RootEntities] AS [r] +ORDER BY [r].[Id] +"""); + } + + public override async Task Select_branch_required_optional(bool async) + { + await base.Select_branch_required_optional(async); + + AssertSql( + """ +SELECT JSON_QUERY([r].[RequiredReferenceTrunk], '$.OptionalReferenceBranch'), [r].[Id] +FROM [RootEntities] AS [r] +ORDER BY [r].[Id] +"""); + } + + public override async Task Select_branch_optional_required(bool async) + { + await base.Select_branch_optional_required(async); + + AssertSql( + """ +SELECT JSON_QUERY([r].[RequiredReferenceTrunk], '$.RequiredReferenceBranch'), [r].[Id] +FROM [RootEntities] AS [r] +ORDER BY [r].[Id] +"""); + } + + public override async Task Select_branch_optional_optional(bool async) + { + await base.Select_branch_optional_optional(async); + + AssertSql( + """ +SELECT JSON_QUERY([r].[RequiredReferenceTrunk], '$.OptionalReferenceBranch'), [r].[Id] +FROM [RootEntities] AS [r] +ORDER BY [r].[Id] +"""); + } + + public override async Task Select_root_duplicated(bool async) + { + await base.Select_root_duplicated(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `r`.`CollectionTrunk`, `r`.`OptionalReferenceTrunk`, `r`.`RequiredReferenceTrunk`, `r`.`CollectionTrunk`, `r`.`OptionalReferenceTrunk`, `r`.`RequiredReferenceTrunk` +FROM `RootEntities` AS `r` +"""); + } + + public override async Task Select_trunk_and_branch_duplicated(bool async) + { + await base.Select_trunk_and_branch_duplicated(async); + + AssertSql( + """ +SELECT [r].[OptionalReferenceTrunk], [r].[Id], JSON_QUERY([r].[OptionalReferenceTrunk], '$.RequiredReferenceBranch'), [r].[OptionalReferenceTrunk], JSON_QUERY([r].[OptionalReferenceTrunk], '$.RequiredReferenceBranch') +FROM [RootEntities] AS [r] +ORDER BY [r].[Id] +"""); + } + + public override async Task Select_trunk_and_trunk_duplicated(bool async) + { + await base.Select_trunk_and_trunk_duplicated(async); + + AssertSql( + """ +SELECT [r].[RequiredReferenceTrunk], [r].[Id], JSON_QUERY([r].[RequiredReferenceTrunk], '$.OptionalReferenceBranch.RequiredReferenceLeaf'), [r].[RequiredReferenceTrunk], JSON_QUERY([r].[RequiredReferenceTrunk], '$.OptionalReferenceBranch.RequiredReferenceLeaf') +FROM [RootEntities] AS [r] +ORDER BY [r].[Id] +"""); + } + + public override async Task Select_leaf_trunk_root(bool async) + { + await base.Select_leaf_trunk_root(async); + + AssertSql( + """ +SELECT JSON_QUERY([r].[RequiredReferenceTrunk], '$.RequiredReferenceBranch.RequiredReferenceLeaf'), [r].[Id], [r].[RequiredReferenceTrunk], [r].[Name], [r].[OptionalReferenceTrunkId], [r].[RequiredReferenceTrunkId], [r].[CollectionTrunk], [r].[OptionalReferenceTrunk], [r].[RequiredReferenceTrunk] +FROM [RootEntities] AS [r] +"""); + } + + public override async Task Select_subquery_root_set_required_trunk_FirstOrDefault_branch(bool async) + { + await base.Select_subquery_root_set_required_trunk_FirstOrDefault_branch(async); + + AssertSql( + """ +SELECT [r1].[c], [r1].[Id] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) JSON_QUERY([r0].[RequiredReferenceTrunk], '$.RequiredReferenceBranch') AS [c], [r0].[Id] + FROM [RootEntities] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +ORDER BY [r].[Id] +"""); + } + + public override async Task Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(bool async) + { + await base.Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(async); + + AssertSql( + """ +SELECT [r1].[c], [r1].[Id] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) JSON_QUERY([r0].[OptionalReferenceTrunk], '$.OptionalReferenceBranch') AS [c], [r0].[Id] + FROM [RootEntities] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +ORDER BY [r].[Id] +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonReferenceProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonReferenceProjectionJetTest.cs new file mode 100644 index 00000000..08962c27 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonReferenceProjectionJetTest.cs @@ -0,0 +1,93 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Diagnostics; +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +public class OwnedJsonReferenceProjectionJetTest + : OwnedJsonReferenceProjectionRelationalTestBase +{ + public OwnedJsonReferenceProjectionJetTest(OwnedJsonRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Select_root(bool async) + { + await base.Select_root(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `r`.`CollectionTrunk`, `r`.`OptionalReferenceTrunk`, `r`.`RequiredReferenceTrunk` +FROM `RootEntities` AS `r` +"""); + } + + public override async Task Select_root_duplicated(bool async) + { + await base.Select_root_duplicated(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `r`.`CollectionTrunk`, `r`.`OptionalReferenceTrunk`, `r`.`RequiredReferenceTrunk`, `r`.`CollectionTrunk`, `r`.`OptionalReferenceTrunk`, `r`.`RequiredReferenceTrunk` +FROM `RootEntities` AS `r` +"""); + } + + public override Task Select_trunk_optional(bool async) + => AssertCantTrackJson(() => base.Select_trunk_optional(async)); + + public override Task Select_trunk_required(bool async) + => AssertCantTrackJson(() => base.Select_trunk_required(async)); + + public override Task Select_branch_required_required(bool async) + => AssertCantTrackJson(() => base.Select_branch_required_required(async)); + + public override Task Select_branch_required_optional(bool async) + => AssertCantTrackJson(() => base.Select_branch_required_optional(async)); + + public override Task Select_branch_optional_required(bool async) + => AssertCantTrackJson(() => base.Select_branch_optional_required(async)); + + public override Task Select_branch_optional_optional(bool async) + => AssertCantTrackJson(() => base.Select_branch_optional_optional(async)); + + public override Task Select_trunk_and_branch_duplicated(bool async) + => AssertCantTrackJson(() => base.Select_trunk_and_branch_duplicated(async)); + + public override Task Select_trunk_and_trunk_duplicated(bool async) + => AssertCantTrackJson(() => base.Select_trunk_and_trunk_duplicated(async)); + + public override Task Select_leaf_trunk_root(bool async) + => AssertCantTrackJson(() => base.Select_leaf_trunk_root(async)); + + public override Task Select_subquery_root_set_required_trunk_FirstOrDefault_branch(bool async) + => AssertCantTrackJson(() => base.Select_subquery_root_set_required_trunk_FirstOrDefault_branch(async)); + + public override Task Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(bool async) + => AssertCantTrackJson(() => base.Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(async)); + + private async Task AssertCantTrackJson(Func test) + { + var message = (await Assert.ThrowsAsync(test)).Message; + + Assert.Equal(RelationalStrings.JsonEntityOrCollectionProjectedAtRootLevelInTrackingQuery("AsNoTracking"), message); + AssertSql(); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonTypeNoTrackingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonTypeNoTrackingProjectionJetTest.cs new file mode 100644 index 00000000..aeed60e2 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonTypeNoTrackingProjectionJetTest.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +// Only adding NoTracking version - no point to do both and most of the tests don't work in tracking (projecting without owner) +public class OwnedJsonTypeNoTrackingProjectionJetTest + : ProjectionTestBase +{ + public OwnedJsonTypeNoTrackingProjectionJetTest(OwnedJsonTypeRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonTypeReferenceNoTrackingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonTypeReferenceNoTrackingProjectionJetTest.cs new file mode 100644 index 00000000..32c32515 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedJsonTypeReferenceNoTrackingProjectionJetTest.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +// Only adding NoTracking version - no point to do both and most of the tests don't work in tracking (projecting without owner) +public class OwnedJsonTypeReferenceNoTrackingProjectionJetTest + : ReferenceProjectionTestBase +{ + public OwnedJsonTypeReferenceNoTrackingProjectionJetTest(OwnedJsonTypeRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedNoTrackingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedNoTrackingProjectionJetTest.cs new file mode 100644 index 00000000..021bcf6f --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedNoTrackingProjectionJetTest.cs @@ -0,0 +1,229 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +public class OwnedNoTrackingProjectionJetTest + : OwnedNoTrackingProjectionRelationalTestBase +{ + public OwnedNoTrackingProjectionJetTest(OwnedRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Select_trunk_collection(bool async) + { + await base.Select_trunk_collection(async); + + AssertSql( + """ +SELECT `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`Name1`, `s0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s0`.`Name2`, `s0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` +FROM `RootEntities` AS `r` +LEFT JOIN ( + SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r3`.`Id1` AS `Id11`, `r3`.`Name` AS `Name1`, `r0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_Name`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r4`.`Id1` AS `Id12`, `r4`.`Name` AS `Name2`, `r0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` + FROM ((`Root_CollectionTrunk` AS `r0` + LEFT JOIN ( + SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityId1`, `r2`.`Id1` AS `Id10`, `r2`.`Name` AS `Name0`, `r1`.`OptionalReferenceLeaf_Name`, `r1`.`RequiredReferenceLeaf_Name` + FROM `Root_CollectionTrunk_CollectionBranch` AS `r1` + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_CollectionLeaf` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1` + ) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `s`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf` AS `r3` ON IIF(`r0`.`OptionalReferenceBranch_Name` IS NOT NULL, `r0`.`RelationshipsRootEntityId`, NULL) = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND IIF(`r0`.`OptionalReferenceBranch_Name` IS NOT NULL, `r0`.`Id1`, NULL) = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r0`.`Id1` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` +) AS `s0` ON `r`.`Id` = `s0`.`RelationshipsRootEntityId` +ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11` +"""); + } + + public override async Task Select_branch_required_collection(bool async) + { + await base.Select_branch_required_collection(async); + + AssertSql( + """ +SELECT `r`.`Id`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `s`.`Name0`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name` +FROM `RootEntities` AS `r` +LEFT JOIN ( + SELECT `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r1`.`RelationshipsBranchEntityId1`, `r1`.`Id1` AS `Id10`, `r1`.`Name` AS `Name0`, `r0`.`OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceLeaf_Name` + FROM `Root_RequiredReferenceTrunk_CollectionBranch` AS `r0` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r1` ON `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r0`.`Id1` = `r1`.`RelationshipsBranchEntityId1` +) AS `s` ON `r`.`Id` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` +ORDER BY `r`.`Id`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1` +"""); + } + + public override async Task Select_branch_optional_collection(bool async) + { + await base.Select_branch_optional_collection(async); + + AssertSql( + """ +SELECT `r`.`Id`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `s`.`Name0`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name` +FROM `RootEntities` AS `r` +LEFT JOIN ( + SELECT `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r1`.`RelationshipsBranchEntityId1`, `r1`.`Id1` AS `Id10`, `r1`.`Name` AS `Name0`, `r0`.`OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceLeaf_Name` + FROM `Root_RequiredReferenceTrunk_CollectionBranch` AS `r0` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r1` ON `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r0`.`Id1` = `r1`.`RelationshipsBranchEntityId1` +) AS `s` ON `r`.`Id` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` +ORDER BY `r`.`Id`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1` +"""); + } + + public override async Task Select_multiple_branch_leaf(bool async) + { + await base.Select_multiple_branch_leaf(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r0`.`Id1`, `r0`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r1`.`Id1`, `r1`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `s`.`Name0`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name` +FROM ((`RootEntities` AS `r` +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r1` ON `r`.`Id` = `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`Id1`, `r2`.`Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityId1`, `r3`.`Id1` AS `Id10`, `r3`.`Name` AS `Name0`, `r2`.`OptionalReferenceLeaf_Name`, `r2`.`RequiredReferenceLeaf_Name` + FROM `Root_RequiredReferenceTrunk_CollectionBranch` AS `r2` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r3` ON `r2`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r2`.`Id1` = `r3`.`RelationshipsBranchEntityId1` +) AS `s` ON `r`.`Id` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` +ORDER BY `r`.`Id`, `r0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r0`.`Id1`, `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r1`.`Id1`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1` +"""); + } + + public override async Task Select_subquery_root_set_trunk_FirstOrDefault_collection(bool async) + { + await base.Select_subquery_root_set_trunk_FirstOrDefault_collection(async); + + AssertSql( + """ +SELECT [r].[Id], [r3].[Id], [s].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s].[Id1], [s].[Name], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityId1], [s].[Id10], [s].[Name0], [s].[OptionalReferenceLeaf_Name], [s].[RequiredReferenceLeaf_Name], [r3].[c] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) 1 AS [c], [r0].[Id] + FROM [RootEntities] AS [r0] + ORDER BY [r0].[Id] +) AS [r3] +LEFT JOIN ( + SELECT [r1].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r1].[Id1], [r1].[Name], [r2].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r2].[RelationshipsBranchEntityId1], [r2].[Id1] AS [Id10], [r2].[Name] AS [Name0], [r1].[OptionalReferenceLeaf_Name], [r1].[RequiredReferenceLeaf_Name] + FROM [Root_RequiredReferenceTrunk_CollectionBranch] AS [r1] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf] AS [r2] ON [r1].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r2].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r1].[Id1] = [r2].[RelationshipsBranchEntityId1] +) AS [s] ON [r3].[Id] = [s].[RelationshipsTrunkEntityRelationshipsRootEntityId] +ORDER BY [r].[Id], [r3].[Id], [s].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s].[Id1], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityId1] +"""); + } + + public override async Task Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(bool async) + { + await base.Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(async); + + AssertSql( + """ +SELECT [r].[Id], [r8].[Id], [s].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s].[Id1], [s].[Name], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityId1], [s].[Id10], [s].[Name0], [s].[OptionalReferenceLeaf_Name], [s].[RequiredReferenceLeaf_Name], [r8].[RequiredReferenceTrunk_Name], [s0].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[Id1], [s0].[Name], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[RelationshipsBranchEntityId1], [s0].[Id10], [s0].[Name0], [s0].[OptionalReferenceLeaf_Name], [s0].[RequiredReferenceLeaf_Name], [r8].[RequiredReferenceTrunk_OptionalReferenceBranch_Name], [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r5].[Id1], [r5].[Name], [r8].[RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf_Name], [r8].[RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf_Name], [r8].[RequiredReferenceTrunk_RequiredReferenceBranch_Name], [r6].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r6].[Id1], [r6].[Name], [r8].[RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf_Name], [r8].[RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf_Name], [r7].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r7].[Id1], [r7].[Name], [r8].[RequiredReferenceTrunk_RequiredReferenceBranch_Name0], [r8].[c] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) [r0].[Id], [r0].[RequiredReferenceTrunk_Name], [r0].[RequiredReferenceTrunk_OptionalReferenceBranch_Name], [r0].[RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf_Name], [r0].[RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf_Name], [r0].[RequiredReferenceTrunk_RequiredReferenceBranch_Name], [r0].[RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf_Name], [r0].[RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf_Name], [r].[RequiredReferenceTrunk_RequiredReferenceBranch_Name] AS [RequiredReferenceTrunk_RequiredReferenceBranch_Name0], 1 AS [c] + FROM [RootEntities] AS [r0] + ORDER BY [r0].[Id] +) AS [r8] +LEFT JOIN ( + SELECT [r1].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r1].[Id1], [r1].[Name], [r2].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r2].[RelationshipsBranchEntityId1], [r2].[Id1] AS [Id10], [r2].[Name] AS [Name0], [r1].[OptionalReferenceLeaf_Name], [r1].[RequiredReferenceLeaf_Name] + FROM [Root_RequiredReferenceTrunk_CollectionBranch] AS [r1] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf] AS [r2] ON [r1].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r2].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r1].[Id1] = [r2].[RelationshipsBranchEntityId1] +) AS [s] ON [r].[Id] = [s].[RelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN ( + SELECT [r3].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r3].[Id1], [r3].[Name], [r4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r4].[RelationshipsBranchEntityId1], [r4].[Id1] AS [Id10], [r4].[Name] AS [Name0], [r3].[OptionalReferenceLeaf_Name], [r3].[RequiredReferenceLeaf_Name] + FROM [Root_RequiredReferenceTrunk_CollectionBranch] AS [r3] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf] AS [r4] ON [r3].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r3].[Id1] = [r4].[RelationshipsBranchEntityId1] +) AS [s0] ON [r8].[Id] = [s0].[RelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf] AS [r5] ON CASE + WHEN [r8].[RequiredReferenceTrunk_OptionalReferenceBranch_Name] IS NOT NULL THEN [r8].[Id] +END = [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf] AS [r6] ON [r8].[Id] = [r6].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf] AS [r7] ON [r8].[Id] = [r7].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +ORDER BY [r].[Id], [r8].[Id], [s].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s].[Id1], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityId1], [s].[Id10], [s0].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[Id1], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[RelationshipsBranchEntityId1], [s0].[Id10], [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r5].[Id1], [r6].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r6].[Id1], [r7].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +"""); + } + + public override async Task Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(bool async) + { + await base.Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(async); + + AssertSql( + """ +SELECT [r].[Id], [r3].[Id], [s].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s].[Id1], [s].[Name], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityId1], [s].[Id10], [s].[Name0], [s].[OptionalReferenceLeaf_Name], [s].[RequiredReferenceLeaf_Name], [r3].[c] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) 1 AS [c], [r0].[Id] + FROM [RootEntities] AS [r0] + ORDER BY [r0].[Id] +) AS [r3] +LEFT JOIN ( + SELECT [r1].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r1].[Id1], [r1].[Name], [r2].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r2].[RelationshipsBranchEntityId1], [r2].[Id1] AS [Id10], [r2].[Name] AS [Name0], [r1].[OptionalReferenceLeaf_Name], [r1].[RequiredReferenceLeaf_Name] + FROM [Root_RequiredReferenceTrunk_CollectionBranch] AS [r1] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf] AS [r2] ON [r1].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r2].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r1].[Id1] = [r2].[RelationshipsBranchEntityId1] +) AS [s] ON [r].[Id] = [s].[RelationshipsTrunkEntityRelationshipsRootEntityId] +ORDER BY [r].[Id], [r3].[Id], [s].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s].[Id1], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityId1] +"""); + } + + public override async Task SelectMany_trunk_collection(bool async) + { + await base.SelectMany_trunk_collection(async); + + AssertSql( + """ +SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r`.`Id`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `s`.`Name0`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r3`.`Id1`, `r3`.`Name`, `r0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_Name`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r4`.`Id1`, `r4`.`Name`, `r0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` +FROM (((`RootEntities` AS `r` +INNER JOIN `Root_CollectionTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN ( + SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityId1`, `r2`.`Id1` AS `Id10`, `r2`.`Name` AS `Name0`, `r1`.`OptionalReferenceLeaf_Name`, `r1`.`RequiredReferenceLeaf_Name` + FROM `Root_CollectionTrunk_CollectionBranch` AS `r1` + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_CollectionLeaf` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1` +) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `s`.`RelationshipsTrunkEntityId1`) +LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf` AS `r3` ON IIF(`r0`.`OptionalReferenceBranch_Name` IS NOT NULL, `r0`.`RelationshipsRootEntityId`, NULL) = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND IIF(`r0`.`OptionalReferenceBranch_Name` IS NOT NULL, `r0`.`Id1`, NULL) = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) +LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r0`.`Id1` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r3`.`Id1`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` +"""); + } + + public override async Task SelectMany_required_trunk_reference_branch_collection(bool async) + { + await base.SelectMany_required_trunk_reference_branch_collection(async); + + AssertSql( + """ +SELECT `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r1`.`RelationshipsBranchEntityId1`, `r1`.`Id1`, `r1`.`Name`, `r0`.`OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceLeaf_Name` +FROM (`RootEntities` AS `r` +INNER JOIN `Root_RequiredReferenceTrunk_CollectionBranch` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r1` ON `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r0`.`Id1` = `r1`.`RelationshipsBranchEntityId1` +ORDER BY `r`.`Id`, `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r0`.`Id1`, `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r1`.`RelationshipsBranchEntityId1` +"""); + } + + public override async Task SelectMany_optional_trunk_reference_branch_collection(bool async) + { + await base.SelectMany_optional_trunk_reference_branch_collection(async); + + AssertSql( + """ +SELECT `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r1`.`RelationshipsBranchEntityId1`, `r1`.`Id1`, `r1`.`Name`, `r0`.`OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceLeaf_Name` +FROM (`RootEntities` AS `r` +LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch` AS `r0` ON IIF(`r`.`OptionalReferenceTrunk_Name` IS NOT NULL, `r`.`Id`, NULL) = `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r1` ON `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r0`.`Id1` = `r1`.`RelationshipsBranchEntityId1` +WHERE `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId` IS NOT NULL +ORDER BY `r`.`Id`, `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r0`.`Id1`, `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r1`.`RelationshipsBranchEntityId1` +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedProjectionJetTest.cs new file mode 100644 index 00000000..b660f326 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedProjectionJetTest.cs @@ -0,0 +1,68 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Diagnostics; +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +public class OwnedProjectionJetTest + : OwnedProjectionRelationalTestBase +{ + public OwnedProjectionJetTest(OwnedRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override Task Select_trunk_collection(bool async) + => AssertCantTrackOwned(() => base.Select_trunk_collection(async)); + + public override Task Select_branch_required_collection(bool async) + => AssertCantTrackOwned(() => base.Select_branch_required_collection(async)); + + public override Task Select_branch_optional_collection(bool async) + => AssertCantTrackOwned(() => base.Select_branch_optional_collection(async)); + + public override Task Select_multiple_branch_leaf(bool async) + => AssertCantTrackOwned(() => base.Select_multiple_branch_leaf(async)); + + public override Task Select_subquery_root_set_trunk_FirstOrDefault_collection(bool async) + => AssertCantTrackOwned(() => base.Select_subquery_root_set_trunk_FirstOrDefault_collection(async)); + + public override Task Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(bool async) + => AssertCantTrackOwned(() => base.Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(async)); + + public override Task Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(bool async) + => AssertCantTrackOwned(() => base.Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(async)); + + public override Task SelectMany_trunk_collection(bool async) + => AssertCantTrackOwned(() => base.SelectMany_trunk_collection(async)); + + public override Task SelectMany_required_trunk_reference_branch_collection(bool async) + => AssertCantTrackOwned(() => base.SelectMany_required_trunk_reference_branch_collection(async)); + + public override Task SelectMany_optional_trunk_reference_branch_collection(bool async) + => AssertCantTrackOwned(() => base.SelectMany_optional_trunk_reference_branch_collection(async)); + + private async Task AssertCantTrackOwned(Func test) + { + var message = (await Assert.ThrowsAsync(test)).Message; + + Assert.Equal(CoreStrings.OwnedEntitiesCannotBeTrackedWithoutTheirOwner, message); + AssertSql(); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedReferenceNoTrackingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedReferenceNoTrackingProjectionJetTest.cs new file mode 100644 index 00000000..e6ca6ca1 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedReferenceNoTrackingProjectionJetTest.cs @@ -0,0 +1,353 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +public class OwnedReferenceNoTrackingProjectionJetTest + : OwnedReferenceNoTrackingProjectionRelationalTestBase +{ + public OwnedReferenceNoTrackingProjectionJetTest(OwnedRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Select_root(bool async) + { + await base.Select_root(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`Name1`, `s0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s0`.`Name2`, `s0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r7`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `r8`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`OptionalReferenceLeaf_Name`, `s2`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~` +FROM ((((((`RootEntities` AS `r` +LEFT JOIN ( + SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r3`.`Id1` AS `Id11`, `r3`.`Name` AS `Name1`, `r0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_Name`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r4`.`Id1` AS `Id12`, `r4`.`Name` AS `Name2`, `r0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` + FROM ((`Root_CollectionTrunk` AS `r0` + LEFT JOIN ( + SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityId1`, `r2`.`Id1` AS `Id10`, `r2`.`Name` AS `Name0`, `r1`.`OptionalReferenceLeaf_Name`, `r1`.`RequiredReferenceLeaf_Name` + FROM `Root_CollectionTrunk_CollectionBranch` AS `r1` + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_CollectionLeaf` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1` + ) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `s`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf` AS `r3` ON IIF(`r0`.`OptionalReferenceBranch_Name` IS NOT NULL, `r0`.`RelationshipsRootEntityId`, NULL) = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND IIF(`r0`.`OptionalReferenceBranch_Name` IS NOT NULL, `r0`.`Id1`, NULL) = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r0`.`Id1` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` +) AS `s0` ON `r`.`Id` = `s0`.`RelationshipsRootEntityId`) +LEFT JOIN ( + SELECT `r5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`Id1`, `r5`.`Name`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityId1`, `r6`.`Id1` AS `Id10`, `r6`.`Name` AS `Name0`, `r5`.`OptionalReferenceLeaf_Name`, `r5`.`RequiredReferenceLeaf_Name` + FROM `Root_OptionalReferenceTrunk_CollectionBranch` AS `r5` + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r6` ON `r5`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r5`.`Id1` = `r6`.`RelationshipsBranchEntityId1` +) AS `s1` ON IIF(`r`.`OptionalReferenceTrunk_Name` IS NOT NULL, `r`.`Id`, NULL) = `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r7` ON IIF(`r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r8` ON IIF(`r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r9`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`Id1`, `r9`.`Name`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityId1`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r9`.`OptionalReferenceLeaf_Name`, `r9`.`RequiredReferenceLeaf_Name` + FROM `Root_RequiredReferenceTrunk_CollectionBranch` AS `r9` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r10` ON `r9`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r9`.`Id1` = `r10`.`RelationshipsBranchEntityId1` +) AS `s2` ON `r`.`Id` = `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r11` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r12` ON `r`.`Id` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_trunk_optional(bool async) + { + await base.Select_trunk_optional(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`OptionalReferenceTrunk_Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `s`.`Name0`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Id1`, `r2`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`Id1`, `r3`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~` +FROM ((`RootEntities` AS `r` +LEFT JOIN ( + SELECT `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r1`.`RelationshipsBranchEntityId1`, `r1`.`Id1` AS `Id10`, `r1`.`Name` AS `Name0`, `r0`.`OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceLeaf_Name` + FROM `Root_OptionalReferenceTrunk_CollectionBranch` AS `r0` + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r1` ON `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r0`.`Id1` = `r1`.`RelationshipsBranchEntityId1` +) AS `s` ON IIF(`r`.`OptionalReferenceTrunk_Name` IS NOT NULL, `r`.`Id`, NULL) = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r2` ON IIF(`r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r3` ON IIF(`r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Id1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_trunk_required(bool async) + { + await base.Select_trunk_required(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`RequiredReferenceTrunk_Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `s`.`Name0`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Id1`, `r2`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`Id1`, `r3`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~` +FROM ((`RootEntities` AS `r` +LEFT JOIN ( + SELECT `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r1`.`RelationshipsBranchEntityId1`, `r1`.`Id1` AS `Id10`, `r1`.`Name` AS `Name0`, `r0`.`OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceLeaf_Name` + FROM `Root_RequiredReferenceTrunk_CollectionBranch` AS `r0` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r1` ON `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r0`.`Id1` = `r1`.`RelationshipsBranchEntityId1` +) AS `s` ON `r`.`Id` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r2` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r3` ON `r`.`Id` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Id1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_branch_required_required(bool async) + { + await base.Select_branch_required_required(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r0`.`Id1`, `r0`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~` +FROM `RootEntities` AS `r` +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_branch_required_optional(bool async) + { + await base.Select_branch_required_optional(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r0`.`Id1`, `r0`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~` +FROM `RootEntities` AS `r` +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r0` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_branch_optional_required(bool async) + { + await base.Select_branch_optional_required(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r0`.`Id1`, `r0`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~` +FROM `RootEntities` AS `r` +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_branch_optional_optional(bool async) + { + await base.Select_branch_optional_optional(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r0`.`Id1`, `r0`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~` +FROM `RootEntities` AS `r` +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r0` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_root_duplicated(bool async) + { + await base.Select_root_duplicated(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`Name1`, `s0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s0`.`Name2`, `s0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r7`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `r8`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`OptionalReferenceLeaf_Name`, `s2`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `s4`.`RelationshipsRootEntityId`, `s4`.`Id1`, `s4`.`Name`, `s4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s4`.`RelationshipsTrunkEntityId1`, `s4`.`Id10`, `s4`.`Name0`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s4`.`RelationshipsBranchEntityId1`, `s4`.`Id100`, `s4`.`Name00`, `s4`.`OptionalReferenceLeaf_Name`, `s4`.`RequiredReferenceLeaf_Name`, `s4`.`OptionalReferenceBranch_Name`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s4`.`Id11`, `s4`.`Name1`, `s4`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s4`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s4`.`RequiredReferenceBranch_Name`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s4`.`Id12`, `s4`.`Name2`, `s4`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s4`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `s5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s5`.`Id1`, `s5`.`Name`, `s5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s5`.`RelationshipsBranchEntityId1`, `s5`.`Id10`, `s5`.`Name0`, `s5`.`OptionalReferenceLeaf_Name`, `s5`.`RequiredReferenceLeaf_Name`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r20`.`Id1`, `r20`.`Name`, `r21`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r21`.`Id1`, `r21`.`Name`, `s6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s6`.`Id1`, `s6`.`Name`, `s6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s6`.`RelationshipsBranchEntityId1`, `s6`.`Id10`, `s6`.`Name0`, `s6`.`OptionalReferenceLeaf_Name`, `s6`.`RequiredReferenceLeaf_Name`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r24`.`Id1`, `r24`.`Name`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r25`.`Id1`, `r25`.`Name` +FROM (((((((((((((`RootEntities` AS `r` +LEFT JOIN ( + SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r3`.`Id1` AS `Id11`, `r3`.`Name` AS `Name1`, `r0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_Name`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r4`.`Id1` AS `Id12`, `r4`.`Name` AS `Name2`, `r0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` + FROM ((`Root_CollectionTrunk` AS `r0` + LEFT JOIN ( + SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityId1`, `r2`.`Id1` AS `Id10`, `r2`.`Name` AS `Name0`, `r1`.`OptionalReferenceLeaf_Name`, `r1`.`RequiredReferenceLeaf_Name` + FROM `Root_CollectionTrunk_CollectionBranch` AS `r1` + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_CollectionLeaf` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1` + ) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `s`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf` AS `r3` ON IIF(`r0`.`OptionalReferenceBranch_Name` IS NOT NULL, `r0`.`RelationshipsRootEntityId`, NULL) = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND IIF(`r0`.`OptionalReferenceBranch_Name` IS NOT NULL, `r0`.`Id1`, NULL) = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r0`.`Id1` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` +) AS `s0` ON `r`.`Id` = `s0`.`RelationshipsRootEntityId`) +LEFT JOIN ( + SELECT `r5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`Id1`, `r5`.`Name`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityId1`, `r6`.`Id1` AS `Id10`, `r6`.`Name` AS `Name0`, `r5`.`OptionalReferenceLeaf_Name`, `r5`.`RequiredReferenceLeaf_Name` + FROM `Root_OptionalReferenceTrunk_CollectionBranch` AS `r5` + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r6` ON `r5`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r5`.`Id1` = `r6`.`RelationshipsBranchEntityId1` +) AS `s1` ON IIF(`r`.`OptionalReferenceTrunk_Name` IS NOT NULL, `r`.`Id`, NULL) = `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r7` ON IIF(`r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r8` ON IIF(`r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r9`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`Id1`, `r9`.`Name`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityId1`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r9`.`OptionalReferenceLeaf_Name`, `r9`.`RequiredReferenceLeaf_Name` + FROM `Root_RequiredReferenceTrunk_CollectionBranch` AS `r9` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r10` ON `r9`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r9`.`Id1` = `r10`.`RelationshipsBranchEntityId1` +) AS `s2` ON `r`.`Id` = `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r11` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r12` ON `r`.`Id` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r13`.`RelationshipsRootEntityId`, `r13`.`Id1`, `r13`.`Name`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`RelationshipsTrunkEntityId1`, `s3`.`Id1` AS `Id10`, `s3`.`Name` AS `Name0`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`Id10` AS `Id100`, `s3`.`Name0` AS `Name00`, `s3`.`OptionalReferenceLeaf_Name`, `s3`.`RequiredReferenceLeaf_Name`, `r13`.`OptionalReferenceBranch_Name`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r16`.`Id1` AS `Id11`, `r16`.`Name` AS `Name1`, `r13`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r13`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r13`.`RequiredReferenceBranch_Name`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r17`.`Id1` AS `Id12`, `r17`.`Name` AS `Name2`, `r13`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r13`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` + FROM ((`Root_CollectionTrunk` AS `r13` + LEFT JOIN ( + SELECT `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r14`.`RelationshipsTrunkEntityId1`, `r14`.`Id1`, `r14`.`Name`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r15`.`RelationshipsBranchEntityId1`, `r15`.`Id1` AS `Id10`, `r15`.`Name` AS `Name0`, `r14`.`OptionalReferenceLeaf_Name`, `r14`.`RequiredReferenceLeaf_Name` + FROM `Root_CollectionTrunk_CollectionBranch` AS `r14` + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_CollectionLeaf` AS `r15` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`RelationshipsTrunkEntityId1` = `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r14`.`Id1` = `r15`.`RelationshipsBranchEntityId1` + ) AS `s3` ON `r13`.`RelationshipsRootEntityId` = `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r13`.`Id1` = `s3`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf` AS `r16` ON IIF(`r13`.`OptionalReferenceBranch_Name` IS NOT NULL, `r13`.`RelationshipsRootEntityId`, NULL) = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND IIF(`r13`.`OptionalReferenceBranch_Name` IS NOT NULL, `r13`.`Id1`, NULL) = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r17` ON `r13`.`RelationshipsRootEntityId` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r13`.`Id1` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` +) AS `s4` ON `r`.`Id` = `s4`.`RelationshipsRootEntityId`) +LEFT JOIN ( + SELECT `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r18`.`Id1`, `r18`.`Name`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r19`.`RelationshipsBranchEntityId1`, `r19`.`Id1` AS `Id10`, `r19`.`Name` AS `Name0`, `r18`.`OptionalReferenceLeaf_Name`, `r18`.`RequiredReferenceLeaf_Name` + FROM `Root_OptionalReferenceTrunk_CollectionBranch` AS `r18` + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r19` ON `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r18`.`Id1` = `r19`.`RelationshipsBranchEntityId1` +) AS `s5` ON IIF(`r`.`OptionalReferenceTrunk_Name` IS NOT NULL, `r`.`Id`, NULL) = `s5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r20` ON IIF(`r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r21` ON IIF(`r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r21`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r22`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r22`.`Id1`, `r22`.`Name`, `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r23`.`RelationshipsBranchEntityId1`, `r23`.`Id1` AS `Id10`, `r23`.`Name` AS `Name0`, `r22`.`OptionalReferenceLeaf_Name`, `r22`.`RequiredReferenceLeaf_Name` + FROM `Root_RequiredReferenceTrunk_CollectionBranch` AS `r22` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r23` ON `r22`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r22`.`Id1` = `r23`.`RelationshipsBranchEntityId1` +) AS `s6` ON `r`.`Id` = `s6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r24` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r25` ON `r`.`Id` = `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `s4`.`RelationshipsRootEntityId`, `s4`.`Id1`, `s4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s4`.`RelationshipsTrunkEntityId1`, `s4`.`Id10`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s4`.`RelationshipsBranchEntityId1`, `s4`.`Id100`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s4`.`Id11`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s4`.`Id12`, `s5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s5`.`Id1`, `s5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s5`.`RelationshipsBranchEntityId1`, `s5`.`Id10`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r20`.`Id1`, `r21`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r21`.`Id1`, `s6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s6`.`Id1`, `s6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s6`.`RelationshipsBranchEntityId1`, `s6`.`Id10`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r24`.`Id1`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_trunk_and_branch_duplicated(bool async) + { + await base.Select_trunk_and_branch_duplicated(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`OptionalReferenceTrunk_Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `s`.`Name0`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Id1`, `r2`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`Id1`, `r3`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`Id1`, `r4`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `r8`.`Name`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r9`.`Id1`, `r9`.`Name` +FROM (((((((`RootEntities` AS `r` +LEFT JOIN ( + SELECT `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r1`.`RelationshipsBranchEntityId1`, `r1`.`Id1` AS `Id10`, `r1`.`Name` AS `Name0`, `r0`.`OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceLeaf_Name` + FROM `Root_OptionalReferenceTrunk_CollectionBranch` AS `r0` + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r1` ON `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r0`.`Id1` = `r1`.`RelationshipsBranchEntityId1` +) AS `s` ON IIF(`r`.`OptionalReferenceTrunk_Name` IS NOT NULL, `r`.`Id`, NULL) = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r2` ON IIF(`r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r3` ON IIF(`r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r4` ON IIF(`r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`Id1`, `r5`.`Name`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityId1`, `r6`.`Id1` AS `Id10`, `r6`.`Name` AS `Name0`, `r5`.`OptionalReferenceLeaf_Name`, `r5`.`RequiredReferenceLeaf_Name` + FROM `Root_OptionalReferenceTrunk_CollectionBranch` AS `r5` + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r6` ON `r5`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r5`.`Id1` = `r6`.`RelationshipsBranchEntityId1` +) AS `s0` ON IIF(`r`.`OptionalReferenceTrunk_Name` IS NOT NULL, `r`.`Id`, NULL) = `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r7` ON IIF(`r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r8` ON IIF(`r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r9` ON IIF(`r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Id1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`Id1`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id10`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_trunk_and_trunk_duplicated(bool async) + { + await base.Select_trunk_and_trunk_duplicated(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`RequiredReferenceTrunk_Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `s`.`Name0`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Id1`, `r2`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`Id1`, `r3`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`Id1`, `r6`.`Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r7`.`Name` +FROM (((((`RootEntities` AS `r` +LEFT JOIN ( + SELECT `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r1`.`RelationshipsBranchEntityId1`, `r1`.`Id1` AS `Id10`, `r1`.`Name` AS `Name0`, `r0`.`OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceLeaf_Name` + FROM `Root_RequiredReferenceTrunk_CollectionBranch` AS `r0` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r1` ON `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r0`.`Id1` = `r1`.`RelationshipsBranchEntityId1` +) AS `s` ON `r`.`Id` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r2` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r3` ON `r`.`Id` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r4`.`Id1`, `r4`.`Name`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`RelationshipsBranchEntityId1`, `r5`.`Id1` AS `Id10`, `r5`.`Name` AS `Name0`, `r4`.`OptionalReferenceLeaf_Name`, `r4`.`RequiredReferenceLeaf_Name` + FROM `Root_RequiredReferenceTrunk_CollectionBranch` AS `r4` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`Id1` = `r5`.`RelationshipsBranchEntityId1` +) AS `s0` ON `r`.`Id` = `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r6` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r7` ON `r`.`Id` = `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Id1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id10`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`Id1`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_leaf_trunk_root(bool async) + { + await base.Select_leaf_trunk_root(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `s`.`Name0`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Id1`, `r2`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`Id1`, `r3`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s1`.`RelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`RelationshipsTrunkEntityId1`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id100`, `s1`.`Name00`, `s1`.`OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceLeaf_Name`, `s1`.`OptionalReferenceBranch_Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s1`.`Id11`, `s1`.`Name1`, `s1`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s1`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s1`.`RequiredReferenceBranch_Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s1`.`Id12`, `s1`.`Name2`, `s1`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`OptionalReferenceLeaf_Name`, `s2`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`Id1`, `s3`.`Name`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`Id10`, `s3`.`Name0`, `s3`.`OptionalReferenceLeaf_Name`, `s3`.`RequiredReferenceLeaf_Name`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r15`.`Id1`, `r15`.`Name`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r16`.`Id1`, `r16`.`Name` +FROM (((((((((`RootEntities` AS `r` +LEFT JOIN ( + SELECT `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r1`.`RelationshipsBranchEntityId1`, `r1`.`Id1` AS `Id10`, `r1`.`Name` AS `Name0`, `r0`.`OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceLeaf_Name` + FROM `Root_RequiredReferenceTrunk_CollectionBranch` AS `r0` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r1` ON `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r0`.`Id1` = `r1`.`RelationshipsBranchEntityId1` +) AS `s` ON `r`.`Id` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r2` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r3` ON `r`.`Id` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r4`.`RelationshipsRootEntityId`, `r4`.`Id1`, `r4`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id1` AS `Id10`, `s0`.`Name` AS `Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id10` AS `Id100`, `s0`.`Name0` AS `Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `r4`.`OptionalReferenceBranch_Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r7`.`Id1` AS `Id11`, `r7`.`Name` AS `Name1`, `r4`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r4`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r4`.`RequiredReferenceBranch_Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r8`.`Id1` AS `Id12`, `r8`.`Name` AS `Name2`, `r4`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r4`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` + FROM ((`Root_CollectionTrunk` AS `r4` + LEFT JOIN ( + SELECT `r5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsTrunkEntityId1`, `r5`.`Id1`, `r5`.`Name`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r6`.`RelationshipsBranchEntityId1`, `r6`.`Id1` AS `Id10`, `r6`.`Name` AS `Name0`, `r5`.`OptionalReferenceLeaf_Name`, `r5`.`RequiredReferenceLeaf_Name` + FROM `Root_CollectionTrunk_CollectionBranch` AS `r5` + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_CollectionLeaf` AS `r6` ON `r5`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r5`.`RelationshipsTrunkEntityId1` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r5`.`Id1` = `r6`.`RelationshipsBranchEntityId1` + ) AS `s0` ON `r4`.`RelationshipsRootEntityId` = `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r4`.`Id1` = `s0`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf` AS `r7` ON IIF(`r4`.`OptionalReferenceBranch_Name` IS NOT NULL, `r4`.`RelationshipsRootEntityId`, NULL) = `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND IIF(`r4`.`OptionalReferenceBranch_Name` IS NOT NULL, `r4`.`Id1`, NULL) = `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r8` ON `r4`.`RelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`Id1` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` +) AS `s1` ON `r`.`Id` = `s1`.`RelationshipsRootEntityId`) +LEFT JOIN ( + SELECT `r9`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`Id1`, `r9`.`Name`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityId1`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r9`.`OptionalReferenceLeaf_Name`, `r9`.`RequiredReferenceLeaf_Name` + FROM `Root_OptionalReferenceTrunk_CollectionBranch` AS `r9` + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r10` ON `r9`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r9`.`Id1` = `r10`.`RelationshipsBranchEntityId1` +) AS `s2` ON IIF(`r`.`OptionalReferenceTrunk_Name` IS NOT NULL, `r`.`Id`, NULL) = `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r11` ON IIF(`r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r12` ON IIF(`r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r13`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r13`.`Id1`, `r13`.`Name`, `r14`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r14`.`RelationshipsBranchEntityId1`, `r14`.`Id1` AS `Id10`, `r14`.`Name` AS `Name0`, `r13`.`OptionalReferenceLeaf_Name`, `r13`.`RequiredReferenceLeaf_Name` + FROM `Root_RequiredReferenceTrunk_CollectionBranch` AS `r13` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r14` ON `r13`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r14`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r13`.`Id1` = `r14`.`RelationshipsBranchEntityId1` +) AS `s3` ON `r`.`Id` = `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r15` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r16` ON `r`.`Id` = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Id1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`Id1`, `s1`.`RelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`RelationshipsTrunkEntityId1`, `s1`.`Id10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id100`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s1`.`Id11`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s1`.`Id12`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`Id1`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`Id10`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r15`.`Id1`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_subquery_root_set_required_trunk_FirstOrDefault_branch(bool async) + { + await base.Select_subquery_root_set_required_trunk_FirstOrDefault_branch(async); + + AssertSql( + """ +SELECT [r2].[Id], [r2].[RequiredReferenceTrunk_RequiredReferenceBranch_Name], [r].[Id], [r1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r1].[Id1], [r1].[Name], [r2].[RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf_Name], [r2].[RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf_Name] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) [r0].[Id], [r0].[RequiredReferenceTrunk_RequiredReferenceBranch_Name], [r0].[RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf_Name], [r0].[RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf_Name] + FROM [RootEntities] AS [r0] + ORDER BY [r0].[Id] +) AS [r2] +LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf] AS [r1] ON [r2].[Id] = [r1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +ORDER BY [r].[Id], [r2].[Id], [r1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +"""); + } + + public override async Task Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(bool async) + { + await base.Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(async); + + AssertSql( + """ +SELECT [r2].[Id], [r2].[OptionalReferenceTrunk_OptionalReferenceBranch_Name], [r].[Id], [r1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r1].[Id1], [r1].[Name], [r2].[OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf_Name], [r2].[OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf_Name] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) [r0].[Id], [r0].[OptionalReferenceTrunk_OptionalReferenceBranch_Name], [r0].[OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf_Name], [r0].[OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf_Name] + FROM [RootEntities] AS [r0] + ORDER BY [r0].[Id] +) AS [r2] +LEFT JOIN [Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollectionLeaf] AS [r1] ON CASE + WHEN [r2].[OptionalReferenceTrunk_OptionalReferenceBranch_Name] IS NOT NULL THEN [r2].[Id] +END = [r1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +ORDER BY [r].[Id], [r2].[Id], [r1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedReferenceProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedReferenceProjectionJetTest.cs new file mode 100644 index 00000000..e0b6ee0c --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedReferenceProjectionJetTest.cs @@ -0,0 +1,170 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Diagnostics; +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +public class OwnedReferenceProjectionJetTest + : OwnedReferenceProjectionRelationalTestBase +{ + public OwnedReferenceProjectionJetTest(OwnedRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Select_root(bool async) + { + await base.Select_root(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`Name1`, `s0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s0`.`Name2`, `s0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r7`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `r8`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`OptionalReferenceLeaf_Name`, `s2`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~` +FROM ((((((`RootEntities` AS `r` +LEFT JOIN ( + SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r3`.`Id1` AS `Id11`, `r3`.`Name` AS `Name1`, `r0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_Name`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r4`.`Id1` AS `Id12`, `r4`.`Name` AS `Name2`, `r0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` + FROM ((`Root_CollectionTrunk` AS `r0` + LEFT JOIN ( + SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityId1`, `r2`.`Id1` AS `Id10`, `r2`.`Name` AS `Name0`, `r1`.`OptionalReferenceLeaf_Name`, `r1`.`RequiredReferenceLeaf_Name` + FROM `Root_CollectionTrunk_CollectionBranch` AS `r1` + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_CollectionLeaf` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1` + ) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `s`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf` AS `r3` ON IIF(`r0`.`OptionalReferenceBranch_Name` IS NOT NULL, `r0`.`RelationshipsRootEntityId`, NULL) = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND IIF(`r0`.`OptionalReferenceBranch_Name` IS NOT NULL, `r0`.`Id1`, NULL) = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r0`.`Id1` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` +) AS `s0` ON `r`.`Id` = `s0`.`RelationshipsRootEntityId`) +LEFT JOIN ( + SELECT `r5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`Id1`, `r5`.`Name`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityId1`, `r6`.`Id1` AS `Id10`, `r6`.`Name` AS `Name0`, `r5`.`OptionalReferenceLeaf_Name`, `r5`.`RequiredReferenceLeaf_Name` + FROM `Root_OptionalReferenceTrunk_CollectionBranch` AS `r5` + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r6` ON `r5`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r5`.`Id1` = `r6`.`RelationshipsBranchEntityId1` +) AS `s1` ON IIF(`r`.`OptionalReferenceTrunk_Name` IS NOT NULL, `r`.`Id`, NULL) = `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r7` ON IIF(`r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r8` ON IIF(`r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r9`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`Id1`, `r9`.`Name`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityId1`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r9`.`OptionalReferenceLeaf_Name`, `r9`.`RequiredReferenceLeaf_Name` + FROM `Root_RequiredReferenceTrunk_CollectionBranch` AS `r9` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r10` ON `r9`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r9`.`Id1` = `r10`.`RelationshipsBranchEntityId1` +) AS `s2` ON `r`.`Id` = `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r11` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r12` ON `r`.`Id` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_root_duplicated(bool async) + { + await base.Select_root_duplicated(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`Name1`, `s0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s0`.`Name2`, `s0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r7`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `r8`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`OptionalReferenceLeaf_Name`, `s2`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `s4`.`RelationshipsRootEntityId`, `s4`.`Id1`, `s4`.`Name`, `s4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s4`.`RelationshipsTrunkEntityId1`, `s4`.`Id10`, `s4`.`Name0`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s4`.`RelationshipsBranchEntityId1`, `s4`.`Id100`, `s4`.`Name00`, `s4`.`OptionalReferenceLeaf_Name`, `s4`.`RequiredReferenceLeaf_Name`, `s4`.`OptionalReferenceBranch_Name`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s4`.`Id11`, `s4`.`Name1`, `s4`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s4`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s4`.`RequiredReferenceBranch_Name`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s4`.`Id12`, `s4`.`Name2`, `s4`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s4`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `s5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s5`.`Id1`, `s5`.`Name`, `s5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s5`.`RelationshipsBranchEntityId1`, `s5`.`Id10`, `s5`.`Name0`, `s5`.`OptionalReferenceLeaf_Name`, `s5`.`RequiredReferenceLeaf_Name`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r20`.`Id1`, `r20`.`Name`, `r21`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r21`.`Id1`, `r21`.`Name`, `s6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s6`.`Id1`, `s6`.`Name`, `s6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s6`.`RelationshipsBranchEntityId1`, `s6`.`Id10`, `s6`.`Name0`, `s6`.`OptionalReferenceLeaf_Name`, `s6`.`RequiredReferenceLeaf_Name`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r24`.`Id1`, `r24`.`Name`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r25`.`Id1`, `r25`.`Name` +FROM (((((((((((((`RootEntities` AS `r` +LEFT JOIN ( + SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r3`.`Id1` AS `Id11`, `r3`.`Name` AS `Name1`, `r0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_Name`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r4`.`Id1` AS `Id12`, `r4`.`Name` AS `Name2`, `r0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` + FROM ((`Root_CollectionTrunk` AS `r0` + LEFT JOIN ( + SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityId1`, `r2`.`Id1` AS `Id10`, `r2`.`Name` AS `Name0`, `r1`.`OptionalReferenceLeaf_Name`, `r1`.`RequiredReferenceLeaf_Name` + FROM `Root_CollectionTrunk_CollectionBranch` AS `r1` + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_CollectionLeaf` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1` + ) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `s`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf` AS `r3` ON IIF(`r0`.`OptionalReferenceBranch_Name` IS NOT NULL, `r0`.`RelationshipsRootEntityId`, NULL) = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND IIF(`r0`.`OptionalReferenceBranch_Name` IS NOT NULL, `r0`.`Id1`, NULL) = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r0`.`Id1` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` +) AS `s0` ON `r`.`Id` = `s0`.`RelationshipsRootEntityId`) +LEFT JOIN ( + SELECT `r5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`Id1`, `r5`.`Name`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityId1`, `r6`.`Id1` AS `Id10`, `r6`.`Name` AS `Name0`, `r5`.`OptionalReferenceLeaf_Name`, `r5`.`RequiredReferenceLeaf_Name` + FROM `Root_OptionalReferenceTrunk_CollectionBranch` AS `r5` + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r6` ON `r5`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r5`.`Id1` = `r6`.`RelationshipsBranchEntityId1` +) AS `s1` ON IIF(`r`.`OptionalReferenceTrunk_Name` IS NOT NULL, `r`.`Id`, NULL) = `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r7` ON IIF(`r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r8` ON IIF(`r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r9`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`Id1`, `r9`.`Name`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityId1`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r9`.`OptionalReferenceLeaf_Name`, `r9`.`RequiredReferenceLeaf_Name` + FROM `Root_RequiredReferenceTrunk_CollectionBranch` AS `r9` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r10` ON `r9`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r9`.`Id1` = `r10`.`RelationshipsBranchEntityId1` +) AS `s2` ON `r`.`Id` = `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r11` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r12` ON `r`.`Id` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r13`.`RelationshipsRootEntityId`, `r13`.`Id1`, `r13`.`Name`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`RelationshipsTrunkEntityId1`, `s3`.`Id1` AS `Id10`, `s3`.`Name` AS `Name0`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`Id10` AS `Id100`, `s3`.`Name0` AS `Name00`, `s3`.`OptionalReferenceLeaf_Name`, `s3`.`RequiredReferenceLeaf_Name`, `r13`.`OptionalReferenceBranch_Name`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r16`.`Id1` AS `Id11`, `r16`.`Name` AS `Name1`, `r13`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r13`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r13`.`RequiredReferenceBranch_Name`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r17`.`Id1` AS `Id12`, `r17`.`Name` AS `Name2`, `r13`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r13`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` + FROM ((`Root_CollectionTrunk` AS `r13` + LEFT JOIN ( + SELECT `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r14`.`RelationshipsTrunkEntityId1`, `r14`.`Id1`, `r14`.`Name`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r15`.`RelationshipsBranchEntityId1`, `r15`.`Id1` AS `Id10`, `r15`.`Name` AS `Name0`, `r14`.`OptionalReferenceLeaf_Name`, `r14`.`RequiredReferenceLeaf_Name` + FROM `Root_CollectionTrunk_CollectionBranch` AS `r14` + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_CollectionLeaf` AS `r15` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`RelationshipsTrunkEntityId1` = `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r14`.`Id1` = `r15`.`RelationshipsBranchEntityId1` + ) AS `s3` ON `r13`.`RelationshipsRootEntityId` = `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r13`.`Id1` = `s3`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf` AS `r16` ON IIF(`r13`.`OptionalReferenceBranch_Name` IS NOT NULL, `r13`.`RelationshipsRootEntityId`, NULL) = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND IIF(`r13`.`OptionalReferenceBranch_Name` IS NOT NULL, `r13`.`Id1`, NULL) = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r17` ON `r13`.`RelationshipsRootEntityId` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r13`.`Id1` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` +) AS `s4` ON `r`.`Id` = `s4`.`RelationshipsRootEntityId`) +LEFT JOIN ( + SELECT `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r18`.`Id1`, `r18`.`Name`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r19`.`RelationshipsBranchEntityId1`, `r19`.`Id1` AS `Id10`, `r19`.`Name` AS `Name0`, `r18`.`OptionalReferenceLeaf_Name`, `r18`.`RequiredReferenceLeaf_Name` + FROM `Root_OptionalReferenceTrunk_CollectionBranch` AS `r18` + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r19` ON `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r18`.`Id1` = `r19`.`RelationshipsBranchEntityId1` +) AS `s5` ON IIF(`r`.`OptionalReferenceTrunk_Name` IS NOT NULL, `r`.`Id`, NULL) = `s5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r20` ON IIF(`r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r21` ON IIF(`r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r21`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r22`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r22`.`Id1`, `r22`.`Name`, `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r23`.`RelationshipsBranchEntityId1`, `r23`.`Id1` AS `Id10`, `r23`.`Name` AS `Name0`, `r22`.`OptionalReferenceLeaf_Name`, `r22`.`RequiredReferenceLeaf_Name` + FROM `Root_RequiredReferenceTrunk_CollectionBranch` AS `r22` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r23` ON `r22`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r22`.`Id1` = `r23`.`RelationshipsBranchEntityId1` +) AS `s6` ON `r`.`Id` = `s6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r24` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r25` ON `r`.`Id` = `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `s4`.`RelationshipsRootEntityId`, `s4`.`Id1`, `s4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s4`.`RelationshipsTrunkEntityId1`, `s4`.`Id10`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s4`.`RelationshipsBranchEntityId1`, `s4`.`Id100`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s4`.`Id11`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s4`.`Id12`, `s5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s5`.`Id1`, `s5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s5`.`RelationshipsBranchEntityId1`, `s5`.`Id10`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r20`.`Id1`, `r21`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r21`.`Id1`, `s6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s6`.`Id1`, `s6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s6`.`RelationshipsBranchEntityId1`, `s6`.`Id10`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r24`.`Id1`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override Task Select_trunk_optional(bool async) + => AssertCantTrackOwned(() => base.Select_trunk_optional(async)); + + public override Task Select_trunk_required(bool async) + => AssertCantTrackOwned(() => base.Select_trunk_required(async)); + + public override Task Select_branch_required_required(bool async) + => AssertCantTrackOwned(() => base.Select_branch_required_required(async)); + + public override Task Select_branch_required_optional(bool async) + => AssertCantTrackOwned(() => base.Select_branch_required_optional(async)); + + public override Task Select_branch_optional_required(bool async) + => AssertCantTrackOwned(() => base.Select_branch_optional_required(async)); + + public override Task Select_branch_optional_optional(bool async) + => AssertCantTrackOwned(() => base.Select_branch_optional_optional(async)); + + public override Task Select_trunk_and_branch_duplicated(bool async) + => AssertCantTrackOwned(() => base.Select_trunk_and_branch_duplicated(async)); + + public override Task Select_trunk_and_trunk_duplicated(bool async) + => AssertCantTrackOwned(() => base.Select_trunk_and_trunk_duplicated(async)); + + public override Task Select_leaf_trunk_root(bool async) + => AssertCantTrackOwned(() => base.Select_leaf_trunk_root(async)); + + public override Task Select_subquery_root_set_required_trunk_FirstOrDefault_branch(bool async) + => AssertCantTrackOwned(() => base.Select_subquery_root_set_required_trunk_FirstOrDefault_branch(async)); + + public override Task Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(bool async) + => AssertCantTrackOwned(() => base.Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(async)); + + private async Task AssertCantTrackOwned(Func test) + { + var message = (await Assert.ThrowsAsync(test)).Message; + + Assert.Equal(CoreStrings.OwnedEntitiesCannotBeTrackedWithoutTheirOwner, message); + AssertSql(); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedTableSplittingNoTrackingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedTableSplittingNoTrackingProjectionJetTest.cs new file mode 100644 index 00000000..56967020 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedTableSplittingNoTrackingProjectionJetTest.cs @@ -0,0 +1,281 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +public class OwnedTableSplittingNoTrackingProjectionJetTest + : OwnedTableSplittingNoTrackingProjectionRelationalTestBase +{ + public OwnedTableSplittingNoTrackingProjectionJetTest(OwnedTableSplittingRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Select_trunk_collection(bool async) + { + await base.Select_trunk_collection(async); + + AssertSql( + """ +SELECT `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s0`.`RelationshipsTrunkEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s0`.`RelationshipsTrunkEntityId11`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`Name1`, `s0`.`Name2`, `s0`.`Name3`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s0`.`Id11`, `s0`.`Name4`, `s0`.`Name5`, `s0`.`Name6`, `s0`.`Name7`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `s0`.`Id12`, `s0`.`Name8`, `s0`.`Name9`, `s0`.`Name10` +FROM `RootEntities` AS `r` +LEFT JOIN ( + SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId0`, `r4`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId10`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId11`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name` AS `Name3`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `r11`.`Id1` AS `Id11`, `r11`.`Name` AS `Name4`, `r2`.`Name` AS `Name5`, `r3`.`Name` AS `Name6`, `r4`.`Name` AS `Name7`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `r12`.`Id1` AS `Id12`, `r12`.`Name` AS `Name8`, `r5`.`Name` AS `Name9`, `r6`.`Name` AS `Name10` + FROM ((((((((`Root_CollectionTrunk` AS `r0` + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `r1`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_OptionalRef3DABF2A6` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_RequiredRefEAD29521` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `r4`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_OptionalRef6DAA31E7` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`RelationshipsTrunkEntityId1` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_RequiredRefF4CAB043` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`RelationshipsTrunkEntityId1` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN ( + SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`RelationshipsTrunkEntityId1`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` + FROM ((`Root_CollectionTrunk_CollectionBranch` AS `r7` + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf` AS `r8` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`RelationshipsTrunkEntityId1` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r7`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf` AS `r9` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`RelationshipsTrunkEntityId1` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r7`.`Id1` = `r9`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_CollectionLeaf` AS `r10` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`RelationshipsTrunkEntityId1` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r7`.`Id1` = `r10`.`RelationshipsBranchEntityId1` + ) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `s`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf` AS `r11` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r12` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`RelationshipsTrunkEntityId1` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` +) AS `s0` ON `r`.`Id` = `s0`.`RelationshipsRootEntityId` +ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s0`.`RelationshipsTrunkEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s0`.`RelationshipsTrunkEntityId11`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15` +"""); + } + + public override async Task Select_branch_required_collection(bool async) + { + await base.Select_branch_required_collection(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2` +FROM (`RootEntities` AS `r` +LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN ( + SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r3`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r4`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r4`.`Id1` AS `Id10`, `r4`.`Name` AS `Name0`, `r2`.`Name` AS `Name1`, `r3`.`Name` AS `Name2` + FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r1` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r3`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r4`.`RelationshipsBranchEntityId1` +) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11` +"""); + } + + public override async Task Select_branch_optional_collection(bool async) + { + await base.Select_branch_optional_collection(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2` +FROM (`RootEntities` AS `r` +LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN ( + SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r3`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r4`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r4`.`Id1` AS `Id10`, `r4`.`Name` AS `Name0`, `r2`.`Name` AS `Name1`, `r3`.`Name` AS `Name2` + FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r1` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r3`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r4`.`RelationshipsBranchEntityId1` +) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11` +"""); + } + + public override async Task Select_multiple_branch_leaf(bool async) + { + await base.Select_multiple_branch_leaf(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Name`, `r0`.`RelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`Id1`, `r4`.`Name`, `r2`.`Name`, `r3`.`Name`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`Id1`, `r5`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2` +FROM ((((((`RootEntities` AS `r` +LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti0541F6F6` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ72457FE0` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r5` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r6`.`Id1`, `r6`.`Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`RelationshipsBranchEntityId1`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r8`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r9`.`Id1` AS `Id10`, `r9`.`Name` AS `Name0`, `r7`.`Name` AS `Name1`, `r8`.`Name` AS `Name2` + FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r6` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r7` ON `r6`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r6`.`Id1` = `r7`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r8` ON `r6`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r6`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r9` ON `r6`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r6`.`Id1` = `r9`.`RelationshipsBranchEntityId1` +) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`Id1`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`Id1`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11` +"""); + } + + public override async Task Select_subquery_root_set_trunk_FirstOrDefault_collection(bool async) + { + await base.Select_subquery_root_set_trunk_FirstOrDefault_collection(async); + + AssertSql( + """ +SELECT [r].[Id], [s].[Id], [s].[RelationshipsRootEntityId], [s0].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[Id1], [s0].[Name], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[RelationshipsBranchEntityId1], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s0].[RelationshipsBranchEntityId10], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s0].[RelationshipsBranchEntityId11], [s0].[Id10], [s0].[Name0], [s0].[Name1], [s0].[Name2], [s].[c] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) 1 AS [c], [r0].[Id], [r1].[RelationshipsRootEntityId] + FROM [RootEntities] AS [r0] + LEFT JOIN [Root_RequiredReferenceTrunk] AS [r1] ON [r0].[Id] = [r1].[RelationshipsRootEntityId] + ORDER BY [r0].[Id] +) AS [s] +LEFT JOIN ( + SELECT [r2].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r2].[Id1], [r2].[Name], [r3].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r3].[RelationshipsBranchEntityId1], [r4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r4].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId10], [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [r5].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId11], [r5].[Id1] AS [Id10], [r5].[Name] AS [Name0], [r3].[Name] AS [Name1], [r4].[Name] AS [Name2] + FROM [Root_RequiredReferenceTrunk_CollectionBranch] AS [r2] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf] AS [r3] ON [r2].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r3].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r2].[Id1] = [r3].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf] AS [r4] ON [r2].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r2].[Id1] = [r4].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf] AS [r5] ON [r2].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r2].[Id1] = [r5].[RelationshipsBranchEntityId1] +) AS [s0] ON [s].[RelationshipsRootEntityId] = [s0].[RelationshipsTrunkEntityRelationshipsRootEntityId] +ORDER BY [r].[Id], [s].[Id], [s].[RelationshipsRootEntityId], [s0].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[Id1], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[RelationshipsBranchEntityId1], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s0].[RelationshipsBranchEntityId10], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s0].[RelationshipsBranchEntityId11] +"""); + } + + public override async Task Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(bool async) + { + await base.Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(async); + + AssertSql( + """ +SELECT [r].[Id], [r0].[RelationshipsRootEntityId], [r1].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s].[Id], [s].[RelationshipsRootEntityId], [s].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s].[RelationshipsTrunkEntityRelationshipsRootEntityId0], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId2], [s0].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[Id1], [s0].[Name], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[RelationshipsBranchEntityId1], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s0].[RelationshipsBranchEntityId10], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s0].[RelationshipsBranchEntityId11], [s0].[Id10], [s0].[Name0], [s0].[Name1], [s0].[Name2], [s].[Name], [s1].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s1].[Id1], [s1].[Name], [s1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s1].[RelationshipsBranchEntityId1], [s1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s1].[RelationshipsBranchEntityId10], [s1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s1].[RelationshipsBranchEntityId11], [s1].[Id10], [s1].[Name0], [s1].[Name1], [s1].[Name2], [s].[Name0], [r18].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r18].[Id1], [r18].[Name], [s].[Name1], [s].[Name2], [s].[Name3], [r19].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r19].[Id1], [r19].[Name], [s].[Name4], [s].[Name5], [r20].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r20].[Id1], [r20].[Name], [s].[Name6], [s].[c] +FROM [RootEntities] AS [r] +LEFT JOIN [Root_RequiredReferenceTrunk] AS [r0] ON [r].[Id] = [r0].[RelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch] AS [r1] ON [r0].[RelationshipsRootEntityId] = [r1].[RelationshipsTrunkEntityRelationshipsRootEntityId] +OUTER APPLY ( + SELECT TOP(1) [r3].[RelationshipsRootEntityId], [r3].[Name], [r4].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r4].[Name] AS [Name0], [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r5].[Name] AS [Name1], [r6].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r6].[Name] AS [Name2], [r7].[RelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsTrunkEntityRelationshipsRootEntityId0], [r7].[Name] AS [Name3], [r8].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [r8].[Name] AS [Name4], [r9].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId2], [r9].[Name] AS [Name5], [r1].[Name] AS [Name6], 1 AS [c], [r2].[Id] + FROM [RootEntities] AS [r2] + LEFT JOIN [Root_RequiredReferenceTrunk] AS [r3] ON [r2].[Id] = [r3].[RelationshipsRootEntityId] + LEFT JOIN [Root_RequiredReferenceTrunk_OptionalReferenceBranch] AS [r4] ON [r3].[RelationshipsRootEntityId] = [r4].[RelationshipsTrunkEntityRelationshipsRootEntityId] + LEFT JOIN [Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf] AS [r5] ON [r4].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] + LEFT JOIN [Root_RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf] AS [r6] ON [r4].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r6].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] + LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch] AS [r7] ON [r3].[RelationshipsRootEntityId] = [r7].[RelationshipsTrunkEntityRelationshipsRootEntityId] + LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf] AS [r8] ON [r7].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r8].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] + LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf] AS [r9] ON [r7].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r9].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] + ORDER BY [r2].[Id] +) AS [s] +LEFT JOIN ( + SELECT [r10].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r10].[Id1], [r10].[Name], [r11].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r11].[RelationshipsBranchEntityId1], [r12].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r12].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId10], [r13].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [r13].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId11], [r13].[Id1] AS [Id10], [r13].[Name] AS [Name0], [r11].[Name] AS [Name1], [r12].[Name] AS [Name2] + FROM [Root_RequiredReferenceTrunk_CollectionBranch] AS [r10] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf] AS [r11] ON [r10].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r11].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r10].[Id1] = [r11].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf] AS [r12] ON [r10].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r12].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r10].[Id1] = [r12].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf] AS [r13] ON [r10].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r13].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r10].[Id1] = [r13].[RelationshipsBranchEntityId1] +) AS [s0] ON [r0].[RelationshipsRootEntityId] = [s0].[RelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN ( + SELECT [r14].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r14].[Id1], [r14].[Name], [r15].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r15].[RelationshipsBranchEntityId1], [r16].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r16].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId10], [r17].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [r17].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId11], [r17].[Id1] AS [Id10], [r17].[Name] AS [Name0], [r15].[Name] AS [Name1], [r16].[Name] AS [Name2] + FROM [Root_RequiredReferenceTrunk_CollectionBranch] AS [r14] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf] AS [r15] ON [r14].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r15].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r14].[Id1] = [r15].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf] AS [r16] ON [r14].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r16].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r14].[Id1] = [r16].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf] AS [r17] ON [r14].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r17].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r14].[Id1] = [r17].[RelationshipsBranchEntityId1] +) AS [s1] ON [s].[RelationshipsRootEntityId] = [s1].[RelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf] AS [r18] ON [s].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r18].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf] AS [r19] ON [s].[RelationshipsTrunkEntityRelationshipsRootEntityId0] = [r19].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf] AS [r20] ON [s].[RelationshipsTrunkEntityRelationshipsRootEntityId0] = [r20].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +ORDER BY [r].[Id], [r0].[RelationshipsRootEntityId], [r1].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s].[Id], [s].[RelationshipsRootEntityId], [s].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s].[RelationshipsTrunkEntityRelationshipsRootEntityId0], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId2], [s0].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[Id1], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[RelationshipsBranchEntityId1], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s0].[RelationshipsBranchEntityId10], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s0].[RelationshipsBranchEntityId11], [s0].[Id10], [s1].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s1].[Id1], [s1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s1].[RelationshipsBranchEntityId1], [s1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s1].[RelationshipsBranchEntityId10], [s1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s1].[RelationshipsBranchEntityId11], [s1].[Id10], [r18].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r18].[Id1], [r19].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r19].[Id1], [r20].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +"""); + } + + public override async Task Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(bool async) + { + await base.Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(async); + + AssertSql( + """ +SELECT [r].[Id], [r0].[RelationshipsRootEntityId], [r6].[Id], [s].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s].[Id1], [s].[Name], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityId1], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s].[RelationshipsBranchEntityId10], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s].[RelationshipsBranchEntityId11], [s].[Id10], [s].[Name0], [s].[Name1], [s].[Name2], [r6].[c] +FROM [RootEntities] AS [r] +LEFT JOIN [Root_RequiredReferenceTrunk] AS [r0] ON [r].[Id] = [r0].[RelationshipsRootEntityId] +OUTER APPLY ( + SELECT TOP(1) 1 AS [c], [r1].[Id] + FROM [RootEntities] AS [r1] + ORDER BY [r1].[Id] +) AS [r6] +LEFT JOIN ( + SELECT [r2].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r2].[Id1], [r2].[Name], [r3].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r3].[RelationshipsBranchEntityId1], [r4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r4].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId10], [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [r5].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId11], [r5].[Id1] AS [Id10], [r5].[Name] AS [Name0], [r3].[Name] AS [Name1], [r4].[Name] AS [Name2] + FROM [Root_RequiredReferenceTrunk_CollectionBranch] AS [r2] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf] AS [r3] ON [r2].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r3].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r2].[Id1] = [r3].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf] AS [r4] ON [r2].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r2].[Id1] = [r4].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf] AS [r5] ON [r2].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r2].[Id1] = [r5].[RelationshipsBranchEntityId1] +) AS [s] ON [r0].[RelationshipsRootEntityId] = [s].[RelationshipsTrunkEntityRelationshipsRootEntityId] +ORDER BY [r].[Id], [r0].[RelationshipsRootEntityId], [r6].[Id], [s].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s].[Id1], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityId1], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s].[RelationshipsBranchEntityId10], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s].[RelationshipsBranchEntityId11] +"""); + } + + public override async Task SelectMany_trunk_collection(bool async) + { + await base.SelectMany_trunk_collection(async); + + AssertSql( + """ +SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r4`.`RelationshipsTrunkEntityId1`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r11`.`Id1`, `r11`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r12`.`Id1`, `r12`.`Name`, `r5`.`Name`, `r6`.`Name` +FROM (((((((((`RootEntities` AS `r` +INNER JOIN `Root_CollectionTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `r1`.`RelationshipsTrunkEntityId1`) +LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_OptionalRef3DABF2A6` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) +LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_RequiredRefEAD29521` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) +LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `r4`.`RelationshipsTrunkEntityId1`) +LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_OptionalRef6DAA31E7` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`RelationshipsTrunkEntityId1` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) +LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_RequiredRefF4CAB043` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`RelationshipsTrunkEntityId1` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) +LEFT JOIN ( + SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`RelationshipsTrunkEntityId1`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` + FROM ((`Root_CollectionTrunk_CollectionBranch` AS `r7` + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf` AS `r8` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`RelationshipsTrunkEntityId1` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r7`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf` AS `r9` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`RelationshipsTrunkEntityId1` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r7`.`Id1` = `r9`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_CollectionLeaf` AS `r10` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`RelationshipsTrunkEntityId1` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r7`.`Id1` = `r10`.`RelationshipsBranchEntityId1` +) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `s`.`RelationshipsTrunkEntityId1`) +LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf` AS `r11` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) +LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r12` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`RelationshipsTrunkEntityId1` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r4`.`RelationshipsTrunkEntityId1`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` +"""); + } + + public override async Task SelectMany_required_trunk_reference_branch_collection(bool async) + { + await base.SelectMany_required_trunk_reference_branch_collection(async); + + AssertSql( + """ +SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Id1`, `r1`.`Name`, `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityId1`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityId1`, `r4`.`Id1`, `r4`.`Name`, `r2`.`Name`, `r3`.`Name` +FROM ((((`RootEntities` AS `r` +LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1`) +LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r3`.`RelationshipsBranchEntityId1`) +LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r4`.`RelationshipsBranchEntityId1` +WHERE `r0`.`RelationshipsRootEntityId` IS NOT NULL AND `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` IS NOT NULL +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Id1`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityId1`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityId1` +"""); + } + + public override async Task SelectMany_optional_trunk_reference_branch_collection(bool async) + { + await base.SelectMany_optional_trunk_reference_branch_collection(async); + + AssertSql( + """ +SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Id1`, `r1`.`Name`, `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityId1`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityId1`, `r4`.`Id1`, `r4`.`Name`, `r2`.`Name`, `r3`.`Name` +FROM ((((`RootEntities` AS `r` +LEFT JOIN `Root_OptionalReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRefCCD936D2` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1`) +LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefF60F036D` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r3`.`RelationshipsBranchEntityId1`) +LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r4`.`RelationshipsBranchEntityId1` +WHERE `r0`.`RelationshipsRootEntityId` IS NOT NULL AND `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` IS NOT NULL +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Id1`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityId1`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityId1` +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedTableSplittingReferenceProjectionNoTrackingJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedTableSplittingReferenceProjectionNoTrackingJetTest.cs new file mode 100644 index 00000000..dcfaf877 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedTableSplittingReferenceProjectionNoTrackingJetTest.cs @@ -0,0 +1,507 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Relationships.Projection; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection; + +public class OwnedTableSplittingReferenceProjectionNoTrackingJetTest + : OwnedTableSplittingReferenceProjectionNoTrackingRelationalTestBase +{ + public OwnedTableSplittingReferenceProjectionNoTrackingJetTest(OwnedTableSplittingRelationshipsJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Select_root(bool async) + { + await base.Select_root(async); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`RelationshipsRootEntityId`, `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s0`.`RelationshipsTrunkEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s0`.`RelationshipsTrunkEntityId11`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`Name1`, `s0`.`Name2`, `s0`.`Name3`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s0`.`Id11`, `s0`.`Name4`, `s0`.`Name5`, `s0`.`Name6`, `s0`.`Name7`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `s0`.`Id12`, `s0`.`Name8`, `s0`.`Name9`, `s0`.`Name10`, `r0`.`Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s1`.`RelationshipsBranchEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s1`.`RelationshipsBranchEntityId11`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`Name1`, `s1`.`Name2`, `r1`.`Name`, `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r31`.`Id1`, `r31`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r32`.`Id1`, `r32`.`Name`, `r5`.`Name`, `r6`.`Name`, `r7`.`Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s2`.`RelationshipsBranchEntityId10`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s2`.`RelationshipsBranchEntityId11`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`Name1`, `s2`.`Name2`, `r8`.`Name`, `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r37`.`Id1`, `r37`.`Name`, `r9`.`Name`, `r10`.`Name`, `r11`.`Name`, `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r38`.`Id1`, `r38`.`Name`, `r12`.`Name`, `r13`.`Name` +FROM ((((((((((((((((((((`RootEntities` AS `r` +LEFT JOIN `Root_OptionalReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Opti4796B722` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Requ4EDDE18D` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Opti0EF40F72` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_RequFA89F212` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk` AS `r7` ON `r`.`Id` = `r7`.`RelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch` AS `r8` ON `r7`.`RelationshipsRootEntityId` = `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptiC2882DFA` AS `r9` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ6B3E679F` AS `r10` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch` AS `r11` ON `r7`.`RelationshipsRootEntityId` = `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti0541F6F6` AS `r12` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ72457FE0` AS `r13` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r14`.`RelationshipsRootEntityId`, `r14`.`Id1`, `r14`.`Name`, `r15`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r15`.`RelationshipsTrunkEntityId1`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId0`, `r18`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId10`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId11`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`Name1`, `s`.`Name2`, `r15`.`Name` AS `Name3`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `r25`.`Id1` AS `Id11`, `r25`.`Name` AS `Name4`, `r16`.`Name` AS `Name5`, `r17`.`Name` AS `Name6`, `r18`.`Name` AS `Name7`, `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `r26`.`Id1` AS `Id12`, `r26`.`Name` AS `Name8`, `r19`.`Name` AS `Name9`, `r20`.`Name` AS `Name10` + FROM ((((((((`Root_CollectionTrunk` AS `r14` + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch` AS `r15` ON `r14`.`RelationshipsRootEntityId` = `r15`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r14`.`Id1` = `r15`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_OptionalRef3DABF2A6` AS `r16` ON `r15`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r15`.`RelationshipsTrunkEntityId1` = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_RequiredRefEAD29521` AS `r17` ON `r15`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r15`.`RelationshipsTrunkEntityId1` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch` AS `r18` ON `r14`.`RelationshipsRootEntityId` = `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r14`.`Id1` = `r18`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_OptionalRef6DAA31E7` AS `r19` ON `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r18`.`RelationshipsTrunkEntityId1` = `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_RequiredRefF4CAB043` AS `r20` ON `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r18`.`RelationshipsTrunkEntityId1` = `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN ( + SELECT `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r21`.`RelationshipsTrunkEntityId1`, `r21`.`Id1`, `r21`.`Name`, `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r22`.`RelationshipsBranchEntityId1`, `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r23`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r24`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r24`.`Id1` AS `Id10`, `r24`.`Name` AS `Name0`, `r22`.`Name` AS `Name1`, `r23`.`Name` AS `Name2` + FROM ((`Root_CollectionTrunk_CollectionBranch` AS `r21` + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf` AS `r22` ON `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r21`.`RelationshipsTrunkEntityId1` = `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r21`.`Id1` = `r22`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf` AS `r23` ON `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r21`.`RelationshipsTrunkEntityId1` = `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r21`.`Id1` = `r23`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_CollectionLeaf` AS `r24` ON `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r21`.`RelationshipsTrunkEntityId1` = `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r21`.`Id1` = `r24`.`RelationshipsBranchEntityId1` + ) AS `s` ON `r14`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r14`.`Id1` = `s`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf` AS `r25` ON `r15`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r15`.`RelationshipsTrunkEntityId1` = `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r26` ON `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r18`.`RelationshipsTrunkEntityId1` = `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` +) AS `s0` ON `r`.`Id` = `s0`.`RelationshipsRootEntityId`) +LEFT JOIN ( + SELECT `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r27`.`Id1`, `r27`.`Name`, `r28`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r28`.`RelationshipsBranchEntityId1`, `r29`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r29`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r30`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r30`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r30`.`Id1` AS `Id10`, `r30`.`Name` AS `Name0`, `r28`.`Name` AS `Name1`, `r29`.`Name` AS `Name2` + FROM ((`Root_OptionalReferenceTrunk_CollectionBranch` AS `r27` + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRefCCD936D2` AS `r28` ON `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r28`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r27`.`Id1` = `r28`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefF60F036D` AS `r29` ON `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r29`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r27`.`Id1` = `r29`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r30` ON `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r30`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r27`.`Id1` = `r30`.`RelationshipsBranchEntityId1` +) AS `s1` ON `r0`.`RelationshipsRootEntityId` = `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Coll36EF62D9` AS `r31` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB02F0DA8` AS `r32` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r33`.`Id1`, `r33`.`Name`, `r34`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r34`.`RelationshipsBranchEntityId1`, `r35`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r35`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r36`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r36`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r36`.`Id1` AS `Id10`, `r36`.`Name` AS `Name0`, `r34`.`Name` AS `Name1`, `r35`.`Name` AS `Name2` + FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r33` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r34` ON `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r34`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r33`.`Id1` = `r34`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r35` ON `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r35`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r33`.`Id1` = `r35`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r36` ON `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r36`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r33`.`Id1` = `r36`.`RelationshipsBranchEntityId1` +) AS `s2` ON `r7`.`RelationshipsRootEntityId` = `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll225D701E` AS `r37` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r38` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`RelationshipsRootEntityId`, `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s0`.`RelationshipsTrunkEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s0`.`RelationshipsTrunkEntityId11`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `s0`.`Id12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s1`.`RelationshipsBranchEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s1`.`RelationshipsBranchEntityId11`, `s1`.`Id10`, `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r31`.`Id1`, `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r32`.`Id1`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s2`.`RelationshipsBranchEntityId10`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s2`.`RelationshipsBranchEntityId11`, `s2`.`Id10`, `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r37`.`Id1`, `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_trunk_optional(bool async) + { + await base.Select_trunk_optional(async); + + AssertSql( + """ +SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r5`.`Name`, `r6`.`Name` +FROM (((((((((`RootEntities` AS `r` +LEFT JOIN `Root_OptionalReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Opti4796B722` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Requ4EDDE18D` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Opti0EF40F72` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_RequFA89F212` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` + FROM ((`Root_OptionalReferenceTrunk_CollectionBranch` AS `r7` + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRefCCD936D2` AS `r8` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefF60F036D` AS `r9` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r9`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r10` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r10`.`RelationshipsBranchEntityId1` +) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Coll36EF62D9` AS `r11` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB02F0DA8` AS `r12` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_trunk_required(bool async) + { + await base.Select_trunk_required(async); + + AssertSql( + """ +SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r5`.`Name`, `r6`.`Name` +FROM (((((((((`RootEntities` AS `r` +LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptiC2882DFA` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ6B3E679F` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti0541F6F6` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ72457FE0` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` + FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r7` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r8` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r9` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r9`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r10` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r10`.`RelationshipsBranchEntityId1` +) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll225D701E` AS `r11` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r12` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_branch_required_required(bool async) + { + await base.Select_branch_required_required(async); + + AssertSql( + """ +SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Name`, `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`Id1`, `r4`.`Name`, `r2`.`Name`, `r3`.`Name` +FROM ((((`RootEntities` AS `r` +LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti0541F6F6` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ72457FE0` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_branch_required_optional(bool async) + { + await base.Select_branch_required_optional(async); + + AssertSql( + """ +SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Name`, `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`Id1`, `r4`.`Name`, `r2`.`Name`, `r3`.`Name` +FROM ((((`RootEntities` AS `r` +LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptiC2882DFA` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ6B3E679F` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll225D701E` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_branch_optional_required(bool async) + { + await base.Select_branch_optional_required(async); + + AssertSql( + """ +SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Name`, `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`Id1`, `r4`.`Name`, `r2`.`Name`, `r3`.`Name` +FROM ((((`RootEntities` AS `r` +LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti0541F6F6` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ72457FE0` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_branch_optional_optional(bool async) + { + await base.Select_branch_optional_optional(async); + + AssertSql( + """ +SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Name`, `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`Id1`, `r4`.`Name`, `r2`.`Name`, `r3`.`Name` +FROM ((((`RootEntities` AS `r` +LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptiC2882DFA` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ6B3E679F` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll225D701E` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_root_duplicated(bool async) + { + await base.Select_root_duplicated(async); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[OptionalReferenceTrunkId], [r].[RequiredReferenceTrunkId], [r0].[RelationshipsRootEntityId], [r1].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r2].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r3].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r4].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r6].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r7].[RelationshipsRootEntityId], [r8].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r9].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r10].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r11].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r12].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r13].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[RelationshipsRootEntityId], [s0].[Id1], [s0].[Name], [s0].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[RelationshipsTrunkEntityId1], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId1], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId10], [s0].[RelationshipsTrunkEntityRelationshipsRootEntityId0], [s0].[RelationshipsTrunkEntityId10], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId11], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId2], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId12], [s0].[RelationshipsTrunkEntityRelationshipsRootEntityId1], [s0].[RelationshipsTrunkEntityId11], [s0].[Id10], [s0].[Name0], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId3], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId13], [s0].[RelationshipsBranchEntityId1], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId00], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId100], [s0].[RelationshipsBranchEntityId10], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId10], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId110], [s0].[RelationshipsBranchEntityId11], [s0].[Id100], [s0].[Name00], [s0].[Name1], [s0].[Name2], [s0].[Name3], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId4], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId14], [s0].[Id11], [s0].[Name4], [s0].[Name5], [s0].[Name6], [s0].[Name7], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId5], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId15], [s0].[Id12], [s0].[Name8], [s0].[Name9], [s0].[Name10], [r0].[Name], [s1].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s1].[Id1], [s1].[Name], [s1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s1].[RelationshipsBranchEntityId1], [s1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s1].[RelationshipsBranchEntityId10], [s1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s1].[RelationshipsBranchEntityId11], [s1].[Id10], [s1].[Name0], [s1].[Name1], [s1].[Name2], [r1].[Name], [r31].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r31].[Id1], [r31].[Name], [r2].[Name], [r3].[Name], [r4].[Name], [r32].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r32].[Id1], [r32].[Name], [r5].[Name], [r6].[Name], [r7].[Name], [s2].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s2].[Id1], [s2].[Name], [s2].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s2].[RelationshipsBranchEntityId1], [s2].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s2].[RelationshipsBranchEntityId10], [s2].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s2].[RelationshipsBranchEntityId11], [s2].[Id10], [s2].[Name0], [s2].[Name1], [s2].[Name2], [r8].[Name], [r37].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r37].[Id1], [r37].[Name], [r9].[Name], [r10].[Name], [r11].[Name], [r38].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r38].[Id1], [r38].[Name], [r12].[Name], [r13].[Name], [s4].[RelationshipsRootEntityId], [s4].[Id1], [s4].[Name], [s4].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s4].[RelationshipsTrunkEntityId1], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId1], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId10], [s4].[RelationshipsTrunkEntityRelationshipsRootEntityId0], [s4].[RelationshipsTrunkEntityId10], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId11], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId2], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId12], [s4].[RelationshipsTrunkEntityRelationshipsRootEntityId1], [s4].[RelationshipsTrunkEntityId11], [s4].[Id10], [s4].[Name0], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId3], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId13], [s4].[RelationshipsBranchEntityId1], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId00], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId100], [s4].[RelationshipsBranchEntityId10], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId10], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId110], [s4].[RelationshipsBranchEntityId11], [s4].[Id100], [s4].[Name00], [s4].[Name1], [s4].[Name2], [s4].[Name3], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId4], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId14], [s4].[Id11], [s4].[Name4], [s4].[Name5], [s4].[Name6], [s4].[Name7], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId5], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId15], [s4].[Id12], [s4].[Name8], [s4].[Name9], [s4].[Name10], [s5].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s5].[Id1], [s5].[Name], [s5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s5].[RelationshipsBranchEntityId1], [s5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s5].[RelationshipsBranchEntityId10], [s5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s5].[RelationshipsBranchEntityId11], [s5].[Id10], [s5].[Name0], [s5].[Name1], [s5].[Name2], [r56].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r56].[Id1], [r56].[Name], [r57].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r57].[Id1], [r57].[Name], [s6].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s6].[Id1], [s6].[Name], [s6].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s6].[RelationshipsBranchEntityId1], [s6].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s6].[RelationshipsBranchEntityId10], [s6].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s6].[RelationshipsBranchEntityId11], [s6].[Id10], [s6].[Name0], [s6].[Name1], [s6].[Name2], [r62].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r62].[Id1], [r62].[Name], [r63].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r63].[Id1], [r63].[Name] +FROM [RootEntities] AS [r] +LEFT JOIN [Root_OptionalReferenceTrunk] AS [r0] ON [r].[Id] = [r0].[RelationshipsRootEntityId] +LEFT JOIN [Root_OptionalReferenceTrunk_OptionalReferenceBranch] AS [r1] ON [r0].[RelationshipsRootEntityId] = [r1].[RelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf] AS [r2] ON [r1].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r2].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf] AS [r3] ON [r1].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r3].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_OptionalReferenceTrunk_RequiredReferenceBranch] AS [r4] ON [r0].[RelationshipsRootEntityId] = [r4].[RelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf] AS [r5] ON [r4].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf] AS [r6] ON [r4].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r6].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk] AS [r7] ON [r].[Id] = [r7].[RelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_OptionalReferenceBranch] AS [r8] ON [r7].[RelationshipsRootEntityId] = [r8].[RelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf] AS [r9] ON [r8].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r9].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf] AS [r10] ON [r8].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r10].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch] AS [r11] ON [r7].[RelationshipsRootEntityId] = [r11].[RelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf] AS [r12] ON [r11].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r12].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf] AS [r13] ON [r11].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r13].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN ( + SELECT [r14].[RelationshipsRootEntityId], [r14].[Id1], [r14].[Name], [r15].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r15].[RelationshipsTrunkEntityId1], [r16].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r16].[RelationshipsBranchEntityRelationshipsTrunkEntityId1], [r17].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r17].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId10], [r18].[RelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsTrunkEntityRelationshipsRootEntityId0], [r18].[RelationshipsTrunkEntityId1] AS [RelationshipsTrunkEntityId10], [r19].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [r19].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId11], [r20].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId2], [r20].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId12], [s].[RelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsTrunkEntityRelationshipsRootEntityId1], [s].[RelationshipsTrunkEntityId1] AS [RelationshipsTrunkEntityId11], [s].[Id1] AS [Id10], [s].[Name] AS [Name0], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId3], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId13], [s].[RelationshipsBranchEntityId1], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId00], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityId10] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId100], [s].[RelationshipsBranchEntityId10], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId10], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityId11] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId110], [s].[RelationshipsBranchEntityId11], [s].[Id10] AS [Id100], [s].[Name0] AS [Name00], [s].[Name1], [s].[Name2], [r15].[Name] AS [Name3], [r25].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId4], [r25].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId14], [r25].[Id1] AS [Id11], [r25].[Name] AS [Name4], [r16].[Name] AS [Name5], [r17].[Name] AS [Name6], [r18].[Name] AS [Name7], [r26].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId5], [r26].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId15], [r26].[Id1] AS [Id12], [r26].[Name] AS [Name8], [r19].[Name] AS [Name9], [r20].[Name] AS [Name10] + FROM [Root_CollectionTrunk] AS [r14] + LEFT JOIN [Root_CollectionTrunk_OptionalReferenceBranch] AS [r15] ON [r14].[RelationshipsRootEntityId] = [r15].[RelationshipsTrunkEntityRelationshipsRootEntityId] AND [r14].[Id1] = [r15].[RelationshipsTrunkEntityId1] + LEFT JOIN [Root_CollectionTrunk_OptionalReferenceBranch_OptionalReferenceLeaf] AS [r16] ON [r15].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r16].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r15].[RelationshipsTrunkEntityId1] = [r16].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] + LEFT JOIN [Root_CollectionTrunk_OptionalReferenceBranch_RequiredReferenceLeaf] AS [r17] ON [r15].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r17].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r15].[RelationshipsTrunkEntityId1] = [r17].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] + LEFT JOIN [Root_CollectionTrunk_RequiredReferenceBranch] AS [r18] ON [r14].[RelationshipsRootEntityId] = [r18].[RelationshipsTrunkEntityRelationshipsRootEntityId] AND [r14].[Id1] = [r18].[RelationshipsTrunkEntityId1] + LEFT JOIN [Root_CollectionTrunk_RequiredReferenceBranch_OptionalReferenceLeaf] AS [r19] ON [r18].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r19].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r18].[RelationshipsTrunkEntityId1] = [r19].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] + LEFT JOIN [Root_CollectionTrunk_RequiredReferenceBranch_RequiredReferenceLeaf] AS [r20] ON [r18].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r20].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r18].[RelationshipsTrunkEntityId1] = [r20].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] + LEFT JOIN ( + SELECT [r21].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r21].[RelationshipsTrunkEntityId1], [r21].[Id1], [r21].[Name], [r22].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r22].[RelationshipsBranchEntityRelationshipsTrunkEntityId1], [r22].[RelationshipsBranchEntityId1], [r23].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r23].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId10], [r23].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId10], [r24].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [r24].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId11], [r24].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId11], [r24].[Id1] AS [Id10], [r24].[Name] AS [Name0], [r22].[Name] AS [Name1], [r23].[Name] AS [Name2] + FROM [Root_CollectionTrunk_CollectionBranch] AS [r21] + LEFT JOIN [Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf] AS [r22] ON [r21].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r22].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r21].[RelationshipsTrunkEntityId1] = [r22].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AND [r21].[Id1] = [r22].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf] AS [r23] ON [r21].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r23].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r21].[RelationshipsTrunkEntityId1] = [r23].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AND [r21].[Id1] = [r23].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_CollectionTrunk_CollectionBranch_CollectionLeaf] AS [r24] ON [r21].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r24].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r21].[RelationshipsTrunkEntityId1] = [r24].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AND [r21].[Id1] = [r24].[RelationshipsBranchEntityId1] + ) AS [s] ON [r14].[RelationshipsRootEntityId] = [s].[RelationshipsTrunkEntityRelationshipsRootEntityId] AND [r14].[Id1] = [s].[RelationshipsTrunkEntityId1] + LEFT JOIN [Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf] AS [r25] ON [r15].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r25].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r15].[RelationshipsTrunkEntityId1] = [r25].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] + LEFT JOIN [Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf] AS [r26] ON [r18].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r26].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r18].[RelationshipsTrunkEntityId1] = [r26].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] +) AS [s0] ON [r].[Id] = [s0].[RelationshipsRootEntityId] +LEFT JOIN ( + SELECT [r27].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r27].[Id1], [r27].[Name], [r28].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r28].[RelationshipsBranchEntityId1], [r29].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r29].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId10], [r30].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [r30].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId11], [r30].[Id1] AS [Id10], [r30].[Name] AS [Name0], [r28].[Name] AS [Name1], [r29].[Name] AS [Name2] + FROM [Root_OptionalReferenceTrunk_CollectionBranch] AS [r27] + LEFT JOIN [Root_OptionalReferenceTrunk_CollectionBranch_OptionalReferenceLeaf] AS [r28] ON [r27].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r28].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r27].[Id1] = [r28].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_OptionalReferenceTrunk_CollectionBranch_RequiredReferenceLeaf] AS [r29] ON [r27].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r29].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r27].[Id1] = [r29].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf] AS [r30] ON [r27].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r30].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r27].[Id1] = [r30].[RelationshipsBranchEntityId1] +) AS [s1] ON [r0].[RelationshipsRootEntityId] = [s1].[RelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollectionLeaf] AS [r31] ON [r1].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r31].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollectionLeaf] AS [r32] ON [r4].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r32].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN ( + SELECT [r33].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r33].[Id1], [r33].[Name], [r34].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r34].[RelationshipsBranchEntityId1], [r35].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r35].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId10], [r36].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [r36].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId11], [r36].[Id1] AS [Id10], [r36].[Name] AS [Name0], [r34].[Name] AS [Name1], [r35].[Name] AS [Name2] + FROM [Root_RequiredReferenceTrunk_CollectionBranch] AS [r33] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf] AS [r34] ON [r33].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r34].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r33].[Id1] = [r34].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf] AS [r35] ON [r33].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r35].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r33].[Id1] = [r35].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf] AS [r36] ON [r33].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r36].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r33].[Id1] = [r36].[RelationshipsBranchEntityId1] +) AS [s2] ON [r7].[RelationshipsRootEntityId] = [s2].[RelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf] AS [r37] ON [r8].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r37].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf] AS [r38] ON [r11].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r38].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN ( + SELECT [r39].[RelationshipsRootEntityId], [r39].[Id1], [r39].[Name], [r40].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r40].[RelationshipsTrunkEntityId1], [r41].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r41].[RelationshipsBranchEntityRelationshipsTrunkEntityId1], [r42].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r42].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId10], [r43].[RelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsTrunkEntityRelationshipsRootEntityId0], [r43].[RelationshipsTrunkEntityId1] AS [RelationshipsTrunkEntityId10], [r44].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [r44].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId11], [r45].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId2], [r45].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId12], [s3].[RelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsTrunkEntityRelationshipsRootEntityId1], [s3].[RelationshipsTrunkEntityId1] AS [RelationshipsTrunkEntityId11], [s3].[Id1] AS [Id10], [s3].[Name] AS [Name0], [s3].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId3], [s3].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId13], [s3].[RelationshipsBranchEntityId1], [s3].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId00], [s3].[RelationshipsBranchEntityRelationshipsTrunkEntityId10] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId100], [s3].[RelationshipsBranchEntityId10], [s3].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId10], [s3].[RelationshipsBranchEntityRelationshipsTrunkEntityId11] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId110], [s3].[RelationshipsBranchEntityId11], [s3].[Id10] AS [Id100], [s3].[Name0] AS [Name00], [s3].[Name1], [s3].[Name2], [r40].[Name] AS [Name3], [r50].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId4], [r50].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId14], [r50].[Id1] AS [Id11], [r50].[Name] AS [Name4], [r41].[Name] AS [Name5], [r42].[Name] AS [Name6], [r43].[Name] AS [Name7], [r51].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId5], [r51].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId15], [r51].[Id1] AS [Id12], [r51].[Name] AS [Name8], [r44].[Name] AS [Name9], [r45].[Name] AS [Name10] + FROM [Root_CollectionTrunk] AS [r39] + LEFT JOIN [Root_CollectionTrunk_OptionalReferenceBranch] AS [r40] ON [r39].[RelationshipsRootEntityId] = [r40].[RelationshipsTrunkEntityRelationshipsRootEntityId] AND [r39].[Id1] = [r40].[RelationshipsTrunkEntityId1] + LEFT JOIN [Root_CollectionTrunk_OptionalReferenceBranch_OptionalReferenceLeaf] AS [r41] ON [r40].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r41].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r40].[RelationshipsTrunkEntityId1] = [r41].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] + LEFT JOIN [Root_CollectionTrunk_OptionalReferenceBranch_RequiredReferenceLeaf] AS [r42] ON [r40].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r42].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r40].[RelationshipsTrunkEntityId1] = [r42].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] + LEFT JOIN [Root_CollectionTrunk_RequiredReferenceBranch] AS [r43] ON [r39].[RelationshipsRootEntityId] = [r43].[RelationshipsTrunkEntityRelationshipsRootEntityId] AND [r39].[Id1] = [r43].[RelationshipsTrunkEntityId1] + LEFT JOIN [Root_CollectionTrunk_RequiredReferenceBranch_OptionalReferenceLeaf] AS [r44] ON [r43].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r44].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r43].[RelationshipsTrunkEntityId1] = [r44].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] + LEFT JOIN [Root_CollectionTrunk_RequiredReferenceBranch_RequiredReferenceLeaf] AS [r45] ON [r43].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r45].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r43].[RelationshipsTrunkEntityId1] = [r45].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] + LEFT JOIN ( + SELECT [r46].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r46].[RelationshipsTrunkEntityId1], [r46].[Id1], [r46].[Name], [r47].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r47].[RelationshipsBranchEntityRelationshipsTrunkEntityId1], [r47].[RelationshipsBranchEntityId1], [r48].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r48].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId10], [r48].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId10], [r49].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [r49].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AS [RelationshipsBranchEntityRelationshipsTrunkEntityId11], [r49].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId11], [r49].[Id1] AS [Id10], [r49].[Name] AS [Name0], [r47].[Name] AS [Name1], [r48].[Name] AS [Name2] + FROM [Root_CollectionTrunk_CollectionBranch] AS [r46] + LEFT JOIN [Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf] AS [r47] ON [r46].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r47].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r46].[RelationshipsTrunkEntityId1] = [r47].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AND [r46].[Id1] = [r47].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf] AS [r48] ON [r46].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r48].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r46].[RelationshipsTrunkEntityId1] = [r48].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AND [r46].[Id1] = [r48].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_CollectionTrunk_CollectionBranch_CollectionLeaf] AS [r49] ON [r46].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r49].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r46].[RelationshipsTrunkEntityId1] = [r49].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] AND [r46].[Id1] = [r49].[RelationshipsBranchEntityId1] + ) AS [s3] ON [r39].[RelationshipsRootEntityId] = [s3].[RelationshipsTrunkEntityRelationshipsRootEntityId] AND [r39].[Id1] = [s3].[RelationshipsTrunkEntityId1] + LEFT JOIN [Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf] AS [r50] ON [r40].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r50].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r40].[RelationshipsTrunkEntityId1] = [r50].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] + LEFT JOIN [Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf] AS [r51] ON [r43].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r51].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r43].[RelationshipsTrunkEntityId1] = [r51].[RelationshipsBranchEntityRelationshipsTrunkEntityId1] +) AS [s4] ON [r].[Id] = [s4].[RelationshipsRootEntityId] +LEFT JOIN ( + SELECT [r52].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r52].[Id1], [r52].[Name], [r53].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r53].[RelationshipsBranchEntityId1], [r54].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r54].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId10], [r55].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [r55].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId11], [r55].[Id1] AS [Id10], [r55].[Name] AS [Name0], [r53].[Name] AS [Name1], [r54].[Name] AS [Name2] + FROM [Root_OptionalReferenceTrunk_CollectionBranch] AS [r52] + LEFT JOIN [Root_OptionalReferenceTrunk_CollectionBranch_OptionalReferenceLeaf] AS [r53] ON [r52].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r53].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r52].[Id1] = [r53].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_OptionalReferenceTrunk_CollectionBranch_RequiredReferenceLeaf] AS [r54] ON [r52].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r54].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r52].[Id1] = [r54].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf] AS [r55] ON [r52].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r55].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r52].[Id1] = [r55].[RelationshipsBranchEntityId1] +) AS [s5] ON [r0].[RelationshipsRootEntityId] = [s5].[RelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollectionLeaf] AS [r56] ON [r1].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r56].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollectionLeaf] AS [r57] ON [r4].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r57].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN ( + SELECT [r58].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r58].[Id1], [r58].[Name], [r59].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r59].[RelationshipsBranchEntityId1], [r60].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r60].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId10], [r61].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [r61].[RelationshipsBranchEntityId1] AS [RelationshipsBranchEntityId11], [r61].[Id1] AS [Id10], [r61].[Name] AS [Name0], [r59].[Name] AS [Name1], [r60].[Name] AS [Name2] + FROM [Root_RequiredReferenceTrunk_CollectionBranch] AS [r58] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_OptionalReferenceLeaf] AS [r59] ON [r58].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r59].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r58].[Id1] = [r59].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_RequiredReferenceLeaf] AS [r60] ON [r58].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r60].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r58].[Id1] = [r60].[RelationshipsBranchEntityId1] + LEFT JOIN [Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf] AS [r61] ON [r58].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r61].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AND [r58].[Id1] = [r61].[RelationshipsBranchEntityId1] +) AS [s6] ON [r7].[RelationshipsRootEntityId] = [s6].[RelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollectionLeaf] AS [r62] ON [r8].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r62].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf] AS [r63] ON [r11].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r63].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +ORDER BY [r].[Id], [r0].[RelationshipsRootEntityId], [r1].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r2].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r3].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r4].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r6].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r7].[RelationshipsRootEntityId], [r8].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r9].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r10].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r11].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r12].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r13].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[RelationshipsRootEntityId], [s0].[Id1], [s0].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[RelationshipsTrunkEntityId1], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId1], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId10], [s0].[RelationshipsTrunkEntityRelationshipsRootEntityId0], [s0].[RelationshipsTrunkEntityId10], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId11], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId2], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId12], [s0].[RelationshipsTrunkEntityRelationshipsRootEntityId1], [s0].[RelationshipsTrunkEntityId11], [s0].[Id10], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId3], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId13], [s0].[RelationshipsBranchEntityId1], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId00], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId100], [s0].[RelationshipsBranchEntityId10], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId10], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId110], [s0].[RelationshipsBranchEntityId11], [s0].[Id100], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId4], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId14], [s0].[Id11], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId5], [s0].[RelationshipsBranchEntityRelationshipsTrunkEntityId15], [s0].[Id12], [s1].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s1].[Id1], [s1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s1].[RelationshipsBranchEntityId1], [s1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s1].[RelationshipsBranchEntityId10], [s1].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s1].[RelationshipsBranchEntityId11], [s1].[Id10], [r31].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r31].[Id1], [r32].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r32].[Id1], [s2].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s2].[Id1], [s2].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s2].[RelationshipsBranchEntityId1], [s2].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s2].[RelationshipsBranchEntityId10], [s2].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s2].[RelationshipsBranchEntityId11], [s2].[Id10], [r37].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r37].[Id1], [r38].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r38].[Id1], [s4].[RelationshipsRootEntityId], [s4].[Id1], [s4].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s4].[RelationshipsTrunkEntityId1], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId1], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId10], [s4].[RelationshipsTrunkEntityRelationshipsRootEntityId0], [s4].[RelationshipsTrunkEntityId10], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId11], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId2], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId12], [s4].[RelationshipsTrunkEntityRelationshipsRootEntityId1], [s4].[RelationshipsTrunkEntityId11], [s4].[Id10], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId3], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId13], [s4].[RelationshipsBranchEntityId1], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId00], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId100], [s4].[RelationshipsBranchEntityId10], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId10], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId110], [s4].[RelationshipsBranchEntityId11], [s4].[Id100], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId4], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId14], [s4].[Id11], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId5], [s4].[RelationshipsBranchEntityRelationshipsTrunkEntityId15], [s4].[Id12], [s5].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s5].[Id1], [s5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s5].[RelationshipsBranchEntityId1], [s5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s5].[RelationshipsBranchEntityId10], [s5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s5].[RelationshipsBranchEntityId11], [s5].[Id10], [r56].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r56].[Id1], [r57].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r57].[Id1], [s6].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s6].[Id1], [s6].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s6].[RelationshipsBranchEntityId1], [s6].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [s6].[RelationshipsBranchEntityId10], [s6].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId1], [s6].[RelationshipsBranchEntityId11], [s6].[Id10], [r62].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r62].[Id1], [r63].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +"""); + } + + public override async Task Select_trunk_and_branch_duplicated(bool async) + { + await base.Select_trunk_and_branch_duplicated(async); + + AssertSql( + """ +SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r5`.`Name`, `r6`.`Name`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`Id1`, `r13`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`Name1`, `s0`.`Name2`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r18`.`Id1`, `r18`.`Name`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r19`.`Id1`, `r19`.`Name`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r20`.`Id1`, `r20`.`Name` +FROM ((((((((((((((`RootEntities` AS `r` +LEFT JOIN `Root_OptionalReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Opti4796B722` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Requ4EDDE18D` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Opti0EF40F72` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_RequFA89F212` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` + FROM ((`Root_OptionalReferenceTrunk_CollectionBranch` AS `r7` + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRefCCD936D2` AS `r8` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefF60F036D` AS `r9` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r9`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r10` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r10`.`RelationshipsBranchEntityId1` +) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Coll36EF62D9` AS `r11` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB02F0DA8` AS `r12` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB02F0DA8` AS `r13` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r14`.`Id1`, `r14`.`Name`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r15`.`RelationshipsBranchEntityId1`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r16`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r17`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r17`.`Id1` AS `Id10`, `r17`.`Name` AS `Name0`, `r15`.`Name` AS `Name1`, `r16`.`Name` AS `Name2` + FROM ((`Root_OptionalReferenceTrunk_CollectionBranch` AS `r14` + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRefCCD936D2` AS `r15` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`Id1` = `r15`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefF60F036D` AS `r16` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`Id1` = `r16`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r17` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`Id1` = `r17`.`RelationshipsBranchEntityId1` +) AS `s0` ON `r0`.`RelationshipsRootEntityId` = `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Coll36EF62D9` AS `r18` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB02F0DA8` AS `r19` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB02F0DA8` AS `r20` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id10`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r18`.`Id1`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r19`.`Id1`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_trunk_and_trunk_duplicated(bool async) + { + await base.Select_trunk_and_trunk_duplicated(async); + + AssertSql( + """ +SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r5`.`Name`, `r6`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`Name1`, `s0`.`Name2`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r17`.`Id1`, `r17`.`Name`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r18`.`Id1`, `r18`.`Name` +FROM ((((((((((((`RootEntities` AS `r` +LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptiC2882DFA` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ6B3E679F` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti0541F6F6` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ72457FE0` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` + FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r7` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r8` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r9` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r9`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r10` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r10`.`RelationshipsBranchEntityId1` +) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll225D701E` AS `r11` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r12` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r13`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r13`.`Id1`, `r13`.`Name`, `r14`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r14`.`RelationshipsBranchEntityId1`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r15`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r16`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r16`.`Id1` AS `Id10`, `r16`.`Name` AS `Name0`, `r14`.`Name` AS `Name1`, `r15`.`Name` AS `Name2` + FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r13` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r14` ON `r13`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r14`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r13`.`Id1` = `r14`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r15` ON `r13`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r13`.`Id1` = `r15`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r16` ON `r13`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r13`.`Id1` = `r16`.`RelationshipsBranchEntityId1` +) AS `s0` ON `r0`.`RelationshipsRootEntityId` = `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll225D701E` AS `r17` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r18` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id10`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r17`.`Id1`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_leaf_trunk_root(bool async) + { + await base.Select_leaf_trunk_root(async); + + AssertSql( + """ +SELECT `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Name`, `r0`.`RelationshipsRootEntityId`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`RelationshipsRootEntityId`, `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r3`.`Name`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r18`.`Id1`, `r18`.`Name`, `r4`.`Name`, `r5`.`Name`, `r1`.`Name`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r19`.`Id1`, `r19`.`Name`, `r6`.`Name`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s1`.`RelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`RelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s1`.`RelationshipsTrunkEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s1`.`RelationshipsTrunkEntityId11`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s1`.`RelationshipsBranchEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s1`.`RelationshipsBranchEntityId11`, `s1`.`Id100`, `s1`.`Name00`, `s1`.`Name1`, `s1`.`Name2`, `s1`.`Name3`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s1`.`Id11`, `s1`.`Name4`, `s1`.`Name5`, `s1`.`Name6`, `s1`.`Name7`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `s1`.`Id12`, `s1`.`Name8`, `s1`.`Name9`, `s1`.`Name10`, `r7`.`Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s2`.`RelationshipsBranchEntityId10`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s2`.`RelationshipsBranchEntityId11`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`Name1`, `s2`.`Name2`, `r8`.`Name`, `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r37`.`Id1`, `r37`.`Name`, `r9`.`Name`, `r10`.`Name`, `r11`.`Name`, `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r38`.`Id1`, `r38`.`Name`, `r12`.`Name`, `r13`.`Name`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`Id1`, `s3`.`Name`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s3`.`RelationshipsBranchEntityId10`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s3`.`RelationshipsBranchEntityId11`, `s3`.`Id10`, `s3`.`Name0`, `s3`.`Name1`, `s3`.`Name2`, `r43`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r43`.`Id1`, `r43`.`Name`, `r44`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r44`.`Id1`, `r44`.`Name` +FROM (((((((((((((((((((((((`RootEntities` AS `r` +LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ72457FE0` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch` AS `r3` ON `r0`.`RelationshipsRootEntityId` = `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptiC2882DFA` AS `r4` ON `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ6B3E679F` AS `r5` ON `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti0541F6F6` AS `r6` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk` AS `r7` ON `r`.`Id` = `r7`.`RelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch` AS `r8` ON `r7`.`RelationshipsRootEntityId` = `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Opti4796B722` AS `r9` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Requ4EDDE18D` AS `r10` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch` AS `r11` ON `r7`.`RelationshipsRootEntityId` = `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Opti0EF40F72` AS `r12` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_RequFA89F212` AS `r13` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r14`.`Id1`, `r14`.`Name`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r15`.`RelationshipsBranchEntityId1`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r16`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r17`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r17`.`Id1` AS `Id10`, `r17`.`Name` AS `Name0`, `r15`.`Name` AS `Name1`, `r16`.`Name` AS `Name2` + FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r14` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r15` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`Id1` = `r15`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r16` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`Id1` = `r16`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r17` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`Id1` = `r17`.`RelationshipsBranchEntityId1` +) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll225D701E` AS `r18` ON `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r19` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r20`.`RelationshipsRootEntityId`, `r20`.`Id1`, `r20`.`Name`, `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r21`.`RelationshipsTrunkEntityId1`, `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r24`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId0`, `r24`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId10`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s0`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId11`, `s0`.`Id1` AS `Id10`, `s0`.`Name` AS `Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id10` AS `Id100`, `s0`.`Name0` AS `Name00`, `s0`.`Name1`, `s0`.`Name2`, `r21`.`Name` AS `Name3`, `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `r31`.`Id1` AS `Id11`, `r31`.`Name` AS `Name4`, `r22`.`Name` AS `Name5`, `r23`.`Name` AS `Name6`, `r24`.`Name` AS `Name7`, `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `r32`.`Id1` AS `Id12`, `r32`.`Name` AS `Name8`, `r25`.`Name` AS `Name9`, `r26`.`Name` AS `Name10` + FROM ((((((((`Root_CollectionTrunk` AS `r20` + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch` AS `r21` ON `r20`.`RelationshipsRootEntityId` = `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r20`.`Id1` = `r21`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_OptionalRef3DABF2A6` AS `r22` ON `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r21`.`RelationshipsTrunkEntityId1` = `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_RequiredRefEAD29521` AS `r23` ON `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r21`.`RelationshipsTrunkEntityId1` = `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch` AS `r24` ON `r20`.`RelationshipsRootEntityId` = `r24`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r20`.`Id1` = `r24`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_OptionalRef6DAA31E7` AS `r25` ON `r24`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r24`.`RelationshipsTrunkEntityId1` = `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_RequiredRefF4CAB043` AS `r26` ON `r24`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r24`.`RelationshipsTrunkEntityId1` = `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN ( + SELECT `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r27`.`RelationshipsTrunkEntityId1`, `r27`.`Id1`, `r27`.`Name`, `r28`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r28`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r28`.`RelationshipsBranchEntityId1`, `r29`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r29`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r29`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r30`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r30`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r30`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r30`.`Id1` AS `Id10`, `r30`.`Name` AS `Name0`, `r28`.`Name` AS `Name1`, `r29`.`Name` AS `Name2` + FROM ((`Root_CollectionTrunk_CollectionBranch` AS `r27` + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf` AS `r28` ON `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r28`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r27`.`RelationshipsTrunkEntityId1` = `r28`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r27`.`Id1` = `r28`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf` AS `r29` ON `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r29`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r27`.`RelationshipsTrunkEntityId1` = `r29`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r27`.`Id1` = `r29`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_CollectionTrunk_CollectionBranch_CollectionLeaf` AS `r30` ON `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r30`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r27`.`RelationshipsTrunkEntityId1` = `r30`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r27`.`Id1` = `r30`.`RelationshipsBranchEntityId1` + ) AS `s0` ON `r20`.`RelationshipsRootEntityId` = `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r20`.`Id1` = `s0`.`RelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf` AS `r31` ON `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r21`.`RelationshipsTrunkEntityId1` = `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r32` ON `r24`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r24`.`RelationshipsTrunkEntityId1` = `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` +) AS `s1` ON `r`.`Id` = `s1`.`RelationshipsRootEntityId`) +LEFT JOIN ( + SELECT `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r33`.`Id1`, `r33`.`Name`, `r34`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r34`.`RelationshipsBranchEntityId1`, `r35`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r35`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r36`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r36`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r36`.`Id1` AS `Id10`, `r36`.`Name` AS `Name0`, `r34`.`Name` AS `Name1`, `r35`.`Name` AS `Name2` + FROM ((`Root_OptionalReferenceTrunk_CollectionBranch` AS `r33` + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRefCCD936D2` AS `r34` ON `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r34`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r33`.`Id1` = `r34`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefF60F036D` AS `r35` ON `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r35`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r33`.`Id1` = `r35`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r36` ON `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r36`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r33`.`Id1` = `r36`.`RelationshipsBranchEntityId1` +) AS `s2` ON `r7`.`RelationshipsRootEntityId` = `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Coll36EF62D9` AS `r37` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB02F0DA8` AS `r38` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN ( + SELECT `r39`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r39`.`Id1`, `r39`.`Name`, `r40`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r40`.`RelationshipsBranchEntityId1`, `r41`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r41`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r42`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r42`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r42`.`Id1` AS `Id10`, `r42`.`Name` AS `Name0`, `r40`.`Name` AS `Name1`, `r41`.`Name` AS `Name2` + FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r39` + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r40` ON `r39`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r40`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r39`.`Id1` = `r40`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r41` ON `r39`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r41`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r39`.`Id1` = `r41`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r42` ON `r39`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r42`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r39`.`Id1` = `r42`.`RelationshipsBranchEntityId1` +) AS `s3` ON `r0`.`RelationshipsRootEntityId` = `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll225D701E` AS `r43` ON `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r43`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r44` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r44`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`RelationshipsRootEntityId`, `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r18`.`Id1`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r19`.`Id1`, `s1`.`RelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`RelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s1`.`RelationshipsTrunkEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s1`.`RelationshipsTrunkEntityId11`, `s1`.`Id10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s1`.`RelationshipsBranchEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s1`.`RelationshipsBranchEntityId11`, `s1`.`Id100`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s1`.`Id11`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `s1`.`Id12`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s2`.`RelationshipsBranchEntityId10`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s2`.`RelationshipsBranchEntityId11`, `s2`.`Id10`, `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r37`.`Id1`, `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r38`.`Id1`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`Id1`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s3`.`RelationshipsBranchEntityId10`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s3`.`RelationshipsBranchEntityId11`, `s3`.`Id10`, `r43`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r43`.`Id1`, `r44`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +"""); + } + + public override async Task Select_subquery_root_set_required_trunk_FirstOrDefault_branch(bool async) + { + await base.Select_subquery_root_set_required_trunk_FirstOrDefault_branch(async); + + AssertSql( + """ +SELECT [s].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s].[Name], [r].[Id], [s].[Id], [s].[RelationshipsRootEntityId], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r5].[Id1], [r5].[Name], [s].[Name0], [s].[Name1] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) [r2].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r2].[Name], [r3].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r3].[Name] AS [Name0], [r4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r4].[Name] AS [Name1], [r0].[Id], [r1].[RelationshipsRootEntityId] + FROM [RootEntities] AS [r0] + LEFT JOIN [Root_RequiredReferenceTrunk] AS [r1] ON [r0].[Id] = [r1].[RelationshipsRootEntityId] + LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch] AS [r2] ON [r1].[RelationshipsRootEntityId] = [r2].[RelationshipsTrunkEntityRelationshipsRootEntityId] + LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenceLeaf] AS [r3] ON [r2].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r3].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] + LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenceLeaf] AS [r4] ON [r2].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] + ORDER BY [r0].[Id] +) AS [s] +LEFT JOIN [Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollectionLeaf] AS [r5] ON [s].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +ORDER BY [r].[Id], [s].[Id], [s].[RelationshipsRootEntityId], [s].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +"""); + } + + public override async Task Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(bool async) + { + await base.Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(async); + + AssertSql( + """ +SELECT [s].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s].[Name], [r].[Id], [s].[Id], [s].[RelationshipsRootEntityId], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r5].[Id1], [r5].[Name], [s].[Name0], [s].[Name1] +FROM [RootEntities] AS [r] +OUTER APPLY ( + SELECT TOP(1) [r2].[RelationshipsTrunkEntityRelationshipsRootEntityId], [r2].[Name], [r3].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [r3].[Name] AS [Name0], [r4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] AS [RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r4].[Name] AS [Name1], [r0].[Id], [r1].[RelationshipsRootEntityId] + FROM [RootEntities] AS [r0] + LEFT JOIN [Root_OptionalReferenceTrunk] AS [r1] ON [r0].[Id] = [r1].[RelationshipsRootEntityId] + LEFT JOIN [Root_OptionalReferenceTrunk_OptionalReferenceBranch] AS [r2] ON [r1].[RelationshipsRootEntityId] = [r2].[RelationshipsTrunkEntityRelationshipsRootEntityId] + LEFT JOIN [Root_OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenceLeaf] AS [r3] ON [r2].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r3].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] + LEFT JOIN [Root_OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenceLeaf] AS [r4] ON [r2].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r4].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] + ORDER BY [r0].[Id] +) AS [s] +LEFT JOIN [Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollectionLeaf] AS [r5] ON [s].[RelationshipsTrunkEntityRelationshipsRootEntityId] = [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +ORDER BY [r].[Id], [s].[Id], [s].[RelationshipsRootEntityId], [s].[RelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId], [s].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId0], [r5].[RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsRootEntityId] +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/SharedTypeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/SharedTypeQueryJetTest.cs index 4e7319ac..ad8f0885 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/SharedTypeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/SharedTypeQueryJetTest.cs @@ -1,14 +1,15 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; namespace EntityFrameworkCore.Jet.FunctionalTests.Query; -public class SharedTypeQueryJetTest : SharedTypeQueryRelationalTestBase +public class SharedTypeQueryJetTest(NonSharedFixture fixture) : SharedTypeQueryRelationalTestBase(fixture) { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; diff --git a/test/EFCore.Jet.FunctionalTests/Query/SqlQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/SqlQueryJetTest.cs index a37ae7d8..cef2b524 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/SqlQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/SqlQueryJetTest.cs @@ -372,15 +372,15 @@ public override async Task SqlQueryRaw_queryable_with_parameters_and_clo var queryString = await base.SqlQueryRaw_queryable_with_parameters_and_closure(async); AssertSql( -$""" + """ p0='London' (Size = 255) -@__contactTitle_1='Sales Representative' (Size = 30) +@contactTitle='Sales Representative' (Size = 30) SELECT `m`.`Address`, `m`.`City`, `m`.`CompanyName`, `m`.`ContactName`, `m`.`ContactTitle`, `m`.`Country`, `m`.`CustomerID`, `m`.`Fax`, `m`.`Phone`, `m`.`Region`, `m`.`PostalCode` FROM ( - SELECT * FROM `Customers` WHERE `City` = {AssertSqlHelper.Parameter("@p0")} + SELECT * FROM `Customers` WHERE `City` = @p0 ) AS `m` -WHERE `m`.`ContactTitle` = {AssertSqlHelper.Parameter("@__contactTitle_1")} +WHERE `m`.`ContactTitle` = @contactTitle """); return null; @@ -502,18 +502,18 @@ public override async Task SqlQueryRaw_with_dbParameter_mixed(bool async) await base.SqlQueryRaw_with_dbParameter_mixed(async); AssertSql( -$""" + """ p0='London' (Size = 255) @title='Sales Representative' (Nullable = false) (Size = 20) -SELECT * FROM `Customers` WHERE `City` = {AssertSqlHelper.Parameter("@p0")} AND `ContactTitle` = {AssertSqlHelper.Parameter("@title")} +SELECT * FROM `Customers` WHERE `City` = @p0 AND `ContactTitle` = @title """, -// -$""" + // + """ @city='London' (Nullable = false) (Size = 6) -p1='Sales Representative' (Size = 255) +p0='Sales Representative' (Size = 255) -SELECT * FROM `Customers` WHERE `City` = {AssertSqlHelper.Parameter("@city")} AND `ContactTitle` = {AssertSqlHelper.Parameter("@p1")} +SELECT * FROM `Customers` WHERE `City` = @city AND `ContactTitle` = @p0 """); } @@ -564,43 +564,43 @@ public override async Task SqlQuery_parameterization_issue_12213(bool async) await base.SqlQuery_parameterization_issue_12213(async); AssertSql( -$""" + """ p0='10300' SELECT `m`.`OrderID` FROM ( - SELECT * FROM `Orders` WHERE `OrderID` >= {AssertSqlHelper.Parameter("@p0")} + SELECT * FROM `Orders` WHERE `OrderID` >= @p0 ) AS `m` """, -// -$""" -@__max_1='10400' + // + """ +@max='10400' p0='10300' SELECT `m`.`OrderID` FROM ( SELECT * FROM `Orders` ) AS `m` -WHERE `m`.`OrderID` <= {AssertSqlHelper.Parameter("@__max_1")} AND `m`.`OrderID` IN ( +WHERE `m`.`OrderID` <= @max AND `m`.`OrderID` IN ( SELECT `m0`.`OrderID` FROM ( - SELECT * FROM `Orders` WHERE `OrderID` >= {AssertSqlHelper.Parameter("@p0")} + SELECT * FROM `Orders` WHERE `OrderID` >= @p0 ) AS `m0` ) """, -// -$""" -@__max_1='10400' + // + """ +@max='10400' p0='10300' SELECT `m`.`OrderID` FROM ( SELECT * FROM `Orders` ) AS `m` -WHERE `m`.`OrderID` <= {AssertSqlHelper.Parameter("@__max_1")} AND `m`.`OrderID` IN ( +WHERE `m`.`OrderID` <= @max AND `m`.`OrderID` IN ( SELECT `m0`.`OrderID` FROM ( - SELECT * FROM `Orders` WHERE `OrderID` >= {AssertSqlHelper.Parameter("@p0")} + SELECT * FROM `Orders` WHERE `OrderID` >= @p0 ) AS `m0` ) """); @@ -719,7 +719,7 @@ public override async Task SqlQueryRaw_with_dbParameter_mixed_in_subquery(bool a await base.SqlQueryRaw_with_dbParameter_mixed_in_subquery(async); AssertSql( -$""" + """ p0='London' (Size = 255) @title='Sales Representative' (Nullable = false) (Size = 20) @@ -730,14 +730,14 @@ public override async Task SqlQueryRaw_with_dbParameter_mixed_in_subquery(bool a WHERE `m`.`CustomerID` IN ( SELECT `m0`.`CustomerID` FROM ( - SELECT * FROM `Customers` WHERE `City` = {AssertSqlHelper.Parameter("@p0")} AND `ContactTitle` = {AssertSqlHelper.Parameter("@title")} + SELECT * FROM `Customers` WHERE `City` = @p0 AND `ContactTitle` = @title ) AS `m0` ) """, -// -$""" + // + """ @city='London' (Nullable = false) (Size = 6) -p1='Sales Representative' (Size = 255) +p0='Sales Representative' (Size = 255) SELECT `m`.`CustomerID`, `m`.`EmployeeID`, `m`.`Freight`, `m`.`OrderDate`, `m`.`OrderID`, `m`.`RequiredDate`, `m`.`ShipAddress`, `m`.`ShipCity`, `m`.`ShipCountry`, `m`.`ShipName`, `m`.`ShipPostalCode`, `m`.`ShipRegion`, `m`.`ShipVia`, `m`.`ShippedDate` FROM ( @@ -746,32 +746,12 @@ public override async Task SqlQueryRaw_with_dbParameter_mixed_in_subquery(bool a WHERE `m`.`CustomerID` IN ( SELECT `m0`.`CustomerID` FROM ( - SELECT * FROM `Customers` WHERE `City` = {AssertSqlHelper.Parameter("@city")} AND `ContactTitle` = {AssertSqlHelper.Parameter("@p1")} + SELECT * FROM `Customers` WHERE `City` = @city AND `ContactTitle` = @p0 ) AS `m0` ) """); } - public override async Task Multiple_occurrences_of_SqlQuery_with_db_parameter_adds_parameter_only_once(bool async) - { - await base.Multiple_occurrences_of_SqlQuery_with_db_parameter_adds_parameter_only_once(async); - - AssertSql( - $""" -city='Seattle' (Nullable = false) (Size = 7) - -SELECT [m].[Address], [m].[City], [m].[CompanyName], [m].[ContactName], [m].[ContactTitle], [m].[Country], [m].[CustomerID], [m].[Fax], [m].[Phone], [m].[Region], [m].[PostalCode] -FROM ( - SELECT * FROM "Customers" WHERE "City" = {AssertSqlHelper.Parameter("@city")} -) AS [m] -INTERSECT -SELECT [m0].[Address], [m0].[City], [m0].[CompanyName], [m0].[ContactName], [m0].[ContactTitle], [m0].[Country], [m0].[CustomerID], [m0].[Fax], [m0].[Phone], [m0].[Region], [m0].[PostalCode] -FROM ( - SELECT * FROM "Customers" WHERE "City" = {AssertSqlHelper.Parameter("@city")} -) AS [m0] -"""); - } - public override async Task SqlQueryRaw_composed_with_common_table_expression(bool async) { var exception = diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCFiltersInheritanceQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPCFiltersInheritanceQueryJetTest.cs index 9370612c..a722d19e 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCFiltersInheritanceQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPCFiltersInheritanceQueryJetTest.cs @@ -207,12 +207,12 @@ public override async Task Can_use_IgnoreQueryFilters_and_GetDatabaseValues(bool FROM `Eagle` AS `e` """, // - $""" -@__p_0='2' + """ +@p='2' SELECT TOP 1 `e`.`Id`, `e`.`CountryId`, `e`.`Name`, `e`.`Species`, `e`.`EagleId`, `e`.`IsFlightless`, `e`.`Group` FROM `Eagle` AS `e` -WHERE `e`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `e`.`Id` = @p """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs index 0edded86..94de0ff5 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs @@ -332,7 +332,7 @@ UNION ALL FROM `Officers` AS `o` ) AS `u` LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` -WHERE `t`.`Id` IS NOT NULL AND `t`.`Id` IN ('{34c8d86e-a4ac-4be5-827f-584dda348a07}', '{70534e05-782c-4052-8720-c2c54481ce5f}', '{a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}', '{a8ad98f9-e023-4e2a-9a70-c2728455bd34}', '{b39a6fba-9026-4d69-828e-fd7068673e57}', '{df36f493-463f-4123-83f9-6b135deeb7ba}') +WHERE `t`.`Id` IS NOT NULL AND `t`.`Id` IN ({34c8d86e-a4ac-4be5-827f-584dda348a07}, {70534e05-782c-4052-8720-c2c54481ce5f}, {a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}, {a8ad98f9-e023-4e2a-9a70-c2728455bd34}, {b39a6fba-9026-4d69-828e-fd7068673e57}, {df36f493-463f-4123-83f9-6b135deeb7ba}) """); } @@ -357,7 +357,7 @@ UNION ALL ) AS `u` INNER JOIN `Cities` AS `c` ON `u`.`CityOfBirthName` = `c`.`Name`) LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` -WHERE `c`.`Location` IS NOT NULL AND `t`.`Id` IN ('{34c8d86e-a4ac-4be5-827f-584dda348a07}', '{70534e05-782c-4052-8720-c2c54481ce5f}', '{a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}', '{a8ad98f9-e023-4e2a-9a70-c2728455bd34}', '{b39a6fba-9026-4d69-828e-fd7068673e57}', '{df36f493-463f-4123-83f9-6b135deeb7ba}') +WHERE `c`.`Location` IS NOT NULL AND `t`.`Id` IN ({34c8d86e-a4ac-4be5-827f-584dda348a07}, {70534e05-782c-4052-8720-c2c54481ce5f}, {a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}, {a8ad98f9-e023-4e2a-9a70-c2728455bd34}, {b39a6fba-9026-4d69-828e-fd7068673e57}, {df36f493-463f-4123-83f9-6b135deeb7ba}) """); } @@ -381,7 +381,7 @@ UNION ALL FROM `Officers` AS `o` ) AS `u` LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` -WHERE `t`.`Id` IS NOT NULL AND `t`.`Id` IN ('{34c8d86e-a4ac-4be5-827f-584dda348a07}', '{70534e05-782c-4052-8720-c2c54481ce5f}', '{a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}', '{a8ad98f9-e023-4e2a-9a70-c2728455bd34}', '{b39a6fba-9026-4d69-828e-fd7068673e57}', '{df36f493-463f-4123-83f9-6b135deeb7ba}') +WHERE `t`.`Id` IS NOT NULL AND `t`.`Id` IN ({34c8d86e-a4ac-4be5-827f-584dda348a07}, {70534e05-782c-4052-8720-c2c54481ce5f}, {a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}, {a8ad98f9-e023-4e2a-9a70-c2728455bd34}, {b39a6fba-9026-4d69-828e-fd7068673e57}, {df36f493-463f-4123-83f9-6b135deeb7ba}) """); } @@ -513,9 +513,9 @@ UNION ALL """); } - public override async Task Where_enum(bool async) + public override async Task Where_count_subquery_without_collision(bool async) { - await base.Where_enum(async); + await base.Where_count_subquery_without_collision(async); AssertSql( """ @@ -527,201 +527,189 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -WHERE `u`.`Rank` = 4 +WHERE ( + SELECT COUNT(*) + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName`) = 2 """); } - public override async Task Where_nullable_enum_with_constant(bool async) + public override async Task Where_any_subquery_without_collision(bool async) { - await base.Where_nullable_enum_with_constant(async); + await base.Where_any_subquery_without_collision(async); AssertSql( -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` = 1 + """ +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +WHERE EXISTS ( + SELECT 1 + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName`) """); } - public override async Task Where_nullable_enum_with_null_constant(bool async) + public override async Task Select_inverted_boolean(bool async) { - await base.Where_nullable_enum_with_null_constant(async); + await base.Select_inverted_boolean(async); AssertSql( -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + """ +SELECT `w`.`Id`, `w`.`IsAutomatic` BXOR TRUE AS `Manual` FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` IS NULL +WHERE `w`.`IsAutomatic` = TRUE """); } - public override async Task Where_nullable_enum_with_non_nullable_parameter(bool async) + public override async Task Select_inverted_nullable_boolean(bool async) { - await base.Where_nullable_enum_with_non_nullable_parameter(async); + await base.Select_inverted_nullable_boolean(async); AssertSql( -""" -@__ammunitionType_0='1' - -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` = @__ammunitionType_0 + """ +SELECT `l`.`Id`, `l`.`Eradicated` BXOR TRUE AS `Alive` +FROM `LocustHordes` AS `l` """); } - public override async Task Where_nullable_enum_with_nullable_parameter(bool async) + public override async Task Select_comparison_with_null(bool async) { - await base.Where_nullable_enum_with_nullable_parameter(async); + await base.Select_comparison_with_null(async); AssertSql( -""" -@__ammunitionType_0='1' (Nullable = true) + """ +@ammunitionType='1' (Nullable = true) +@ammunitionType='1' (Nullable = true) -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` = @ammunitionType AND `w`.`AmmunitionType` IS NOT NULL, TRUE, FALSE) AS `Cartridge` FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` = @__ammunitionType_0 +WHERE `w`.`AmmunitionType` = @ammunitionType """, -// -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + // + """ +SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` IS NULL, TRUE, FALSE) AS `Cartridge` FROM `Weapons` AS `w` WHERE `w`.`AmmunitionType` IS NULL """); } - public override async Task Where_bitwise_and_enum(bool async) + public override async Task Select_null_parameter(bool async) { - await base.Where_bitwise_and_enum(async); + await base.Select_null_parameter(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -WHERE (`u`.`Rank` BAND 2) > 0 +@ammunitionType='1' (Nullable = true) + +SELECT `w`.`Id`, @ammunitionType AS `AmmoType` +FROM `Weapons` AS `w` """, // """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -WHERE (`u`.`Rank` BAND 2) = 2 -"""); - } - - public override async Task Where_bitwise_and_integral(bool async) - { - await base.Where_bitwise_and_integral(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -WHERE (`u`.`Rank` BAND 1) = 1 +SELECT `w`.`Id`, CVar(NULL) AS `AmmoType` +FROM `Weapons` AS `w` """, // """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -WHERE (CLNG(`u`.`Rank`) BAND 1) = 1 +@ammunitionType='2' (Nullable = true) + +SELECT `w`.`Id`, @ammunitionType AS `AmmoType` +FROM `Weapons` AS `w` """, // """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -WHERE (CINT(`u`.`Rank`) BAND 1) = 1 +SELECT `w`.`Id`, CVar(NULL) AS `AmmoType` +FROM `Weapons` AS `w` """); } - public override async Task Where_bitwise_and_nullable_enum_with_constant(bool async) + public override async Task Select_ternary_operation_with_boolean(bool async) { - await base.Where_bitwise_and_nullable_enum_with_constant(async); + await base.Select_ternary_operation_with_boolean(async); AssertSql( """ -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = TRUE, 1, 0) AS `Num` FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND 1) > 0 """); } - public override async Task Where_bitwise_and_nullable_enum_with_null_constant(bool async) + public override async Task Select_ternary_operation_with_inverted_boolean(bool async) { - await base.Where_bitwise_and_nullable_enum_with_null_constant(async); + await base.Select_ternary_operation_with_inverted_boolean(async); AssertSql( -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + """ +SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE, 1, 0) AS `Num` FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND NULL) > 0 """); } - public override async Task Where_bitwise_and_nullable_enum_with_non_nullable_parameter(bool async) + public override async Task Select_ternary_operation_with_has_value_not_null(bool async) { - await base.Where_bitwise_and_nullable_enum_with_non_nullable_parameter(async); + await base.Select_ternary_operation_with_has_value_not_null(async); AssertSql( """ -@__ammunitionType_0='1' - -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` IS NOT NULL AND `w`.`AmmunitionType` = 1, 'Yes', 'No') AS `IsCartridge` FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND @__ammunitionType_0) > 0 +WHERE `w`.`AmmunitionType` IS NOT NULL AND `w`.`AmmunitionType` = 1 """); } - public override async Task Where_bitwise_and_nullable_enum_with_nullable_parameter(bool async) + public override async Task Select_ternary_operation_multiple_conditions(bool async) { - await base.Where_bitwise_and_nullable_enum_with_nullable_parameter(async); + await base.Select_ternary_operation_multiple_conditions(async); AssertSql( """ -@__ammunitionType_0='1' (Nullable = true) +SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` = 2 AND `w`.`SynergyWithId` = 1, 'Yes', 'No') AS `IsCartridge` +FROM `Weapons` AS `w` +"""); + } -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + public override async Task Select_ternary_operation_multiple_conditions_2(bool async) + { + await base.Select_ternary_operation_multiple_conditions_2(async); + + AssertSql( + """ +SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE AND `w`.`SynergyWithId` = 1, 'Yes', 'No') AS `IsCartridge` FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND @__ammunitionType_0) > 0 -""", -// -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +"""); + } + + public override async Task Select_multiple_conditions(bool async) + { + await base.Select_multiple_conditions(async); + + AssertSql( + """ +SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE AND `w`.`SynergyWithId` = 1 AND `w`.`SynergyWithId` IS NOT NULL, TRUE, FALSE) AS `IsCartridge` +FROM `Weapons` AS `w` +"""); + } + + public override async Task Select_nested_ternary_operations(bool async) + { + await base.Select_nested_ternary_operations(async); + + AssertSql( + """ +SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE, IIF(`w`.`AmmunitionType` = 1, 'ManualCartridge', 'Manual'), 'Auto') AS `IsManualCartridge` FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND NULL) > 0 """); } - public override async Task Where_bitwise_or_enum(bool async) + public override async Task Null_propagation_optimization1(bool async) { - await base.Where_bitwise_or_enum(async); + await base.Null_propagation_optimization1(async); AssertSql( """ @@ -733,32 +721,34 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -WHERE (`u`.`Rank` BOR 2) > 0 +WHERE `u`.`LeaderNickname` = 'Marcus' """); } - public override async Task Bitwise_projects_values_in_select(bool async) + public override async Task Null_propagation_optimization2(bool async) { - await base.Bitwise_projects_values_in_select(async); + await base.Null_propagation_optimization2(async); + // issue #16050 AssertSql( - """ -SELECT TOP 1 CBOOL((`u`.`Rank` BAND 2) BXOR 2) BXOR TRUE AS `BitwiseTrue`, CBOOL((`u`.`Rank` BAND 2) BXOR 4) BXOR TRUE AS `BitwiseFalse`, `u`.`Rank` BAND 2 AS `BitwiseValue` +""" +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( - SELECT `g`.`Rank` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Rank` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -WHERE (`u`.`Rank` BAND 2) = 2 +WHERE IIF(`u`.`LeaderNickname` IS NULL, NULL, IIF(`u`.`LeaderNickname` LIKE '%us', TRUE, FALSE)) = TRUE """); } - public override async Task Where_enum_has_flag(bool async) + public override async Task Null_propagation_optimization3(bool async) { - await base.Where_enum_has_flag(async); + await base.Null_propagation_optimization3(async); + // issue #16050 AssertSql( """ SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` @@ -769,9 +759,16 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -WHERE (`u`.`Rank` BAND 2) = 2 -""", - // +WHERE IIF(`u`.`LeaderNickname` IS NOT NULL, IIF(`u`.`LeaderNickname` LIKE '%us', TRUE, FALSE), NULL) = TRUE +"""); + } + + public override async Task Null_propagation_optimization4(bool async) + { + await base.Null_propagation_optimization4(async); + + // issue #16050 + AssertSql( """ SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( @@ -781,9 +778,16 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -WHERE (`u`.`Rank` BAND 18) = 18 -""", - // +WHERE IIF(`u`.`LeaderNickname` IS NULL, NULL, IIF(LEN(`u`.`LeaderNickname`) IS NULL, NULL, CLNG(LEN(`u`.`LeaderNickname`)))) = 5 +"""); + } + + public override async Task Null_propagation_optimization5(bool async) + { + await base.Null_propagation_optimization5(async); + + // issue #16050 + AssertSql( """ SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( @@ -793,9 +797,16 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -WHERE (`u`.`Rank` BAND 1) = 1 -""", - // +WHERE IIF(`u`.`LeaderNickname` IS NOT NULL, IIF(LEN(`u`.`LeaderNickname`) IS NULL, NULL, CLNG(LEN(`u`.`LeaderNickname`))), NULL) = 5 +"""); + } + + public override async Task Null_propagation_optimization6(bool async) + { + await base.Null_propagation_optimization6(async); + + // issue #16050 + AssertSql( """ SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( @@ -805,2389 +816,2145 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -WHERE (`u`.`Rank` BAND 1) = 1 -""", - // +WHERE IIF(`u`.`LeaderNickname` IS NOT NULL, IIF(LEN(`u`.`LeaderNickname`) IS NULL, NULL, CLNG(LEN(`u`.`LeaderNickname`))), NULL) = 5 +"""); + } + + public override async Task Select_null_propagation_optimization7(bool async) + { + await base.Select_null_propagation_optimization7(async); + + // issue #16050 + AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, `u`.`LeaderNickname` & `u`.`LeaderNickname`, NULL) FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g`.`LeaderNickname` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`LeaderNickname` FROM `Officers` AS `o` ) AS `u` -WHERE (2 BAND `u`.`Rank`) = `u`.`Rank` """); } - public override async Task Where_enum_has_flag_subquery(bool async) + public override async Task Select_null_propagation_optimization8(bool async) { - await base.Where_enum_has_flag_subquery(async); + await base.Select_null_propagation_optimization8(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +SELECT IIF(`u`.`LeaderNickname` IS NULL, '', `u`.`LeaderNickname`) & IIF(`u`.`LeaderNickname` IS NULL, '', `u`.`LeaderNickname`) FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`LeaderNickname` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`LeaderNickname` FROM `Officers` AS `o` ) AS `u` -WHERE (`u`.`Rank` BAND IIF(( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`) IS NULL, 0, ( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`))) = IIF(( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`) IS NULL, 0, ( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`)) -""", - // +"""); + } + + public override async Task Select_null_propagation_optimization9(bool async) + { + await base.Select_null_propagation_optimization9(async); + + AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +SELECT IIF(LEN(`u`.`FullName`) IS NULL, NULL, CLNG(LEN(`u`.`FullName`))) FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`FullName` FROM `Officers` AS `o` ) AS `u` -WHERE (2 BAND IIF(( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`) IS NULL, 0, ( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`))) = IIF(( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`) IS NULL, 0, ( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`)) """); } - public override async Task Where_enum_has_flag_subquery_with_pushdown(bool async) + public override async Task Select_null_propagation_negative1(bool async) { - await base.Where_enum_has_flag_subquery_with_pushdown(async); + await base.Select_null_propagation_negative1(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, CBOOL(IIF(LEN(`u`.`Nickname`) IS NULL, NULL, CLNG(LEN(`u`.`Nickname`))) BXOR 5) BXOR TRUE, NULL) FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g`.`Nickname`, `g`.`LeaderNickname` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`LeaderNickname` FROM `Officers` AS `o` ) AS `u` -WHERE (`u`.`Rank` BAND ( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`)) = ( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`) OR ( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`) IS NULL -""", - // +"""); + } + + public override async Task Select_null_propagation_negative2(bool async) + { + await base.Select_null_propagation_negative2(async); + + AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, `u0`.`LeaderNickname`, NULL) FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g`.`LeaderNickname` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`LeaderNickname` FROM `Officers` AS `o` -) AS `u` -WHERE (2 BAND ( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`)) = ( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`) OR ( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`) IS NULL +) AS `u`, +( + SELECT `g0`.`LeaderNickname` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`LeaderNickname` + FROM `Officers` AS `o0` +) AS `u0` """); } - public override async Task Where_enum_has_flag_subquery_client_eval(bool async) + public override async Task Select_null_propagation_negative3(bool async) { - await base.Where_enum_has_flag_subquery_client_eval(async); + await base.Select_null_propagation_negative3(async); AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +""" +SELECT [t0].[Nickname], CASE + WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN CASE + WHEN [t0].[LeaderNickname] IS NOT NULL THEN CAST(1 AS bit) + ELSE CAST(0 AS bit) + END + ELSE NULL +END AS [Condition] FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` + SELECT [g].[HasSoulPatch] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -WHERE (`u`.`Rank` BAND ( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`)) = ( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`) OR ( - SELECT TOP 1 `u0`.`Rank` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - ORDER BY `u0`.`Nickname`, `u0`.`SquadId`) IS NULL + SELECT [o].[HasSoulPatch] + FROM [Officers] AS [o] +) AS [t] +LEFT JOIN ( + SELECT [g0].[Nickname], [g0].[SquadId], [g0].[LeaderNickname] + FROM [Gears] AS [g0] + UNION ALL + SELECT [o0].[Nickname], [o0].[SquadId], [o0].[LeaderNickname] + FROM [Officers] AS [o0] +) AS [t0] ON [t].[HasSoulPatch] = CAST(1 AS bit) +ORDER BY [t0].[Nickname] """); } - public override async Task Where_enum_has_flag_with_non_nullable_parameter(bool async) + public override async Task Select_null_propagation_negative4(bool async) { - await base.Where_enum_has_flag_with_non_nullable_parameter(async); + await base.Select_null_propagation_negative4(async); AssertSql( - """ -@__parameter_0='2' -@__parameter_0='2' +""" +SELECT CASE + WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + ELSE CAST(0 AS bit) +END, [t0].[Nickname] +FROM ( + SELECT [g].[HasSoulPatch] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[HasSoulPatch] + FROM [Officers] AS [o] +) AS [t] +LEFT JOIN ( + SELECT [g0].[Nickname], [g0].[SquadId] + FROM [Gears] AS [g0] + UNION ALL + SELECT [o0].[Nickname], [o0].[SquadId] + FROM [Officers] AS [o0] +) AS [t0] ON [t].[HasSoulPatch] = CAST(1 AS bit) +ORDER BY [t0].[Nickname] +"""); + } -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` + public override async Task Select_null_propagation_negative5(bool async) + { + await base.Select_null_propagation_negative5(async); + + AssertSql( +""" +SELECT CASE + WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + ELSE CAST(0 AS bit) +END, [t0].[Nickname] FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` + SELECT [g].[HasSoulPatch] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -WHERE (`u`.`Rank` BAND @__parameter_0) = @__parameter_0 + SELECT [o].[HasSoulPatch] + FROM [Officers] AS [o] +) AS [t] +LEFT JOIN ( + SELECT [g0].[Nickname], [g0].[SquadId] + FROM [Gears] AS [g0] + UNION ALL + SELECT [o0].[Nickname], [o0].[SquadId] + FROM [Officers] AS [o0] +) AS [t0] ON [t].[HasSoulPatch] = CAST(1 AS bit) +ORDER BY [t0].[Nickname] """); } - public override async Task Where_has_flag_with_nullable_parameter(bool async) + public override async Task Select_null_propagation_negative6(bool async) { - await base.Where_has_flag_with_nullable_parameter(async); + await base.Select_null_propagation_negative6(async); AssertSql( """ -@__parameter_0='2' (Nullable = true) -@__parameter_0='2' (Nullable = true) - -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, FALSE, NULL) FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g`.`LeaderNickname` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`LeaderNickname` FROM `Officers` AS `o` ) AS `u` -WHERE (`u`.`Rank` BAND @__parameter_0) = @__parameter_0 """); } - public override async Task Select_enum_has_flag(bool async) + public override async Task Select_null_propagation_negative7(bool async) { - await base.Select_enum_has_flag(async); + await base.Select_null_propagation_negative7(async); AssertSql( """ -SELECT TOP 1 CBOOL((`u`.`Rank` BAND 2) BXOR 2) BXOR TRUE AS `hasFlagTrue`, CBOOL((`u`.`Rank` BAND 4) BXOR 4) BXOR TRUE AS `hasFlagFalse` +SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, TRUE, NULL) FROM ( - SELECT `g`.`Rank` + SELECT `g`.`LeaderNickname` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Rank` + SELECT `o`.`LeaderNickname` FROM `Officers` AS `o` ) AS `u` -WHERE (`u`.`Rank` BAND 2) = 2 """); } - public override async Task Where_count_subquery_without_collision(bool async) + public override async Task Select_null_propagation_negative8(bool async) { - await base.Where_count_subquery_without_collision(async); + await base.Select_null_propagation_negative8(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT IIF(`s`.`Id` IS NOT NULL, `c`.`Name`, NULL) +FROM ((`Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName` FROM `Officers` AS `o` -) AS `u` -WHERE ( - SELECT COUNT(*) - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName`) = 2 +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId`) +LEFT JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id`) +LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name` """); } - public override async Task Where_any_subquery_without_collision(bool async) + public override async Task Select_null_propagation_negative9(bool async) { - await base.Where_any_subquery_without_collision(async); + await base.Select_null_propagation_negative9(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, CBOOL(IIF(LEN(`u`.`Nickname`) IS NULL, NULL, CLNG(LEN(`u`.`Nickname`))) BXOR 5) BXOR TRUE, NULL) FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g`.`Nickname`, `g`.`LeaderNickname` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`LeaderNickname` FROM `Officers` AS `o` ) AS `u` -WHERE EXISTS ( - SELECT 1 - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName`) """); } - public override async Task Select_inverted_boolean(bool async) + public override async Task Select_null_propagation_works_for_navigations_with_composite_keys(bool async) { - await base.Select_inverted_boolean(async); + await base.Select_null_propagation_works_for_navigations_with_composite_keys(async); AssertSql( """ -SELECT `w`.`Id`, `w`.`IsAutomatic` BXOR TRUE AS `Manual` -FROM `Weapons` AS `w` -WHERE `w`.`IsAutomatic` = TRUE +SELECT `u`.`Nickname` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` """); } - public override async Task Select_inverted_nullable_boolean(bool async) + public override async Task Select_null_propagation_works_for_multiple_navigations_with_composite_keys(bool async) { - await base.Select_inverted_nullable_boolean(async); + await base.Select_null_propagation_works_for_multiple_navigations_with_composite_keys(async); AssertSql( """ -SELECT `l`.`Id`, `l`.`Eradicated` BXOR TRUE AS `Alive` -FROM `LocustHordes` AS `l` -"""); - } - - public override async Task Select_comparison_with_null(bool async) - { - await base.Select_comparison_with_null(async); - - AssertSql( -""" -@__ammunitionType_0='1' (Nullable = true) -@__ammunitionType_0='1' (Nullable = true) - -SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` = @__ammunitionType_0 AND `w`.`AmmunitionType` IS NOT NULL, TRUE, FALSE) AS `Cartridge` -FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` = @__ammunitionType_0 -""", -// -""" -SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` IS NULL, TRUE, FALSE) AS `Cartridge` -FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` IS NULL +SELECT IIF(`c`.`Name` IS NOT NULL, `c`.`Name`, NULL) +FROM (((`Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId`) +LEFT JOIN `Tags` AS `t0` ON (`u`.`Nickname` = `t0`.`GearNickName` OR (`u`.`Nickname` IS NULL AND `t0`.`GearNickName` IS NULL)) AND (`u`.`SquadId` = `t0`.`GearSquadId` OR (`u`.`SquadId` IS NULL AND `t0`.`GearSquadId` IS NULL))) +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName` + FROM `Officers` AS `o0` +) AS `u0` ON `t0`.`GearNickName` = `u0`.`Nickname` AND `t0`.`GearSquadId` = `u0`.`SquadId`) +LEFT JOIN `Cities` AS `c` ON `u0`.`AssignedCityName` = `c`.`Name` """); } - public override async Task Select_null_parameter(bool async) + public override async Task Select_conditional_with_anonymous_type_and_null_constant(bool async) { - await base.Select_null_parameter(async); + await base.Select_conditional_with_anonymous_type_and_null_constant(async); AssertSql( """ -@__ammunitionType_0='1' (Nullable = true) - -SELECT `w`.`Id`, @__ammunitionType_0 AS `AmmoType` -FROM `Weapons` AS `w` -""", - // - """ -SELECT `w`.`Id`, CVar(NULL) AS `AmmoType` -FROM `Weapons` AS `w` -""", - // - """ -@__ammunitionType_0='2' (Nullable = true) - -SELECT `w`.`Id`, @__ammunitionType_0 AS `AmmoType` -FROM `Weapons` AS `w` -""", - // - """ -SELECT `w`.`Id`, CVar(NULL) AS `AmmoType` -FROM `Weapons` AS `w` -"""); - } - - public override async Task Select_ternary_operation_with_boolean(bool async) - { - await base.Select_ternary_operation_with_boolean(async); - - AssertSql( -""" -SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = TRUE, 1, 0) AS `Num` -FROM `Weapons` AS `w` +SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, TRUE, FALSE), `u`.`HasSoulPatch` +FROM ( + SELECT `g`.`Nickname`, `g`.`HasSoulPatch`, `g`.`LeaderNickname` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`HasSoulPatch`, `o`.`LeaderNickname` + FROM `Officers` AS `o` +) AS `u` +ORDER BY `u`.`Nickname` """); } - public override async Task Select_ternary_operation_with_inverted_boolean(bool async) + public override async Task Select_conditional_with_anonymous_types(bool async) { - await base.Select_ternary_operation_with_inverted_boolean(async); + await base.Select_conditional_with_anonymous_types(async); AssertSql( """ -SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE, 1, 0) AS `Num` -FROM `Weapons` AS `w` +SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, TRUE, FALSE), `u`.`Nickname`, `u`.`FullName` +FROM ( + SELECT `g`.`Nickname`, `g`.`FullName`, `g`.`LeaderNickname` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`FullName`, `o`.`LeaderNickname` + FROM `Officers` AS `o` +) AS `u` +ORDER BY `u`.`Nickname` """); } - public override async Task Select_ternary_operation_with_has_value_not_null(bool async) + public override async Task Where_conditional_equality_1(bool async) { - await base.Select_ternary_operation_with_has_value_not_null(async); + await base.Where_conditional_equality_1(async); AssertSql( -""" -SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` IS NOT NULL AND `w`.`AmmunitionType` = 1, 'Yes', 'No') AS `IsCartridge` -FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` IS NOT NULL AND `w`.`AmmunitionType` = 1 + """ +SELECT `u`.`Nickname` +FROM ( + SELECT `g`.`Nickname`, `g`.`HasSoulPatch`, `g`.`LeaderNickname` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`HasSoulPatch`, `o`.`LeaderNickname` + FROM `Officers` AS `o` +) AS `u` +WHERE `u`.`LeaderNickname` IS NULL +ORDER BY `u`.`Nickname` """); } - public override async Task Select_ternary_operation_multiple_conditions(bool async) + public override async Task Where_conditional_equality_2(bool async) { - await base.Select_ternary_operation_multiple_conditions(async); + await base.Where_conditional_equality_2(async); AssertSql( -""" -SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` = 2 AND `w`.`SynergyWithId` = 1, 'Yes', 'No') AS `IsCartridge` -FROM `Weapons` AS `w` + """ +SELECT `u`.`Nickname` +FROM ( + SELECT `g`.`Nickname`, `g`.`HasSoulPatch`, `g`.`LeaderNickname` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`HasSoulPatch`, `o`.`LeaderNickname` + FROM `Officers` AS `o` +) AS `u` +WHERE `u`.`LeaderNickname` IS NULL +ORDER BY `u`.`Nickname` """); } - public override async Task Select_ternary_operation_multiple_conditions_2(bool async) + public override async Task Where_conditional_equality_3(bool async) { - await base.Select_ternary_operation_multiple_conditions_2(async); + await base.Where_conditional_equality_3(async); AssertSql( """ -SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE AND `w`.`SynergyWithId` = 1, 'Yes', 'No') AS `IsCartridge` -FROM `Weapons` AS `w` +SELECT `u`.`Nickname` +FROM ( + SELECT `g`.`Nickname`, `g`.`LeaderNickname` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`LeaderNickname` + FROM `Officers` AS `o` +) AS `u` +ORDER BY `u`.`Nickname` """); } - public override async Task Select_multiple_conditions(bool async) + public override async Task Select_coalesce_with_anonymous_types(bool async) { - await base.Select_multiple_conditions(async); + await base.Select_coalesce_with_anonymous_types(async); AssertSql( """ -SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE AND `w`.`SynergyWithId` = 1 AND `w`.`SynergyWithId` IS NOT NULL, TRUE, FALSE) AS `IsCartridge` -FROM `Weapons` AS `w` +SELECT `u`.`LeaderNickname`, `u`.`FullName` +FROM ( + SELECT `g`.`Nickname`, `g`.`FullName`, `g`.`LeaderNickname` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`FullName`, `o`.`LeaderNickname` + FROM `Officers` AS `o` +) AS `u` +ORDER BY `u`.`Nickname` """); } - public override async Task Select_nested_ternary_operations(bool async) + public override async Task Where_compare_anonymous_types(bool async) { - await base.Select_nested_ternary_operations(async); + await base.Where_compare_anonymous_types(async); - AssertSql( - """ -SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE, IIF(`w`.`AmmunitionType` = 1, 'ManualCartridge', 'Manual'), 'Auto') AS `IsManualCartridge` -FROM `Weapons` AS `w` -"""); + AssertSql(); } - public override async Task Null_propagation_optimization1(bool async) + public override async Task Where_member_access_on_anonymous_type(bool async) { - await base.Null_propagation_optimization1(async); + await base.Where_member_access_on_anonymous_type(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +SELECT `u`.`Nickname` FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g`.`Nickname`, `g`.`LeaderNickname` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`LeaderNickname` FROM `Officers` AS `o` ) AS `u` WHERE `u`.`LeaderNickname` = 'Marcus' """); } - public override async Task Null_propagation_optimization2(bool async) + public override async Task Where_compare_anonymous_types_with_uncorrelated_members(bool async) { - await base.Null_propagation_optimization2(async); + await base.Where_compare_anonymous_types_with_uncorrelated_members(async); - // issue #16050 AssertSql( -""" -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` + """ +SELECT `u`.`Nickname` FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g`.`Nickname` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname` FROM `Officers` AS `o` ) AS `u` -WHERE IIF(`u`.`LeaderNickname` IS NULL, NULL, IIF(`u`.`LeaderNickname` LIKE '%us', TRUE, FALSE)) = TRUE +WHERE 0 = 1 """); } - public override async Task Null_propagation_optimization3(bool async) + public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scalar(bool async) { - await base.Null_propagation_optimization3(async); + await base.Select_Where_Navigation_Scalar_Equals_Navigation_Scalar(async); - // issue #16050 AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT `s`.`Id`, `s`.`GearNickName`, `s`.`GearSquadId`, `s`.`IssueDate`, `s`.`Note`, `s`.`Id0`, `s`.`GearNickName0`, `s`.`GearSquadId0`, `s`.`IssueDate0`, `s`.`Note0` +FROM (( + SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note`, `t0`.`Id` AS `Id0`, `t0`.`GearNickName` AS `GearNickName0`, `t0`.`GearSquadId` AS `GearSquadId0`, `t0`.`IssueDate` AS `IssueDate0`, `t0`.`Note` AS `Note0` + FROM `Tags` AS `t`, + `Tags` AS `t0` +) AS `s` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` -WHERE IIF(`u`.`LeaderNickname` IS NOT NULL, IIF(`u`.`LeaderNickname` LIKE '%us', TRUE, FALSE), NULL) = TRUE +) AS `u` ON `s`.`GearNickName` = `u`.`Nickname` AND `s`.`GearSquadId` = `u`.`SquadId`) +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId` + FROM `Officers` AS `o0` +) AS `u0` ON `s`.`GearNickName0` = `u0`.`Nickname` AND `s`.`GearSquadId0` = `u0`.`SquadId` +WHERE `u`.`Nickname` = `u0`.`Nickname` OR (`u`.`Nickname` IS NULL AND `u0`.`Nickname` IS NULL) """); } - public override async Task Null_propagation_optimization4(bool async) + public override async Task Conditional_Navigation_With_Trivial_Member_Access(bool async) { - await base.Null_propagation_optimization4(async); + await base.Conditional_Navigation_With_Trivial_Member_Access(async); - // issue #16050 AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT `u`.`Nickname` +FROM (( + SELECT `g`.`Nickname`, `g`.`AssignedCityName`, `g`.`CityOfBirthName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`AssignedCityName`, `o`.`CityOfBirthName` FROM `Officers` AS `o` ) AS `u` -WHERE IIF(`u`.`LeaderNickname` IS NULL, NULL, IIF(LEN(`u`.`LeaderNickname`) IS NULL, NULL, CLNG(LEN(`u`.`LeaderNickname`)))) = 5 +LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name`) +INNER JOIN `Cities` AS `c0` ON `u`.`CityOfBirthName` = `c0`.`Name` +WHERE IIF(`c`.`Name` IS NOT NULL, `c`.`Name`, `c0`.`Name`) <> 'Ephyra' """); } - public override async Task Null_propagation_optimization5(bool async) + public override async Task Conditional_Navigation_With_Member_Access_On_Same_Type(bool async) { - await base.Null_propagation_optimization5(async); + await base.Conditional_Navigation_With_Member_Access_On_Same_Type(async); - // issue #16050 AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT `u`.`Nickname`, `u`.`FullName` +FROM (( + SELECT `g`.`Nickname`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName` FROM `Officers` AS `o` ) AS `u` -WHERE IIF(`u`.`LeaderNickname` IS NOT NULL, IIF(LEN(`u`.`LeaderNickname`) IS NULL, NULL, CLNG(LEN(`u`.`LeaderNickname`))), NULL) = 5 +LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name`) +INNER JOIN `Cities` AS `c0` ON `u`.`CityOfBirthName` = `c0`.`Name` +WHERE IIF(`c`.`Name` IS NOT NULL, `c`.`Nation`, `c0`.`Nation`) = 'Tyrus' """); } - public override async Task Null_propagation_optimization6(bool async) + public override async Task Conditional_Navigation_With_Member_Access_On_Related_Types(bool async) { - await base.Null_propagation_optimization6(async); + await base.Conditional_Navigation_With_Member_Access_On_Related_Types(async); - // issue #16050 AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` +SELECT `l`.`Name` +FROM (`LocustHordes` AS `l` +LEFT JOIN ( + SELECT `l0`.`Name`, `l0`.`ThreatLevel` + FROM `LocustLeaders` AS `l0` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -WHERE IIF(`u`.`LeaderNickname` IS NOT NULL, IIF(LEN(`u`.`LeaderNickname`) IS NULL, NULL, CLNG(LEN(`u`.`LeaderNickname`))), NULL) = 5 + SELECT `l1`.`Name`, `l1`.`ThreatLevel` + FROM `LocustCommanders` AS `l1` +) AS `u` ON `l`.`DeputyCommanderName` = `u`.`Name`) +LEFT JOIN `LocustCommanders` AS `l2` ON `l`.`CommanderName` = `l2`.`Name` +WHERE IIF(`u`.`Name` IS NOT NULL, `u`.`ThreatLevel`, `l2`.`ThreatLevel`) = 4 """); } - public override async Task Select_null_propagation_optimization7(bool async) + public override async Task Select_Singleton_Navigation_With_Member_Access(bool async) { - await base.Select_null_propagation_optimization7(async); + await base.Select_Singleton_Navigation_With_Member_Access(async); - // issue #16050 AssertSql( """ -SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, `u`.`LeaderNickname` & `u`.`LeaderNickname`, NULL) -FROM ( - SELECT `g`.`LeaderNickname` +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`LeaderNickname` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE `u`.`Nickname` = 'Marcus' AND (`u`.`CityOfBirthName` <> 'Ephyra' OR `u`.`CityOfBirthName` IS NULL) """); } - public override async Task Select_null_propagation_optimization8(bool async) + public override async Task Select_Where_Navigation(bool async) { - await base.Select_null_propagation_optimization8(async); + await base.Select_Where_Navigation(async); AssertSql( """ -SELECT IIF(`u`.`LeaderNickname` IS NULL, '', `u`.`LeaderNickname`) & IIF(`u`.`LeaderNickname` IS NULL, '', `u`.`LeaderNickname`) -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`LeaderNickname` +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`LeaderNickname` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE `u`.`Nickname` = 'Marcus' """); } - public override async Task Select_null_propagation_optimization9(bool async) + public override async Task Select_Where_Navigation_Equals_Navigation(bool async) { - await base.Select_null_propagation_optimization9(async); + await base.Select_Where_Navigation_Equals_Navigation(async); AssertSql( """ -SELECT IIF(LEN(`u`.`FullName`) IS NULL, NULL, CLNG(LEN(`u`.`FullName`))) -FROM ( - SELECT `g`.`FullName` +SELECT `s`.`Id`, `s`.`GearNickName`, `s`.`GearSquadId`, `s`.`IssueDate`, `s`.`Note`, `s`.`Id0`, `s`.`GearNickName0`, `s`.`GearSquadId0`, `s`.`IssueDate0`, `s`.`Note0` +FROM (( + SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note`, `t0`.`Id` AS `Id0`, `t0`.`GearNickName` AS `GearNickName0`, `t0`.`GearSquadId` AS `GearSquadId0`, `t0`.`IssueDate` AS `IssueDate0`, `t0`.`Note` AS `Note0` + FROM `Tags` AS `t`, + `Tags` AS `t0` +) AS `s` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`FullName` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` +) AS `u` ON `s`.`GearNickName` = `u`.`Nickname` AND `s`.`GearSquadId` = `u`.`SquadId`) +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId` + FROM `Officers` AS `o0` +) AS `u0` ON `s`.`GearNickName0` = `u0`.`Nickname` AND `s`.`GearSquadId0` = `u0`.`SquadId` +WHERE (`u`.`Nickname` = `u0`.`Nickname` OR (`u`.`Nickname` IS NULL AND `u0`.`Nickname` IS NULL)) AND (`u`.`SquadId` = `u0`.`SquadId` OR (`u`.`SquadId` IS NULL AND `u0`.`SquadId` IS NULL)) """); } - public override async Task Select_null_propagation_negative1(bool async) + public override async Task Select_Where_Navigation_Null(bool async) { - await base.Select_null_propagation_negative1(async); + await base.Select_Where_Navigation_Null(async); AssertSql( """ -SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, CBOOL(IIF(LEN(`u`.`Nickname`) IS NULL, NULL, CLNG(LEN(`u`.`Nickname`))) BXOR 5) BXOR TRUE, NULL) -FROM ( - SELECT `g`.`Nickname`, `g`.`LeaderNickname` +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`LeaderNickname` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE `u`.`Nickname` IS NULL OR `u`.`SquadId` IS NULL """); } - public override async Task Select_null_propagation_negative2(bool async) + public override async Task Select_Where_Navigation_Null_Reverse(bool async) { - await base.Select_null_propagation_negative2(async); + await base.Select_Where_Navigation_Null_Reverse(async); AssertSql( """ -SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, `u0`.`LeaderNickname`, NULL) -FROM ( - SELECT `g`.`LeaderNickname` +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`LeaderNickname` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u`, -( - SELECT `g0`.`LeaderNickname` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`LeaderNickname` - FROM `Officers` AS `o0` -) AS `u0` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE `u`.`Nickname` IS NULL OR `u`.`SquadId` IS NULL """); } - public override async Task Select_null_propagation_negative3(bool async) + public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scalar_Projected(bool async) { - await base.Select_null_propagation_negative3(async); + await base.Select_Where_Navigation_Scalar_Equals_Navigation_Scalar_Projected(async); AssertSql( -""" -SELECT [t0].[Nickname], CASE - WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN CASE - WHEN [t0].[LeaderNickname] IS NOT NULL THEN CAST(1 AS bit) - ELSE CAST(0 AS bit) - END - ELSE NULL -END AS [Condition] -FROM ( - SELECT [g].[HasSoulPatch] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[HasSoulPatch] - FROM [Officers] AS [o] -) AS [t] + """ +SELECT `s`.`Id` AS `Id1`, `s`.`Id0` AS `Id2` +FROM (( + SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t0`.`Id` AS `Id0`, `t0`.`GearNickName` AS `GearNickName0`, `t0`.`GearSquadId` AS `GearSquadId0` + FROM `Tags` AS `t`, + `Tags` AS `t0` +) AS `s` LEFT JOIN ( - SELECT [g0].[Nickname], [g0].[SquadId], [g0].[LeaderNickname] - FROM [Gears] AS [g0] - UNION ALL - SELECT [o0].[Nickname], [o0].[SquadId], [o0].[LeaderNickname] - FROM [Officers] AS [o0] -) AS [t0] ON [t].[HasSoulPatch] = CAST(1 AS bit) -ORDER BY [t0].[Nickname] -"""); - } - - public override async Task Select_null_propagation_negative4(bool async) - { - await base.Select_null_propagation_negative4(async); - - AssertSql( -""" -SELECT CASE - WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) - ELSE CAST(0 AS bit) -END, [t0].[Nickname] -FROM ( - SELECT [g].[HasSoulPatch] - FROM [Gears] AS [g] + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` UNION ALL - SELECT [o].[HasSoulPatch] - FROM [Officers] AS [o] -) AS [t] + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` +) AS `u` ON `s`.`GearNickName` = `u`.`Nickname` AND `s`.`GearSquadId` = `u`.`SquadId`) LEFT JOIN ( - SELECT [g0].[Nickname], [g0].[SquadId] - FROM [Gears] AS [g0] + SELECT `g0`.`Nickname`, `g0`.`SquadId` + FROM `Gears` AS `g0` UNION ALL - SELECT [o0].[Nickname], [o0].[SquadId] - FROM [Officers] AS [o0] -) AS [t0] ON [t].[HasSoulPatch] = CAST(1 AS bit) -ORDER BY [t0].[Nickname] + SELECT `o0`.`Nickname`, `o0`.`SquadId` + FROM `Officers` AS `o0` +) AS `u0` ON `s`.`GearNickName0` = `u0`.`Nickname` AND `s`.`GearSquadId0` = `u0`.`SquadId` +WHERE `u`.`Nickname` = `u0`.`Nickname` OR (`u`.`Nickname` IS NULL AND `u0`.`Nickname` IS NULL) """); } - public override async Task Select_null_propagation_negative5(bool async) + public override async Task Optional_Navigation_Null_Coalesce_To_Clr_Type(bool async) { - await base.Select_null_propagation_negative5(async); + await base.Optional_Navigation_Null_Coalesce_To_Clr_Type(async); AssertSql( """ -SELECT CASE - WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) - ELSE CAST(0 AS bit) -END, [t0].[Nickname] -FROM ( - SELECT [g].[HasSoulPatch] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[HasSoulPatch] - FROM [Officers] AS [o] -) AS [t] -LEFT JOIN ( - SELECT [g0].[Nickname], [g0].[SquadId] - FROM [Gears] AS [g0] - UNION ALL - SELECT [o0].[Nickname], [o0].[SquadId] - FROM [Officers] AS [o0] -) AS [t0] ON [t].[HasSoulPatch] = CAST(1 AS bit) -ORDER BY [t0].[Nickname] +SELECT TOP 1 IIF(`w0`.`IsAutomatic` IS NULL, FALSE, `w0`.`IsAutomatic`) AS `IsAutomatic` +FROM `Weapons` AS `w` +LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +ORDER BY `w`.`Id` """); } - public override async Task Select_null_propagation_negative6(bool async) + public override async Task Where_subquery_boolean(bool async) { - await base.Select_null_propagation_negative6(async); + await base.Where_subquery_boolean(async); AssertSql( """ -SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, FALSE, NULL) +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( - SELECT `g`.`LeaderNickname` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`LeaderNickname` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` +WHERE IIF(( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`) IS NULL, FALSE, ( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`)) = TRUE """); } - public override async Task Select_null_propagation_negative7(bool async) + public override async Task Where_subquery_boolean_with_pushdown(bool async) { - await base.Select_null_propagation_negative7(async); + await base.Where_subquery_boolean_with_pushdown(async); AssertSql( """ -SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, TRUE, NULL) +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( - SELECT `g`.`LeaderNickname` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`LeaderNickname` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` +WHERE ( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`) = TRUE """); } - public override async Task Select_null_propagation_negative8(bool async) + public override async Task Where_subquery_distinct_firstordefault_boolean(bool async) { - await base.Select_null_propagation_negative8(async); + await base.Where_subquery_distinct_firstordefault_boolean(async); AssertSql( - """ -SELECT IIF(`s`.`Id` IS NOT NULL, `c`.`Name`, NULL) -FROM ((`Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName` - FROM `Gears` AS `g` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] +FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId`) -LEFT JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id`) -LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name` + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE(( + SELECT TOP(1) [t0].[IsAutomatic] + FROM ( + SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] + ) AS [t0] + ORDER BY [t0].[Id]), CAST(0 AS bit)) = CAST(1 AS bit) """); } - public override async Task Select_null_propagation_negative9(bool async) + public override async Task Where_subquery_distinct_firstordefault_boolean_with_pushdown(bool async) { - await base.Select_null_propagation_negative9(async); + await base.Where_subquery_distinct_firstordefault_boolean_with_pushdown(async); AssertSql( - """ -SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, CBOOL(IIF(LEN(`u`.`Nickname`) IS NULL, NULL, CLNG(LEN(`u`.`Nickname`))) BXOR 5) BXOR TRUE, NULL) +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM ( - SELECT `g`.`Nickname`, `g`.`LeaderNickname` - FROM `Gears` AS `g` + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`LeaderNickname` - FROM `Officers` AS `o` -) AS `u` + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND ( + SELECT TOP(1) [t0].[IsAutomatic] + FROM ( + SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] + ) AS [t0] + ORDER BY [t0].[Id]) = CAST(1 AS bit) """); } - public override async Task Select_null_propagation_works_for_navigations_with_composite_keys(bool async) + public override async Task Where_subquery_distinct_first_boolean(bool async) { - await base.Select_null_propagation_works_for_navigations_with_composite_keys(async); + await base.Where_subquery_distinct_first_boolean(async); AssertSql( - """ -SELECT `u`.`Nickname` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] +FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND ( + SELECT TOP(1) [t0].[IsAutomatic] + FROM ( + SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] + ) AS [t0] + ORDER BY [t0].[Id]) = CAST(1 AS bit) +ORDER BY [t].[Nickname] """); } - public override async Task Select_null_propagation_works_for_multiple_navigations_with_composite_keys(bool async) + public override async Task Where_subquery_distinct_singleordefault_boolean1(bool async) { - await base.Select_null_propagation_works_for_multiple_navigations_with_composite_keys(async); + await base.Where_subquery_distinct_singleordefault_boolean1(async); AssertSql( - """ -SELECT IIF(`c`.`Name` IS NOT NULL, `c`.`Name`, NULL) -FROM (((`Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId`) -LEFT JOIN `Tags` AS `t0` ON (`u`.`Nickname` = `t0`.`GearNickName` OR (`u`.`Nickname` IS NULL AND `t0`.`GearNickName` IS NULL)) AND (`u`.`SquadId` = `t0`.`GearSquadId` OR (`u`.`SquadId` IS NULL AND `t0`.`GearSquadId` IS NULL))) -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName` - FROM `Gears` AS `g0` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] +FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName` - FROM `Officers` AS `o0` -) AS `u0` ON `t0`.`GearNickName` = `u0`.`Nickname` AND `t0`.`GearSquadId` = `u0`.`SquadId`) -LEFT JOIN `Cities` AS `c` ON `u0`.`AssignedCityName` = `c`.`Name` + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE(( + SELECT TOP(1) [t0].[IsAutomatic] + FROM ( + SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') + ) AS [t0]), CAST(0 AS bit)) = CAST(1 AS bit) +ORDER BY [t].[Nickname] """); } - public override async Task Select_conditional_with_anonymous_type_and_null_constant(bool async) + public override async Task Where_subquery_distinct_singleordefault_boolean2(bool async) { - await base.Select_conditional_with_anonymous_type_and_null_constant(async); + await base.Where_subquery_distinct_singleordefault_boolean2(async); AssertSql( """ -SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, TRUE, FALSE), `u`.`HasSoulPatch` +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( - SELECT `g`.`Nickname`, `g`.`HasSoulPatch`, `g`.`LeaderNickname` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`HasSoulPatch`, `o`.`LeaderNickname` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` +WHERE `u`.`HasSoulPatch` = TRUE AND IIF(( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%')) IS NULL, FALSE, ( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%'))) = TRUE ORDER BY `u`.`Nickname` """); } - public override async Task Select_conditional_with_anonymous_types(bool async) + public override async Task Where_subquery_distinct_singleordefault_boolean_with_pushdown(bool async) { - await base.Select_conditional_with_anonymous_types(async); + await base.Where_subquery_distinct_singleordefault_boolean_with_pushdown(async); AssertSql( - """ -SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, TRUE, FALSE), `u`.`Nickname`, `u`.`FullName` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM ( - SELECT `g`.`Nickname`, `g`.`FullName`, `g`.`LeaderNickname` - FROM `Gears` AS `g` + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`FullName`, `o`.`LeaderNickname` - FROM `Officers` AS `o` -) AS `u` -ORDER BY `u`.`Nickname` + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND ( + SELECT TOP(1) [t0].[IsAutomatic] + FROM ( + SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') + ) AS [t0]) = CAST(1 AS bit) +ORDER BY [t].[Nickname] """); } - public override async Task Where_conditional_equality_1(bool async) + public override async Task Where_subquery_distinct_lastordefault_boolean(bool async) { - await base.Where_conditional_equality_1(async); + await base.Where_subquery_distinct_lastordefault_boolean(async); AssertSql( - """ -SELECT `u`.`Nickname` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM ( - SELECT `g`.`Nickname`, `g`.`HasSoulPatch`, `g`.`LeaderNickname` - FROM `Gears` AS `g` + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`HasSoulPatch`, `o`.`LeaderNickname` - FROM `Officers` AS `o` -) AS `u` -WHERE `u`.`LeaderNickname` IS NULL -ORDER BY `u`.`Nickname` + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +WHERE ( + SELECT TOP(1) [t0].[IsAutomatic] + FROM ( + SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] + ) AS [t0] + ORDER BY [t0].[Id] DESC) = CAST(0 AS bit) +ORDER BY [t].[Nickname] """); } - public override async Task Where_conditional_equality_2(bool async) + public override async Task Where_subquery_distinct_last_boolean(bool async) { - await base.Where_conditional_equality_2(async); + await base.Where_subquery_distinct_last_boolean(async); AssertSql( - """ -SELECT `u`.`Nickname` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM ( - SELECT `g`.`Nickname`, `g`.`HasSoulPatch`, `g`.`LeaderNickname` - FROM `Gears` AS `g` + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`HasSoulPatch`, `o`.`LeaderNickname` - FROM `Officers` AS `o` -) AS `u` -WHERE `u`.`LeaderNickname` IS NULL -ORDER BY `u`.`Nickname` + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(0 AS bit) AND ( + SELECT TOP(1) [t0].[IsAutomatic] + FROM ( + SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] + ) AS [t0] + ORDER BY [t0].[Id] DESC) = CAST(1 AS bit) +ORDER BY [t].[Nickname] """); } - public override async Task Where_conditional_equality_3(bool async) + public override async Task Where_subquery_distinct_orderby_firstordefault_boolean(bool async) { - await base.Where_conditional_equality_3(async); + await base.Where_subquery_distinct_orderby_firstordefault_boolean(async); AssertSql( - """ -SELECT `u`.`Nickname` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM ( - SELECT `g`.`Nickname`, `g`.`LeaderNickname` - FROM `Gears` AS `g` + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`LeaderNickname` - FROM `Officers` AS `o` -) AS `u` -ORDER BY `u`.`Nickname` + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE(( + SELECT TOP(1) [t0].[IsAutomatic] + FROM ( + SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] + ) AS [t0] + ORDER BY [t0].[Id]), CAST(0 AS bit)) = CAST(1 AS bit) """); } - public override async Task Select_coalesce_with_anonymous_types(bool async) + public override async Task Where_subquery_distinct_orderby_firstordefault_boolean_with_pushdown(bool async) { - await base.Select_coalesce_with_anonymous_types(async); + await base.Where_subquery_distinct_orderby_firstordefault_boolean_with_pushdown(async); AssertSql( - """ -SELECT `u`.`LeaderNickname`, `u`.`FullName` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM ( - SELECT `g`.`Nickname`, `g`.`FullName`, `g`.`LeaderNickname` - FROM `Gears` AS `g` + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`FullName`, `o`.`LeaderNickname` - FROM `Officers` AS `o` -) AS `u` -ORDER BY `u`.`Nickname` + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND ( + SELECT TOP(1) [t0].[IsAutomatic] + FROM ( + SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] + ) AS [t0] + ORDER BY [t0].[Id]) = CAST(1 AS bit) """); } - public override async Task Where_compare_anonymous_types(bool async) - { - await base.Where_compare_anonymous_types(async); - - AssertSql(); - } - - public override async Task Where_member_access_on_anonymous_type(bool async) + public override async Task Where_subquery_union_firstordefault_boolean(bool async) { - await base.Where_member_access_on_anonymous_type(async); + await base.Where_subquery_union_firstordefault_boolean(async); AssertSql( - """ -SELECT `u`.`Nickname` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM ( - SELECT `g`.`Nickname`, `g`.`LeaderNickname` - FROM `Gears` AS `g` + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`LeaderNickname` - FROM `Officers` AS `o` -) AS `u` -WHERE `u`.`LeaderNickname` = 'Marcus' + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND ( + SELECT TOP(1) [t0].[IsAutomatic] + FROM ( + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] + UNION + SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] + FROM [Weapons] AS [w0] + WHERE [t].[FullName] = [w0].[OwnerFullName] + ) AS [t0] + ORDER BY [t0].[Id]) = CAST(1 AS bit) """); } - public override async Task Where_compare_anonymous_types_with_uncorrelated_members(bool async) + public override async Task Where_subquery_join_firstordefault_boolean(bool async) { - await base.Where_compare_anonymous_types_with_uncorrelated_members(async); + await base.Where_subquery_join_firstordefault_boolean(async); AssertSql( - """ -SELECT `u`.`Nickname` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM ( - SELECT `g`.`Nickname` - FROM `Gears` AS `g` + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname` - FROM `Officers` AS `o` -) AS `u` -WHERE 0 = 1 + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND ( + SELECT TOP(1) [w].[IsAutomatic] + FROM [Weapons] AS [w] + INNER JOIN ( + SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] + FROM [Weapons] AS [w0] + WHERE [t].[FullName] = [w0].[OwnerFullName] + ) AS [t0] ON [w].[Id] = [t0].[Id] + WHERE [t].[FullName] = [w].[OwnerFullName] + ORDER BY [w].[Id]) = CAST(1 AS bit) """); } - public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scalar(bool async) + public override async Task Where_subquery_left_join_firstordefault_boolean(bool async) { - await base.Select_Where_Navigation_Scalar_Equals_Navigation_Scalar(async); + await base.Where_subquery_left_join_firstordefault_boolean(async); AssertSql( - """ -SELECT `s`.`Id`, `s`.`GearNickName`, `s`.`GearSquadId`, `s`.`IssueDate`, `s`.`Note`, `s`.`Id0`, `s`.`GearNickName0`, `s`.`GearSquadId0`, `s`.`IssueDate0`, `s`.`Note0` -FROM (( - SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note`, `t0`.`Id` AS `Id0`, `t0`.`GearNickName` AS `GearNickName0`, `t0`.`GearSquadId` AS `GearSquadId0`, `t0`.`IssueDate` AS `IssueDate0`, `t0`.`Note` AS `Note0` - FROM `Tags` AS `t`, - `Tags` AS `t0` -) AS `s` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `s`.`GearNickName` = `u`.`Nickname` AND `s`.`GearSquadId` = `u`.`SquadId`) -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId` - FROM `Gears` AS `g0` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] +FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId` - FROM `Officers` AS `o0` -) AS `u0` ON `s`.`GearNickName0` = `u0`.`Nickname` AND `s`.`GearSquadId0` = `u0`.`SquadId` -WHERE `u`.`Nickname` = `u0`.`Nickname` OR (`u`.`Nickname` IS NULL AND `u0`.`Nickname` IS NULL) + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND ( + SELECT TOP(1) [w].[IsAutomatic] + FROM [Weapons] AS [w] + LEFT JOIN ( + SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] + FROM [Weapons] AS [w0] + WHERE [t].[FullName] = [w0].[OwnerFullName] + ) AS [t0] ON [w].[Id] = [t0].[Id] + WHERE [t].[FullName] = [w].[OwnerFullName] + ORDER BY [w].[Id]) = CAST(1 AS bit) """); } - public override async Task Select_Singleton_Navigation_With_Member_Access(bool async) + public override async Task Where_subquery_concat_firstordefault_boolean(bool async) { - await base.Select_Singleton_Navigation_With_Member_Access(async); + await base.Where_subquery_concat_firstordefault_boolean(async); AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] +FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE `u`.`Nickname` = 'Marcus' AND (`u`.`CityOfBirthName` <> 'Ephyra' OR `u`.`CityOfBirthName` IS NULL) + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND ( + SELECT TOP(1) [t0].[IsAutomatic] + FROM ( + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] + UNION ALL + SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] + FROM [Weapons] AS [w0] + WHERE [t].[FullName] = [w0].[OwnerFullName] + ) AS [t0] + ORDER BY [t0].[Id]) = CAST(1 AS bit) """); } - public override async Task Select_Where_Navigation(bool async) + public override async Task Concat_with_count(bool async) { - await base.Select_Where_Navigation(async); + await base.Concat_with_count(async); AssertSql( """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` +SELECT COUNT(*) +FROM ( + SELECT 1 FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` + SELECT 1 FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE `u`.`Nickname` = 'Marcus' + UNION ALL + SELECT 1 + FROM `Gears` AS `g0` + UNION ALL + SELECT 1 + FROM `Officers` AS `o0` +) AS `u1` """); } - public override async Task Select_Where_Navigation_Equals_Navigation(bool async) + public override async Task Concat_scalars_with_count(bool async) { - await base.Select_Where_Navigation_Equals_Navigation(async); + await base.Concat_scalars_with_count(async); AssertSql( """ -SELECT `s`.`Id`, `s`.`GearNickName`, `s`.`GearSquadId`, `s`.`IssueDate`, `s`.`Note`, `s`.`Id0`, `s`.`GearNickName0`, `s`.`GearSquadId0`, `s`.`IssueDate0`, `s`.`Note0` -FROM (( - SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note`, `t0`.`Id` AS `Id0`, `t0`.`GearNickName` AS `GearNickName0`, `t0`.`GearSquadId` AS `GearSquadId0`, `t0`.`IssueDate` AS `IssueDate0`, `t0`.`Note` AS `Note0` - FROM `Tags` AS `t`, - `Tags` AS `t0` -) AS `s` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` +SELECT COUNT(*) +FROM ( + SELECT 1 FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` + SELECT 1 FROM `Officers` AS `o` -) AS `u` ON `s`.`GearNickName` = `u`.`Nickname` AND `s`.`GearSquadId` = `u`.`SquadId`) -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId` + UNION ALL + SELECT 1 FROM `Gears` AS `g0` UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId` + SELECT 1 FROM `Officers` AS `o0` -) AS `u0` ON `s`.`GearNickName0` = `u0`.`Nickname` AND `s`.`GearSquadId0` = `u0`.`SquadId` -WHERE (`u`.`Nickname` = `u0`.`Nickname` OR (`u`.`Nickname` IS NULL AND `u0`.`Nickname` IS NULL)) AND (`u`.`SquadId` = `u0`.`SquadId` OR (`u`.`SquadId` IS NULL AND `u0`.`SquadId` IS NULL)) +) AS `u1` """); } - public override async Task Select_Where_Navigation_Null(bool async) + public override async Task Concat_anonymous_with_count(bool async) { - await base.Select_Where_Navigation_Null(async); + await base.Concat_anonymous_with_count(async); AssertSql( """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` +SELECT COUNT(*) +FROM ( + SELECT 1 + FROM ( + SELECT 1 + FROM `Gears` AS `g` + UNION ALL + SELECT 1 + FROM `Officers` AS `o` + ) AS `u` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE `u`.`Nickname` IS NULL OR `u`.`SquadId` IS NULL + SELECT 1 + FROM ( + SELECT 1 + FROM `Gears` AS `g0` + UNION ALL + SELECT 1 + FROM `Officers` AS `o0` + ) AS `u0` +) AS `u1` """); } - public override async Task Select_Where_Navigation_Null_Reverse(bool async) + public override async Task Concat_with_scalar_projection(bool async) { - await base.Select_Where_Navigation_Null_Reverse(async); - - AssertSql( - """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE `u`.`Nickname` IS NULL OR `u`.`SquadId` IS NULL -"""); - } - - public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scalar_Projected(bool async) - { - await base.Select_Where_Navigation_Scalar_Equals_Navigation_Scalar_Projected(async); - - AssertSql( - """ -SELECT `s`.`Id` AS `Id1`, `s`.`Id0` AS `Id2` -FROM (( - SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t0`.`Id` AS `Id0`, `t0`.`GearNickName` AS `GearNickName0`, `t0`.`GearSquadId` AS `GearSquadId0` - FROM `Tags` AS `t`, - `Tags` AS `t0` -) AS `s` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `s`.`GearNickName` = `u`.`Nickname` AND `s`.`GearSquadId` = `u`.`SquadId`) -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId` - FROM `Officers` AS `o0` -) AS `u0` ON `s`.`GearNickName0` = `u0`.`Nickname` AND `s`.`GearSquadId0` = `u0`.`SquadId` -WHERE `u`.`Nickname` = `u0`.`Nickname` OR (`u`.`Nickname` IS NULL AND `u0`.`Nickname` IS NULL) -"""); - } - - public override async Task Optional_Navigation_Null_Coalesce_To_Clr_Type(bool async) - { - await base.Optional_Navigation_Null_Coalesce_To_Clr_Type(async); + await base.Concat_with_scalar_projection(async); AssertSql( """ -SELECT TOP 1 IIF(`w0`.`IsAutomatic` IS NULL, FALSE, `w0`.`IsAutomatic`) AS `IsAutomatic` -FROM `Weapons` AS `w` -LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY `w`.`Id` +SELECT `g`.`Nickname` +FROM `Gears` AS `g` +UNION ALL +SELECT `o`.`Nickname` +FROM `Officers` AS `o` +UNION ALL +SELECT `g0`.`Nickname` +FROM `Gears` AS `g0` +UNION ALL +SELECT `o0`.`Nickname` +FROM `Officers` AS `o0` """); } - public override async Task Where_subquery_boolean(bool async) + public override async Task Select_navigation_with_concat_and_count(bool async) { - await base.Where_subquery_boolean(async); + await base.Select_navigation_with_concat_and_count(async); AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +""" +SELECT ( + SELECT COUNT(*) + FROM ( + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] + UNION ALL + SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] + FROM [Weapons] AS [w0] + WHERE [t].[FullName] = [w0].[OwnerFullName] + ) AS [t0]) FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` + SELECT [g].[FullName], [g].[HasSoulPatch] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -WHERE IIF(( - SELECT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`) IS NULL, FALSE, ( - SELECT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`)) = TRUE + SELECT [o].[FullName], [o].[HasSoulPatch] + FROM [Officers] AS [o] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(0 AS bit) """); } - public override async Task Where_subquery_boolean_with_pushdown(bool async) + public override async Task Concat_with_collection_navigations(bool async) { - await base.Where_subquery_boolean_with_pushdown(async); + await base.Concat_with_collection_navigations(async); AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +""" +SELECT ( + SELECT COUNT(*) + FROM ( + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] + UNION + SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] + FROM [Weapons] AS [w0] + WHERE [t].[FullName] = [w0].[OwnerFullName] + ) AS [t0]) FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` + SELECT [g].[FullName], [g].[HasSoulPatch] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -WHERE ( - SELECT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`) = TRUE + SELECT [o].[FullName], [o].[HasSoulPatch] + FROM [Officers] AS [o] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) """); } - public override async Task Where_subquery_distinct_firstordefault_boolean(bool async) + public override async Task Union_with_collection_navigations(bool async) { - await base.Where_subquery_distinct_firstordefault_boolean(async); + await base.Union_with_collection_navigations(async); AssertSql( """ -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] +SELECT ( + SELECT COUNT(*) + FROM ( + SELECT [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] + FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] + UNION ALL + SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o0] + ) AS [t1] + WHERE [t].[Nickname] = [t1].[LeaderNickname] AND [t].[SquadId] = [t1].[LeaderSquadId] + UNION + SELECT [t2].[Nickname], [t2].[SquadId], [t2].[AssignedCityName], [t2].[CityOfBirthName], [t2].[FullName], [t2].[HasSoulPatch], [t2].[LeaderNickname], [t2].[LeaderSquadId], [t2].[Rank], [t2].[Discriminator] + 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] + UNION ALL + SELECT [o1].[Nickname], [o1].[SquadId], [o1].[AssignedCityName], [o1].[CityOfBirthName], [o1].[FullName], [o1].[HasSoulPatch], [o1].[LeaderNickname], [o1].[LeaderSquadId], [o1].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o1] + ) AS [t2] + WHERE [t].[Nickname] = [t2].[LeaderNickname] AND [t].[SquadId] = [t2].[LeaderSquadId] + ) AS [t0]) FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE(( - SELECT TOP(1) [t0].[IsAutomatic] - FROM ( - SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] - ) AS [t0] - ORDER BY [t0].[Id]), CAST(0 AS bit)) = CAST(1 AS bit) """); } - public override async Task Where_subquery_distinct_firstordefault_boolean_with_pushdown(bool async) + public override async Task Select_subquery_distinct_firstordefault(bool async) { - await base.Where_subquery_distinct_firstordefault_boolean_with_pushdown(async); + await base.Select_subquery_distinct_firstordefault(async); AssertSql( """ -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] -FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND ( - SELECT TOP(1) [t0].[IsAutomatic] +SELECT ( + SELECT TOP(1) [t0].[Name] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] WHERE [t].[FullName] = [w].[OwnerFullName] ) AS [t0] - ORDER BY [t0].[Id]) = CAST(1 AS bit) -"""); - } - - public override async Task Where_subquery_distinct_first_boolean(bool async) - { - await base.Where_subquery_distinct_first_boolean(async); - - AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] + ORDER BY [t0].[Id]) FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + SELECT [g].[FullName], [g].[HasSoulPatch] FROM [Gears] AS [g] UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + SELECT [o].[FullName], [o].[HasSoulPatch] FROM [Officers] AS [o] ) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND ( - SELECT TOP(1) [t0].[IsAutomatic] - FROM ( - SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] - ) AS [t0] - ORDER BY [t0].[Id]) = CAST(1 AS bit) -ORDER BY [t].[Nickname] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) """); } - public override async Task Where_subquery_distinct_singleordefault_boolean1(bool async) + public override async Task Singleton_Navigation_With_Member_Access(bool async) { - await base.Where_subquery_distinct_singleordefault_boolean1(async); + await base.Singleton_Navigation_With_Member_Access(async); AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] -FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] + """ +SELECT `u`.`CityOfBirthName` AS `B` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`CityOfBirthName` + FROM `Gears` AS `g` UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE(( - SELECT TOP(1) [t0].[IsAutomatic] - FROM ( - SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') - ) AS [t0]), CAST(0 AS bit)) = CAST(1 AS bit) -ORDER BY [t].[Nickname] + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`CityOfBirthName` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE `u`.`Nickname` = 'Marcus' AND (`u`.`CityOfBirthName` <> 'Ephyra' OR `u`.`CityOfBirthName` IS NULL) """); } - public override async Task Where_subquery_distinct_singleordefault_boolean2(bool async) + public override async Task GroupJoin_Composite_Key(bool async) { - await base.Where_subquery_distinct_singleordefault_boolean2(async); + await base.GroupJoin_Composite_Key(async); AssertSql( """ SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( +FROM `Tags` AS `t` +INNER JOIN ( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u` -WHERE `u`.`HasSoulPatch` = TRUE AND IIF(( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%')) IS NULL, FALSE, ( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%'))) = TRUE -ORDER BY `u`.`Nickname` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` """); } - public override async Task Where_subquery_distinct_singleordefault_boolean_with_pushdown(bool async) + public override async Task Join_navigation_translated_to_subquery_composite_key(bool async) { - await base.Where_subquery_distinct_singleordefault_boolean_with_pushdown(async); + await base.Join_navigation_translated_to_subquery_composite_key(async); AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] + """ +SELECT `u`.`FullName`, `s`.`Note` FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] + SELECT `g`.`FullName` + FROM `Gears` AS `g` UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND ( - SELECT TOP(1) [t0].[IsAutomatic] - FROM ( - SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') - ) AS [t0]) = CAST(1 AS bit) -ORDER BY [t].[Nickname] + SELECT `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` +INNER JOIN ( + SELECT `t`.`Note`, `u0`.`FullName` + FROM `Tags` AS `t` + LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName` + FROM `Officers` AS `o0` + ) AS `u0` ON `t`.`GearNickName` = `u0`.`Nickname` AND `t`.`GearSquadId` = `u0`.`SquadId` +) AS `s` ON `u`.`FullName` = `s`.`FullName` """); } - public override async Task Where_subquery_distinct_lastordefault_boolean(bool async) + public override async Task Join_with_order_by_on_inner_sequence_navigation_translated_to_subquery_composite_key(bool async) { - await base.Where_subquery_distinct_lastordefault_boolean(async); + await base.Join_with_order_by_on_inner_sequence_navigation_translated_to_subquery_composite_key(async); AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] + """ +SELECT `u`.`FullName`, `s`.`Note` FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] + SELECT `g`.`FullName` + FROM `Gears` AS `g` UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -WHERE ( - SELECT TOP(1) [t0].[IsAutomatic] - FROM ( - SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] - ) AS [t0] - ORDER BY [t0].[Id] DESC) = CAST(0 AS bit) -ORDER BY [t].[Nickname] + SELECT `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` +INNER JOIN ( + SELECT `t`.`Note`, `u0`.`FullName` + FROM `Tags` AS `t` + LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName` + FROM `Officers` AS `o0` + ) AS `u0` ON `t`.`GearNickName` = `u0`.`Nickname` AND `t`.`GearSquadId` = `u0`.`SquadId` +) AS `s` ON `u`.`FullName` = `s`.`FullName` """); } - public override async Task Where_subquery_distinct_last_boolean(bool async) + public override async Task Join_with_order_by_without_skip_or_take(bool async) { - await base.Where_subquery_distinct_last_boolean(async); + await base.Join_with_order_by_without_skip_or_take(async); AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] + """ +SELECT `w`.`Name`, `u`.`FullName` FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] + SELECT `g`.`FullName` + FROM `Gears` AS `g` UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(0 AS bit) AND ( - SELECT TOP(1) [t0].[IsAutomatic] - FROM ( - SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] - ) AS [t0] - ORDER BY [t0].[Id] DESC) = CAST(1 AS bit) -ORDER BY [t].[Nickname] + SELECT `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` +INNER JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` """); } - public override async Task Where_subquery_distinct_orderby_firstordefault_boolean(bool async) + public override async Task Join_with_order_by_without_skip_or_take_nested(bool async) { - await base.Where_subquery_distinct_orderby_firstordefault_boolean(async); + await base.Join_with_order_by_without_skip_or_take_nested(async); AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] -FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] + """ +SELECT `w`.`Name`, `u`.`FullName` +FROM (`Squads` AS `s` +INNER JOIN ( + SELECT `g`.`SquadId`, `g`.`FullName` + FROM `Gears` AS `g` UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE(( - SELECT TOP(1) [t0].[IsAutomatic] - FROM ( - SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] - ) AS [t0] - ORDER BY [t0].[Id]), CAST(0 AS bit)) = CAST(1 AS bit) + SELECT `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` ON `s`.`Id` = `u`.`SquadId`) +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` +WHERE `u`.`FullName` IS NOT NULL AND `w`.`OwnerFullName` IS NOT NULL """); } - public override async Task Where_subquery_distinct_orderby_firstordefault_boolean_with_pushdown(bool async) + public override async Task Collection_with_inheritance_and_join_include_joined(bool async) { - await base.Where_subquery_distinct_orderby_firstordefault_boolean_with_pushdown(async); + await base.Collection_with_inheritance_and_join_include_joined(async); AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] -FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND ( - SELECT TOP(1) [t0].[IsAutomatic] - FROM ( - SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] - ) AS [t0] - ORDER BY [t0].[Id]) = CAST(1 AS bit) + """ +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `t0`.`Id`, `t0`.`GearNickName`, `t0`.`GearSquadId`, `t0`.`IssueDate`, `t0`.`Note` +FROM (`Tags` AS `t` +INNER JOIN ( + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearSquadId` = `u`.`SquadId` AND `t`.`GearNickName` = `u`.`Nickname`) +LEFT JOIN `Tags` AS `t0` ON `u`.`Nickname` = `t0`.`GearNickName` AND `u`.`SquadId` = `t0`.`GearSquadId` """); } - public override async Task Where_subquery_union_firstordefault_boolean(bool async) + public override async Task Collection_with_inheritance_and_join_include_source(bool async) { - await base.Where_subquery_union_firstordefault_boolean(async); + await base.Collection_with_inheritance_and_join_include_source(async); AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] -FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND ( - SELECT TOP(1) [t0].[IsAutomatic] - FROM ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] - UNION - SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] - FROM [Weapons] AS [w0] - WHERE [t].[FullName] = [w0].[OwnerFullName] - ) AS [t0] - ORDER BY [t0].[Id]) = CAST(1 AS bit) + """ +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `t0`.`Id`, `t0`.`GearNickName`, `t0`.`GearSquadId`, `t0`.`IssueDate`, `t0`.`Note` +FROM (( + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +INNER JOIN `Tags` AS `t` ON `u`.`SquadId` = `t`.`GearSquadId` AND `u`.`Nickname` = `t`.`GearNickName`) +LEFT JOIN `Tags` AS `t0` ON `u`.`Nickname` = `t0`.`GearNickName` AND `u`.`SquadId` = `t0`.`GearSquadId` """); } - public override async Task Where_subquery_join_firstordefault_boolean(bool async) + public override async Task Non_unicode_string_literal_is_used_for_non_unicode_column(bool async) { - await base.Where_subquery_join_firstordefault_boolean(async); + await base.Non_unicode_string_literal_is_used_for_non_unicode_column(async); AssertSql( """ -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] -FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND ( - SELECT TOP(1) [w].[IsAutomatic] - FROM [Weapons] AS [w] - INNER JOIN ( - SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] - FROM [Weapons] AS [w0] - WHERE [t].[FullName] = [w0].[OwnerFullName] - ) AS [t0] ON [w].[Id] = [t0].[Id] - WHERE [t].[FullName] = [w].[OwnerFullName] - ORDER BY [w].[Id]) = CAST(1 AS bit) +SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` +FROM `Cities` AS `c` +WHERE `c`.`Location` = 'Unknown' """); } - public override async Task Where_subquery_left_join_firstordefault_boolean(bool async) + public override async Task Non_unicode_string_literal_is_used_for_non_unicode_column_right(bool async) { - await base.Where_subquery_left_join_firstordefault_boolean(async); + await base.Non_unicode_string_literal_is_used_for_non_unicode_column_right(async); AssertSql( """ -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] -FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND ( - SELECT TOP(1) [w].[IsAutomatic] - FROM [Weapons] AS [w] - LEFT JOIN ( - SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] - FROM [Weapons] AS [w0] - WHERE [t].[FullName] = [w0].[OwnerFullName] - ) AS [t0] ON [w].[Id] = [t0].[Id] - WHERE [t].[FullName] = [w].[OwnerFullName] - ORDER BY [w].[Id]) = CAST(1 AS bit) +SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` +FROM `Cities` AS `c` +WHERE 'Unknown' = `c`.`Location` """); } - public override async Task Where_subquery_concat_firstordefault_boolean(bool async) + public override async Task Non_unicode_parameter_is_used_for_non_unicode_column(bool async) { - await base.Where_subquery_concat_firstordefault_boolean(async); - - AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] -FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND ( - SELECT TOP(1) [t0].[IsAutomatic] - FROM ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] - UNION ALL - SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] - FROM [Weapons] AS [w0] - WHERE [t].[FullName] = [w0].[OwnerFullName] - ) AS [t0] - ORDER BY [t0].[Id]) = CAST(1 AS bit) -"""); - } - - public override async Task Concat_with_count(bool async) - { - await base.Concat_with_count(async); + await base.Non_unicode_parameter_is_used_for_non_unicode_column(async); AssertSql( """ -SELECT COUNT(*) -FROM ( - SELECT 1 - FROM `Gears` AS `g` - UNION ALL - SELECT 1 - FROM `Officers` AS `o` - UNION ALL - SELECT 1 - FROM `Gears` AS `g0` - UNION ALL - SELECT 1 - FROM `Officers` AS `o0` -) AS `u1` +@value='Unknown' (Size = 100) + +SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` +FROM `Cities` AS `c` +WHERE `c`.`Location` = @value """); } - public override async Task Concat_scalars_with_count(bool async) + public override async Task Non_unicode_string_literals_in_contains_is_used_for_non_unicode_column(bool async) { - await base.Concat_scalars_with_count(async); + await base.Non_unicode_string_literals_in_contains_is_used_for_non_unicode_column(async); AssertSql( - """ -SELECT COUNT(*) -FROM ( - SELECT 1 - FROM `Gears` AS `g` - UNION ALL - SELECT 1 - FROM `Officers` AS `o` - UNION ALL - SELECT 1 - FROM `Gears` AS `g0` - UNION ALL - SELECT 1 - FROM `Officers` AS `o0` -) AS `u1` +""" +SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` +FROM `Cities` AS `c` +WHERE `c`.`Location` IN ('Unknown', 'Jacinto''s location', 'Ephyra''s location') """); } - public override async Task Concat_anonymous_with_count(bool async) + public override async Task Non_unicode_string_literals_is_used_for_non_unicode_column_with_subquery(bool async) { - await base.Concat_anonymous_with_count(async); + await base.Non_unicode_string_literals_is_used_for_non_unicode_column_with_subquery(async); AssertSql( """ -SELECT COUNT(*) -FROM ( - SELECT 1 +SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` +FROM `Cities` AS `c` +WHERE `c`.`Location` = 'Unknown' AND ( + SELECT COUNT(*) FROM ( - SELECT 1 + SELECT `g`.`Nickname`, `g`.`CityOfBirthName` FROM `Gears` AS `g` UNION ALL - SELECT 1 + SELECT `o`.`Nickname`, `o`.`CityOfBirthName` FROM `Officers` AS `o` ) AS `u` - UNION ALL - SELECT 1 - FROM ( - SELECT 1 - FROM `Gears` AS `g0` - UNION ALL - SELECT 1 - FROM `Officers` AS `o0` - ) AS `u0` -) AS `u1` -"""); - } - - public override async Task Concat_with_scalar_projection(bool async) - { - await base.Concat_with_scalar_projection(async); - - AssertSql( -""" -SELECT `g`.`Nickname` -FROM `Gears` AS `g` -UNION ALL -SELECT `o`.`Nickname` -FROM `Officers` AS `o` -UNION ALL -SELECT `g0`.`Nickname` -FROM `Gears` AS `g0` -UNION ALL -SELECT `o0`.`Nickname` -FROM `Officers` AS `o0` -"""); - } - - public override async Task Select_navigation_with_concat_and_count(bool async) - { - await base.Select_navigation_with_concat_and_count(async); - - AssertSql( -""" -SELECT ( - SELECT COUNT(*) - FROM ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] - UNION ALL - SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] - FROM [Weapons] AS [w0] - WHERE [t].[FullName] = [w0].[OwnerFullName] - ) AS [t0]) -FROM ( - SELECT [g].[FullName], [g].[HasSoulPatch] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[FullName], [o].[HasSoulPatch] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(0 AS bit) + WHERE `c`.`Name` = `u`.`CityOfBirthName` AND `u`.`Nickname` = 'Paduk') = 1 """); } - public override async Task Concat_with_collection_navigations(bool async) + public override async Task Non_unicode_string_literals_is_used_for_non_unicode_column_in_subquery(bool async) { - await base.Concat_with_collection_navigations(async); + await base.Non_unicode_string_literals_is_used_for_non_unicode_column_in_subquery(async); AssertSql( -""" -SELECT ( - SELECT COUNT(*) - FROM ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] - UNION - SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] - FROM [Weapons] AS [w0] - WHERE [t].[FullName] = [w0].[OwnerFullName] - ) AS [t0]) + """ +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( - SELECT [g].[FullName], [g].[HasSoulPatch] - FROM [Gears] AS [g] + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` UNION ALL - SELECT [o].[FullName], [o].[HasSoulPatch] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +INNER JOIN `Cities` AS `c` ON `u`.`CityOfBirthName` = `c`.`Name` +WHERE `u`.`Nickname` = 'Marcus' AND `c`.`Location` = 'Jacinto''s location' """); } - public override async Task Union_with_collection_navigations(bool async) + public override async Task Non_unicode_string_literals_is_used_for_non_unicode_column_with_contains(bool async) { - await base.Union_with_collection_navigations(async); + await base.Non_unicode_string_literals_is_used_for_non_unicode_column_with_contains(async); AssertSql( """ -SELECT ( - SELECT COUNT(*) - FROM ( - SELECT [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o0] - ) AS [t1] - WHERE [t].[Nickname] = [t1].[LeaderNickname] AND [t].[SquadId] = [t1].[LeaderSquadId] - UNION - SELECT [t2].[Nickname], [t2].[SquadId], [t2].[AssignedCityName], [t2].[CityOfBirthName], [t2].[FullName], [t2].[HasSoulPatch], [t2].[LeaderNickname], [t2].[LeaderSquadId], [t2].[Rank], [t2].[Discriminator] - 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] - UNION ALL - SELECT [o1].[Nickname], [o1].[SquadId], [o1].[AssignedCityName], [o1].[CityOfBirthName], [o1].[FullName], [o1].[HasSoulPatch], [o1].[LeaderNickname], [o1].[LeaderSquadId], [o1].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o1] - ) AS [t2] - WHERE [t].[Nickname] = [t2].[LeaderNickname] AND [t].[SquadId] = [t2].[LeaderSquadId] - ) AS [t0]) -FROM ( - SELECT [o].[Nickname], [o].[SquadId] - FROM [Officers] AS [o] -) AS [t] +SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` +FROM `Cities` AS `c` +WHERE `c`.`Location` LIKE '%Jacinto%' """); } - public override async Task Select_subquery_distinct_firstordefault(bool async) + public override async Task Unicode_string_literals_is_used_for_non_unicode_column_with_concat(bool async) { - await base.Select_subquery_distinct_firstordefault(async); + await base.Unicode_string_literals_is_used_for_non_unicode_column_with_concat(async); AssertSql( """ -SELECT ( - SELECT TOP(1) [t0].[Name] - FROM ( - SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] - ) AS [t0] - ORDER BY [t0].[Id]) -FROM ( - SELECT [g].[FullName], [g].[HasSoulPatch] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[FullName], [o].[HasSoulPatch] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) +SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` +FROM `Cities` AS `c` +WHERE IIF(`c`.`Location` IS NULL, '', `c`.`Location`) & 'Added' LIKE '%Add%' """); } - public override async Task Singleton_Navigation_With_Member_Access(bool async) + public override void Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result1() { - await base.Singleton_Navigation_With_Member_Access(async); + base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result1(); AssertSql( """ -SELECT `u`.`CityOfBirthName` AS `B` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`CityOfBirthName` +SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM (( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`CityOfBirthName` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE `u`.`Nickname` = 'Marcus' AND (`u`.`CityOfBirthName` <> 'Ephyra' OR `u`.`CityOfBirthName` IS NULL) +) AS `u` +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` +) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname`) +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname`, `u0`.`SquadId` """); } - public override async Task GroupJoin_Composite_Key(bool async) + public override void Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result2() { - await base.GroupJoin_Composite_Key(async); + base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result2(); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM `Tags` AS `t` -INNER JOIN ( +SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +FROM (( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +) AS `u` +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` +) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname`) +LEFT JOIN `Weapons` AS `w` ON `u0`.`FullName` = `w`.`OwnerFullName` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname`, `u0`.`SquadId` """); } - public override async Task Join_navigation_translated_to_subquery_composite_key(bool async) + public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result3(bool async) { - await base.Join_navigation_translated_to_subquery_composite_key(async); + await base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result3(async); + // Issue#16897 AssertSql( """ -SELECT `u`.`FullName`, `s`.`Note` -FROM ( - SELECT `g`.`FullName` +SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` +FROM ((( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`FullName` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -INNER JOIN ( - SELECT `t`.`Note`, `u0`.`FullName` - FROM `Tags` AS `t` - LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName` - FROM `Officers` AS `o0` - ) AS `u0` ON `t`.`GearNickName` = `u0`.`Nickname` AND `t`.`GearSquadId` = `u0`.`SquadId` -) AS `s` ON `u`.`FullName` = `s`.`FullName` +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` +) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname`) +LEFT JOIN `Weapons` AS `w` ON `u0`.`FullName` = `w`.`OwnerFullName`) +LEFT JOIN `Weapons` AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id` """); } - public override async Task Join_with_order_by_on_inner_sequence_navigation_translated_to_subquery_composite_key(bool async) + public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result4(bool async) { - await base.Join_with_order_by_on_inner_sequence_navigation_translated_to_subquery_composite_key(async); + await base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result4(async); + // Issue#16897 AssertSql( """ -SELECT `u`.`FullName`, `s`.`Note` -FROM ( - SELECT `g`.`FullName` +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId`, `w1`.`Id`, `w1`.`AmmunitionType`, `w1`.`IsAutomatic`, `w1`.`Name`, `w1`.`OwnerFullName`, `w1`.`SynergyWithId`, `w2`.`Id`, `w2`.`AmmunitionType`, `w2`.`IsAutomatic`, `w2`.`Name`, `w2`.`OwnerFullName`, `w2`.`SynergyWithId` +FROM ((((( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`FullName` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -INNER JOIN ( - SELECT `t`.`Note`, `u0`.`FullName` - FROM `Tags` AS `t` - LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName` - FROM `Officers` AS `o0` - ) AS `u0` ON `t`.`GearNickName` = `u0`.`Nickname` AND `t`.`GearSquadId` = `u0`.`SquadId` -) AS `s` ON `u`.`FullName` = `s`.`FullName` +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` +) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname`) +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName`) +LEFT JOIN `Weapons` AS `w0` ON `u0`.`FullName` = `w0`.`OwnerFullName`) +LEFT JOIN `Weapons` AS `w1` ON `u0`.`FullName` = `w1`.`OwnerFullName`) +LEFT JOIN `Weapons` AS `w2` ON `u`.`FullName` = `w2`.`OwnerFullName` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id` """); } - public override async Task Join_with_order_by_without_skip_or_take(bool async) + public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_inheritance_and_coalesce_result(bool async) { - await base.Join_with_order_by_without_skip_or_take(async); + await base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_inheritance_and_coalesce_result(async); + // Issue#16897 AssertSql( """ -SELECT `w`.`Name`, `u`.`FullName` -FROM ( - SELECT `g`.`FullName` +SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` +FROM ((( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`FullName` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -INNER JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` +LEFT JOIN ( + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` +) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname`) +LEFT JOIN `Weapons` AS `w` ON `u0`.`FullName` = `w`.`OwnerFullName`) +LEFT JOIN `Weapons` AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id` """); } - public override async Task Join_with_order_by_without_skip_or_take_nested(bool async) + public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_conditional_result(bool async) { - await base.Join_with_order_by_without_skip_or_take_nested(async); + await base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_conditional_result(async); + // Issue#16897 AssertSql( """ -SELECT `w`.`Name`, `u`.`FullName` -FROM (`Squads` AS `s` -INNER JOIN ( - SELECT `g`.`SquadId`, `g`.`FullName` +SELECT IIF(`u0`.`Nickname` IS NOT NULL AND `u0`.`SquadId` IS NOT NULL, TRUE, FALSE), `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` +FROM ((( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`SquadId`, `o`.`FullName` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u` ON `s`.`Id` = `u`.`SquadId`) -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` -WHERE `u`.`FullName` IS NOT NULL AND `w`.`OwnerFullName` IS NOT NULL +) AS `u` +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` +) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname`) +LEFT JOIN `Weapons` AS `w` ON `u0`.`FullName` = `w`.`OwnerFullName`) +LEFT JOIN `Weapons` AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id` """); } - public override async Task Collection_with_inheritance_and_join_include_joined(bool async) + public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_complex_projection_result(bool async) { - await base.Collection_with_inheritance_and_join_include_joined(async); + await base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_complex_projection_result(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `t0`.`Id`, `t0`.`GearNickName`, `t0`.`GearSquadId`, `t0`.`IssueDate`, `t0`.`Note` -FROM (`Tags` AS `t` -INNER JOIN ( +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId`, `w1`.`Id`, `w1`.`AmmunitionType`, `w1`.`IsAutomatic`, `w1`.`Name`, `w1`.`OwnerFullName`, `w1`.`SynergyWithId`, `w2`.`Id`, `w2`.`AmmunitionType`, `w2`.`IsAutomatic`, `w2`.`Name`, `w2`.`OwnerFullName`, `w2`.`SynergyWithId`, IIF(`u0`.`Nickname` IS NOT NULL AND `u0`.`SquadId` IS NOT NULL, TRUE, FALSE), `w3`.`Id`, `w3`.`AmmunitionType`, `w3`.`IsAutomatic`, `w3`.`Name`, `w3`.`OwnerFullName`, `w3`.`SynergyWithId`, `w4`.`Id`, `w4`.`AmmunitionType`, `w4`.`IsAutomatic`, `w4`.`Name`, `w4`.`OwnerFullName`, `w4`.`SynergyWithId` +FROM ((((((( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearSquadId` = `u`.`SquadId` AND `t`.`GearNickName` = `u`.`Nickname`) -LEFT JOIN `Tags` AS `t0` ON `u`.`Nickname` = `t0`.`GearNickName` AND `u`.`SquadId` = `t0`.`GearSquadId` +) AS `u` +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` +) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname`) +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName`) +LEFT JOIN `Weapons` AS `w0` ON `u0`.`FullName` = `w0`.`OwnerFullName`) +LEFT JOIN `Weapons` AS `w1` ON `u0`.`FullName` = `w1`.`OwnerFullName`) +LEFT JOIN `Weapons` AS `w2` ON `u`.`FullName` = `w2`.`OwnerFullName`) +LEFT JOIN `Weapons` AS `w3` ON `u0`.`FullName` = `w3`.`OwnerFullName`) +LEFT JOIN `Weapons` AS `w4` ON `u`.`FullName` = `w4`.`OwnerFullName` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id`, `w3`.`Id` """); } - public override async Task Collection_with_inheritance_and_join_include_source(bool async) + public override async Task Coalesce_operator_in_predicate(bool async) { - await base.Collection_with_inheritance_and_join_include_source(async); + await base.Coalesce_operator_in_predicate(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `t0`.`Id`, `t0`.`GearNickName`, `t0`.`GearSquadId`, `t0`.`IssueDate`, `t0`.`Note` -FROM (( - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` FROM `Officers` AS `o` -) AS `u` -INNER JOIN `Tags` AS `t` ON `u`.`SquadId` = `t`.`GearSquadId` AND `u`.`Nickname` = `t`.`GearNickName`) -LEFT JOIN `Tags` AS `t0` ON `u`.`Nickname` = `t0`.`GearNickName` AND `u`.`SquadId` = `t0`.`GearSquadId` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE IIF(`u`.`HasSoulPatch` IS NULL, FALSE, `u`.`HasSoulPatch`) = TRUE """); } - public override async Task Non_unicode_string_literal_is_used_for_non_unicode_column(bool async) + public override async Task Coalesce_operator_in_predicate_with_other_conditions(bool async) { - await base.Non_unicode_string_literal_is_used_for_non_unicode_column(async); + await base.Coalesce_operator_in_predicate_with_other_conditions(async); AssertSql( -""" -SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` -FROM `Cities` AS `c` -WHERE `c`.`Location` = 'Unknown' + """ +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE (`t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL) AND IIF(`u`.`HasSoulPatch` IS NULL, FALSE, `u`.`HasSoulPatch`) = TRUE """); } - public override async Task Non_unicode_string_literal_is_used_for_non_unicode_column_right(bool async) + public override async Task Coalesce_operator_in_projection_with_other_conditions(bool async) { - await base.Non_unicode_string_literal_is_used_for_non_unicode_column_right(async); + await base.Coalesce_operator_in_projection_with_other_conditions(async); AssertSql( -""" -SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` -FROM `Cities` AS `c` -WHERE 'Unknown' = `c`.`Location` + """ +SELECT IIF((`t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL) AND IIF(`u`.`HasSoulPatch` IS NULL, FALSE, `u`.`HasSoulPatch`) = TRUE, TRUE, FALSE) +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` """); } - public override async Task Non_unicode_parameter_is_used_for_non_unicode_column(bool async) + public override async Task Optional_navigation_type_compensation_works_with_predicate(bool async) { - await base.Non_unicode_parameter_is_used_for_non_unicode_column(async); + await base.Optional_navigation_type_compensation_works_with_predicate(async); AssertSql( -""" -@__value_0='Unknown' (Size = 100) - -SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` -FROM `Cities` AS `c` -WHERE `c`.`Location` = @__value_0 + """ +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE (`t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL) AND `u`.`HasSoulPatch` = TRUE """); } - public override async Task Non_unicode_string_literals_in_contains_is_used_for_non_unicode_column(bool async) + public override async Task Optional_navigation_type_compensation_works_with_predicate2(bool async) { - await base.Non_unicode_string_literals_in_contains_is_used_for_non_unicode_column(async); + await base.Optional_navigation_type_compensation_works_with_predicate2(async); AssertSql( -""" -SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` -FROM `Cities` AS `c` -WHERE `c`.`Location` IN ('Unknown', 'Jacinto''s location', 'Ephyra''s location') + """ +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE `u`.`HasSoulPatch` = TRUE """); } - public override async Task Non_unicode_string_literals_is_used_for_non_unicode_column_with_subquery(bool async) + public override async Task Optional_navigation_type_compensation_works_with_predicate_negated(bool async) { - await base.Non_unicode_string_literals_is_used_for_non_unicode_column_with_subquery(async); + await base.Optional_navigation_type_compensation_works_with_predicate_negated(async); AssertSql( """ -SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` -FROM `Cities` AS `c` -WHERE `c`.`Location` = 'Unknown' AND ( - SELECT COUNT(*) - FROM ( - SELECT `g`.`Nickname`, `g`.`CityOfBirthName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`CityOfBirthName` - FROM `Officers` AS `o` - ) AS `u` - WHERE `c`.`Name` = `u`.`CityOfBirthName` AND `u`.`Nickname` = 'Paduk') = 1 +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE `u`.`HasSoulPatch` = FALSE """); } - public override async Task Non_unicode_string_literals_is_used_for_non_unicode_column_in_subquery(bool async) + public override async Task Optional_navigation_type_compensation_works_with_predicate_negated_complex1(bool async) { - await base.Non_unicode_string_literals_is_used_for_non_unicode_column_in_subquery(async); + await base.Optional_navigation_type_compensation_works_with_predicate_negated_complex1(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` FROM `Officers` AS `o` -) AS `u` -INNER JOIN `Cities` AS `c` ON `u`.`CityOfBirthName` = `c`.`Name` -WHERE `u`.`Nickname` = 'Marcus' AND `c`.`Location` = 'Jacinto''s location' +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE IIF(`u`.`HasSoulPatch` = TRUE, TRUE, `u`.`HasSoulPatch`) = FALSE """); } - public override async Task Non_unicode_string_literals_is_used_for_non_unicode_column_with_contains(bool async) + public override async Task Optional_navigation_type_compensation_works_with_predicate_negated_complex2(bool async) { - await base.Non_unicode_string_literals_is_used_for_non_unicode_column_with_contains(async); + await base.Optional_navigation_type_compensation_works_with_predicate_negated_complex2(async); AssertSql( -""" -SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` -FROM `Cities` AS `c` -WHERE `c`.`Location` LIKE '%Jacinto%' + """ +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE IIF(`u`.`HasSoulPatch` = FALSE, FALSE, `u`.`HasSoulPatch`) = FALSE """); } - public override async Task Unicode_string_literals_is_used_for_non_unicode_column_with_concat(bool async) + public override async Task Optional_navigation_type_compensation_works_with_conditional_expression(bool async) { - await base.Unicode_string_literals_is_used_for_non_unicode_column_with_concat(async); + await base.Optional_navigation_type_compensation_works_with_conditional_expression(async); AssertSql( -""" -SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` -FROM `Cities` AS `c` -WHERE IIF(`c`.`Location` IS NULL, '', `c`.`Location`) & 'Added' LIKE '%Add%' + """ +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE IIF(`u`.`HasSoulPatch` = TRUE, TRUE, FALSE) = TRUE """); } - public override void Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result1() + public override async Task Optional_navigation_type_compensation_works_with_binary_expression(bool async) { - base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result1(); + await base.Optional_navigation_type_compensation_works_with_binary_expression(async); AssertSql( """ -SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM (( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` -) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname`) -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname`, `u0`.`SquadId` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE `u`.`HasSoulPatch` = TRUE OR (`t`.`Note` LIKE '%Cole%') """); } - public override void Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result2() + public override async Task Optional_navigation_type_compensation_works_with_binary_and_expression(bool async) { - base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result2(); + await base.Optional_navigation_type_compensation_works_with_binary_and_expression(async); AssertSql( """ -SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM (( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT IIF(`u`.`HasSoulPatch` = TRUE AND (`t`.`Note` LIKE '%Cole%') AND `t`.`Note` IS NOT NULL, TRUE, FALSE) +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` -) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname`) -LEFT JOIN `Weapons` AS `w` ON `u0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname`, `u0`.`SquadId` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` """); } - public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result3(bool async) + public override async Task Optional_navigation_type_compensation_works_with_projection(bool async) { - await base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result3(async); + await base.Optional_navigation_type_compensation_works_with_projection(async); - // Issue#16897 AssertSql( """ -SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` -FROM ((( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT `u`.`SquadId` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` -) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname`) -LEFT JOIN `Weapons` AS `w` ON `u0`.`FullName` = `w`.`OwnerFullName`) -LEFT JOIN `Weapons` AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL """); } - public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result4(bool async) + public override async Task Optional_navigation_type_compensation_works_with_projection_into_anonymous_type(bool async) { - await base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesce_result4(async); + await base.Optional_navigation_type_compensation_works_with_projection_into_anonymous_type(async); - // Issue#16897 AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId`, `w1`.`Id`, `w1`.`AmmunitionType`, `w1`.`IsAutomatic`, `w1`.`Name`, `w1`.`OwnerFullName`, `w1`.`SynergyWithId`, `w2`.`Id`, `w2`.`AmmunitionType`, `w2`.`IsAutomatic`, `w2`.`Name`, `w2`.`OwnerFullName`, `w2`.`SynergyWithId` -FROM ((((( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT `u`.`SquadId` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` -) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname`) -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName`) -LEFT JOIN `Weapons` AS `w0` ON `u0`.`FullName` = `w0`.`OwnerFullName`) -LEFT JOIN `Weapons` AS `w1` ON `u0`.`FullName` = `w1`.`OwnerFullName`) -LEFT JOIN `Weapons` AS `w2` ON `u`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL """); } - public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_inheritance_and_coalesce_result(bool async) + public override async Task Optional_navigation_type_compensation_works_with_DTOs(bool async) { - await base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_inheritance_and_coalesce_result(async); + await base.Optional_navigation_type_compensation_works_with_DTOs(async); - // Issue#16897 AssertSql( """ -SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` -FROM ((( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT `u`.`SquadId` AS `Id` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` -) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname`) -LEFT JOIN `Weapons` AS `w` ON `u0`.`FullName` = `w`.`OwnerFullName`) -LEFT JOIN `Weapons` AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL """); } - public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_conditional_result(bool async) + public override async Task Optional_navigation_type_compensation_works_with_list_initializers(bool async) { - await base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_conditional_result(async); + await base.Optional_navigation_type_compensation_works_with_list_initializers(async); - // Issue#16897 AssertSql( """ -SELECT IIF(`u0`.`Nickname` IS NOT NULL AND `u0`.`SquadId` IS NOT NULL, TRUE, FALSE), `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` -FROM ((( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT `u`.`SquadId`, `u`.`SquadId` + 1 +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` -) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname`) -LEFT JOIN `Weapons` AS `w` ON `u0`.`FullName` = `w`.`OwnerFullName`) -LEFT JOIN `Weapons` AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL +ORDER BY `t`.`Note` """); } - public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_complex_projection_result(bool async) + public override async Task Optional_navigation_type_compensation_works_with_array_initializers(bool async) { - await base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_complex_projection_result(async); + await base.Optional_navigation_type_compensation_works_with_array_initializers(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId`, `w1`.`Id`, `w1`.`AmmunitionType`, `w1`.`IsAutomatic`, `w1`.`Name`, `w1`.`OwnerFullName`, `w1`.`SynergyWithId`, `w2`.`Id`, `w2`.`AmmunitionType`, `w2`.`IsAutomatic`, `w2`.`Name`, `w2`.`OwnerFullName`, `w2`.`SynergyWithId`, IIF(`u0`.`Nickname` IS NOT NULL AND `u0`.`SquadId` IS NOT NULL, TRUE, FALSE), `w3`.`Id`, `w3`.`AmmunitionType`, `w3`.`IsAutomatic`, `w3`.`Name`, `w3`.`OwnerFullName`, `w3`.`SynergyWithId`, `w4`.`Id`, `w4`.`AmmunitionType`, `w4`.`IsAutomatic`, `w4`.`Name`, `w4`.`OwnerFullName`, `w4`.`SynergyWithId` -FROM ((((((( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT `u`.`SquadId` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` -) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname`) -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName`) -LEFT JOIN `Weapons` AS `w0` ON `u0`.`FullName` = `w0`.`OwnerFullName`) -LEFT JOIN `Weapons` AS `w1` ON `u0`.`FullName` = `w1`.`OwnerFullName`) -LEFT JOIN `Weapons` AS `w2` ON `u`.`FullName` = `w2`.`OwnerFullName`) -LEFT JOIN `Weapons` AS `w3` ON `u0`.`FullName` = `w3`.`OwnerFullName`) -LEFT JOIN `Weapons` AS `w4` ON `u`.`FullName` = `w4`.`OwnerFullName` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id`, `w0`.`Id`, `w1`.`Id`, `w2`.`Id`, `w3`.`Id` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL """); } - public override async Task Coalesce_operator_in_predicate(bool async) + public override async Task Optional_navigation_type_compensation_works_with_orderby(bool async) { - await base.Coalesce_operator_in_predicate(async); + await base.Optional_navigation_type_compensation_works_with_orderby(async); AssertSql( """ SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` FROM `Tags` AS `t` LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` ) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE IIF(`u`.`HasSoulPatch` IS NULL, FALSE, `u`.`HasSoulPatch`) = TRUE +WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL +ORDER BY `u`.`SquadId` """); } - public override async Task Coalesce_operator_in_predicate_with_other_conditions(bool async) + public override async Task Optional_navigation_type_compensation_works_with_all(bool async) { - await base.Coalesce_operator_in_predicate_with_other_conditions(async); + await base.Optional_navigation_type_compensation_works_with_all(async); AssertSql( """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE (`t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL) AND IIF(`u`.`HasSoulPatch` IS NULL, FALSE, `u`.`HasSoulPatch`) = TRUE +SELECT IIF(NOT EXISTS ( + SELECT 1 + FROM `Tags` AS `t` + LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` + ) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` + WHERE (`t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL) AND `u`.`HasSoulPatch` = FALSE), TRUE, FALSE) +FROM (SELECT COUNT(*) FROM `#Dual`) """); } - public override async Task Coalesce_operator_in_projection_with_other_conditions(bool async) + public override async Task Optional_navigation_type_compensation_works_with_negated_predicate(bool async) { - await base.Coalesce_operator_in_projection_with_other_conditions(async); + await base.Optional_navigation_type_compensation_works_with_negated_predicate(async); AssertSql( """ -SELECT IIF((`t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL) AND IIF(`u`.`HasSoulPatch` IS NULL, FALSE, `u`.`HasSoulPatch`) = TRUE, TRUE, FALSE) +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` FROM `Tags` AS `t` LEFT JOIN ( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` @@ -3196,6883 +2963,5142 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` FROM `Officers` AS `o` ) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE (`t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL) AND `u`.`HasSoulPatch` = FALSE """); } - public override async Task Optional_navigation_type_compensation_works_with_predicate(bool async) + public override async Task Optional_navigation_type_compensation_works_with_contains(bool async) { - await base.Optional_navigation_type_compensation_works_with_predicate(async); + await base.Optional_navigation_type_compensation_works_with_contains(async); AssertSql( """ SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` FROM `Tags` AS `t` LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` ) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE (`t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL) AND `u`.`HasSoulPatch` = TRUE +WHERE (`t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL) AND `u`.`SquadId` IN ( + SELECT `u0`.`SquadId` + FROM ( + SELECT `g0`.`SquadId` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`SquadId` + FROM `Officers` AS `o0` + ) AS `u0` +) """); } - public override async Task Optional_navigation_type_compensation_works_with_predicate2(bool async) + public override async Task Optional_navigation_type_compensation_works_with_skip(bool async) { - await base.Optional_navigation_type_compensation_works_with_predicate2(async); + await base.Optional_navigation_type_compensation_works_with_skip(async); - AssertSql( - """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE `u`.`HasSoulPatch` = TRUE -"""); + AssertSql(); } - public override async Task Optional_navigation_type_compensation_works_with_predicate_negated(bool async) + public override async Task Optional_navigation_type_compensation_works_with_take(bool async) { - await base.Optional_navigation_type_compensation_works_with_predicate_negated(async); + await base.Optional_navigation_type_compensation_works_with_take(async); - AssertSql( - """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE `u`.`HasSoulPatch` = FALSE -"""); + AssertSql(); } - public override async Task Optional_navigation_type_compensation_works_with_predicate_negated_complex1(bool async) + public override async Task Select_correlated_filtered_collection(bool async) { - await base.Optional_navigation_type_compensation_works_with_predicate_negated_complex1(async); + await base.Select_correlated_filtered_collection(async); AssertSql( """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` +SELECT `u`.`Nickname`, `u`.`SquadId`, `c`.`Name`, `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` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`CityOfBirthName`, `o`.`FullName` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE IIF(`u`.`HasSoulPatch` = TRUE, TRUE, `u`.`HasSoulPatch`) = FALSE +) AS `u` +INNER JOIN `Cities` AS `c` ON `u`.`CityOfBirthName` = `c`.`Name`) +LEFT JOIN ( + SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + FROM `Weapons` AS `w` + WHERE `w`.`Name` <> 'Lancer' OR `w`.`Name` IS NULL +) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` +WHERE `c`.`Name` IN ('Ephyra', 'Hanover') +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `c`.`Name` """); } - public override async Task Optional_navigation_type_compensation_works_with_predicate_negated_complex2(bool async) + public override async Task Select_correlated_filtered_collection_with_composite_key(bool async) { - await base.Optional_navigation_type_compensation_works_with_predicate_negated_complex2(async); + await base.Select_correlated_filtered_collection_with_composite_key(async); AssertSql( """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` +SELECT `u`.`Nickname`, `u`.`SquadId`, `u1`.`Nickname`, `u1`.`SquadId`, `u1`.`AssignedCityName`, `u1`.`CityOfBirthName`, `u1`.`FullName`, `u1`.`HasSoulPatch`, `u1`.`LeaderNickname`, `u1`.`LeaderSquadId`, `u1`.`Rank`, `u1`.`Discriminator` +FROM ( + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE IIF(`u`.`HasSoulPatch` = FALSE, FALSE, `u`.`HasSoulPatch`) = FALSE +) AS `u` +LEFT JOIN ( + SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` + FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` + ) AS `u0` + WHERE `u0`.`Nickname` <> 'Dom' +) AS `u1` ON `u`.`Nickname` = `u1`.`LeaderNickname` AND `u`.`SquadId` = `u1`.`LeaderSquadId` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u1`.`Nickname` """); } - public override async Task Optional_navigation_type_compensation_works_with_conditional_expression(bool async) + public override async Task Select_correlated_filtered_collection_works_with_caching(bool async) { - await base.Optional_navigation_type_compensation_works_with_conditional_expression(async); + await base.Select_correlated_filtered_collection_works_with_caching(async); AssertSql( """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +SELECT `t`.`Id`, `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM `Tags` AS `t` LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE IIF(`u`.`HasSoulPatch` = TRUE, TRUE, FALSE) = TRUE +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` +ORDER BY `t`.`Note`, `t`.`Id`, `u`.`Nickname` """); } - public override async Task Optional_navigation_type_compensation_works_with_binary_expression(bool async) + public override async Task Join_predicate_value_equals_condition(bool async) { - await base.Optional_navigation_type_compensation_works_with_binary_expression(async); + await base.Join_predicate_value_equals_condition(async); AssertSql( - """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] +FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE `u`.`HasSoulPatch` = TRUE OR (`t`.`Note` LIKE '%Cole%') + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +INNER JOIN [Weapons] AS [w] ON [w].[SynergyWithId] IS NOT NULL """); } - public override async Task Optional_navigation_type_compensation_works_with_binary_and_expression(bool async) + public override async Task Join_predicate_value(bool async) { - await base.Optional_navigation_type_compensation_works_with_binary_and_expression(async); + await base.Join_predicate_value(async); AssertSql( - """ -SELECT IIF(`u`.`HasSoulPatch` = TRUE AND (`t`.`Note` LIKE '%Cole%') AND `t`.`Note` IS NOT NULL, TRUE, FALSE) -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] +FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +INNER JOIN [Weapons] AS [w] ON [t].[HasSoulPatch] = CAST(1 AS bit) """); } - public override async Task Optional_navigation_type_compensation_works_with_projection(bool async) + public override async Task Join_predicate_condition_equals_condition(bool async) { - await base.Optional_navigation_type_compensation_works_with_projection(async); + await base.Join_predicate_condition_equals_condition(async); AssertSql( - """ -SELECT `u`.`SquadId` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] +FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +INNER JOIN [Weapons] AS [w] ON [w].[SynergyWithId] IS NOT NULL """); } - public override async Task Optional_navigation_type_compensation_works_with_projection_into_anonymous_type(bool async) + public override async Task Left_join_predicate_value_equals_condition(bool async) { - await base.Optional_navigation_type_compensation_works_with_projection_into_anonymous_type(async); + await base.Left_join_predicate_value_equals_condition(async); AssertSql( - """ -SELECT `u`.`SquadId` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] +FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +LEFT JOIN [Weapons] AS [w] ON [w].[SynergyWithId] IS NOT NULL """); } - public override async Task Optional_navigation_type_compensation_works_with_DTOs(bool async) + public override async Task Left_join_predicate_value(bool async) { - await base.Optional_navigation_type_compensation_works_with_DTOs(async); + await base.Left_join_predicate_value(async); AssertSql( - """ -SELECT `u`.`SquadId` AS `Id` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] +FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +LEFT JOIN [Weapons] AS [w] ON [t].[HasSoulPatch] = CAST(1 AS bit) """); } - public override async Task Optional_navigation_type_compensation_works_with_list_initializers(bool async) + public override async Task Left_join_predicate_condition_equals_condition(bool async) { - await base.Optional_navigation_type_compensation_works_with_list_initializers(async); + await base.Left_join_predicate_condition_equals_condition(async); + + AssertSql( +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] +FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +LEFT JOIN [Weapons] AS [w] ON [w].[SynergyWithId] IS NOT NULL +"""); + } + + public override async Task Orderby_added_for_client_side_GroupJoin_composite_dependent_to_principal_LOJ_when_incomplete_key_is_used( + bool async) + { + await base.Orderby_added_for_client_side_GroupJoin_composite_dependent_to_principal_LOJ_when_incomplete_key_is_used(async); + + AssertSql(); + } + + public override async Task Complex_predicate_with_AndAlso_and_nullable_bool_property(bool async) + { + await base.Complex_predicate_with_AndAlso_and_nullable_bool_property(async); AssertSql( """ -SELECT `u`.`SquadId`, `u`.`SquadId` + 1 -FROM `Tags` AS `t` +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM `Weapons` AS `w` LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` + SELECT `g`.`FullName`, `g`.`HasSoulPatch` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` + SELECT `o`.`FullName`, `o`.`HasSoulPatch` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL -ORDER BY `t`.`Note` +) AS `u` ON `w`.`OwnerFullName` = `u`.`FullName` +WHERE `w`.`Id` <> 50 AND `u`.`HasSoulPatch` = FALSE """); } - public override async Task Optional_navigation_type_compensation_works_with_array_initializers(bool async) + public override async Task Distinct_with_optional_navigation_is_translated_to_sql(bool async) { - await base.Optional_navigation_type_compensation_works_with_array_initializers(async); + await base.Distinct_with_optional_navigation_is_translated_to_sql(async); AssertSql( """ -SELECT `u`.`SquadId` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` +SELECT DISTINCT `u`.`HasSoulPatch` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL +) AS `u` +LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` +WHERE `t`.`Note` <> 'Foo' OR `t`.`Note` IS NULL """); } - public override async Task Optional_navigation_type_compensation_works_with_orderby(bool async) + public override async Task Sum_with_optional_navigation_is_translated_to_sql(bool async) { - await base.Optional_navigation_type_compensation_works_with_orderby(async); + await base.Sum_with_optional_navigation_is_translated_to_sql(async); AssertSql( """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( +SELECT IIF(SUM(`u`.`SquadId`) IS NULL, 0, SUM(`u`.`SquadId`)) +FROM ( SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE `t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL -ORDER BY `u`.`SquadId` +) AS `u` +LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` +WHERE `t`.`Note` <> 'Foo' OR `t`.`Note` IS NULL """); } - public override async Task Optional_navigation_type_compensation_works_with_all(bool async) + public override async Task Count_with_optional_navigation_is_translated_to_sql(bool async) { - await base.Optional_navigation_type_compensation_works_with_all(async); + await base.Count_with_optional_navigation_is_translated_to_sql(async); AssertSql( """ -SELECT IIF(NOT EXISTS ( - SELECT 1 - FROM `Tags` AS `t` - LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` - ) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` - WHERE (`t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL) AND `u`.`HasSoulPatch` = FALSE), TRUE, FALSE) -FROM (SELECT COUNT(*) FROM `#Dual`) +SELECT COUNT(*) +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` +WHERE `t`.`Note` <> 'Foo' OR `t`.`Note` IS NULL """); } - public override async Task Optional_navigation_type_compensation_works_with_negated_predicate(bool async) + public override async Task FirstOrDefault_with_manually_created_groupjoin_is_translated_to_sql(bool async) { - await base.Optional_navigation_type_compensation_works_with_negated_predicate(async); + await base.FirstOrDefault_with_manually_created_groupjoin_is_translated_to_sql(async); AssertSql( """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` +SELECT TOP 1 `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` +FROM `Squads` AS `s` LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + SELECT `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + SELECT `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE (`t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL) AND `u`.`HasSoulPatch` = FALSE +) AS `u` ON `s`.`Id` = `u`.`SquadId` +WHERE `s`.`Name` = 'Kilo' """); } - public override async Task Optional_navigation_type_compensation_works_with_contains(bool async) + public override async Task Any_with_optional_navigation_as_subquery_predicate_is_translated_to_sql(bool async) { - await base.Optional_navigation_type_compensation_works_with_contains(async); + await base.Any_with_optional_navigation_as_subquery_predicate_is_translated_to_sql(async); AssertSql( """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE (`t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL) AND `u`.`SquadId` IN ( - SELECT `u0`.`SquadId` +SELECT `s`.`Name` +FROM `Squads` AS `s` +WHERE NOT EXISTS ( + SELECT 1 FROM ( - SELECT `g0`.`SquadId` - FROM `Gears` AS `g0` + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` UNION ALL - SELECT `o0`.`SquadId` - FROM `Officers` AS `o0` - ) AS `u0` -) + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` + ) AS `u` + LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` + WHERE `s`.`Id` = `u`.`SquadId` AND `t`.`Note` = 'Dom''s Tag') """); } - public override async Task Optional_navigation_type_compensation_works_with_skip(bool async) + public override async Task All_with_optional_navigation_is_translated_to_sql(bool async) { - await base.Optional_navigation_type_compensation_works_with_skip(async); + await base.All_with_optional_navigation_is_translated_to_sql(async); - AssertSql(); + AssertSql( + """ +SELECT IIF(NOT EXISTS ( + SELECT 1 + FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` + ) AS `u` + LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` + WHERE `t`.`Note` = 'Foo'), TRUE, FALSE) +FROM (SELECT COUNT(*) FROM `#Dual`) +"""); } - public override async Task Optional_navigation_type_compensation_works_with_take(bool async) + public override async Task Contains_with_local_nullable_guid_list_closure(bool async) { - await base.Optional_navigation_type_compensation_works_with_take(async); + await base.Contains_with_local_nullable_guid_list_closure(async); - AssertSql(); + AssertSql( + """ +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +WHERE `t`.`Id` IN ({df36f493-463f-4123-83f9-6b135deeb7ba}, {23cbcf9b-ce14-45cf-aafa-2c2667ebfdd3}, {ab1b82d7-88db-42bd-a132-7eef9aa68af4}) +"""); } - public override async Task Select_correlated_filtered_collection(bool async) + public override async Task Unnecessary_include_doesnt_get_added_complex_when_projecting_EF_Property(bool async) { - await base.Select_correlated_filtered_collection(async); + await base.Unnecessary_include_doesnt_get_added_complex_when_projecting_EF_Property(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `c`.`Name`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` -FROM (( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`CityOfBirthName`, `g`.`FullName` +SELECT `u`.`FullName` +FROM ( + SELECT `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`Rank` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`CityOfBirthName`, `o`.`FullName` + SELECT `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`Rank` FROM `Officers` AS `o` ) AS `u` -INNER JOIN `Cities` AS `c` ON `u`.`CityOfBirthName` = `c`.`Name`) -LEFT JOIN ( - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE `w`.`Name` <> 'Lancer' OR `w`.`Name` IS NULL -) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` -WHERE `c`.`Name` IN ('Ephyra', 'Hanover') -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `c`.`Name` +WHERE `u`.`HasSoulPatch` = TRUE +ORDER BY `u`.`Rank` """); } - public override async Task Select_correlated_filtered_collection_with_composite_key(bool async) + public override async Task Multiple_order_bys_are_properly_lifted_from_subquery_created_by_include(bool async) { - await base.Select_correlated_filtered_collection_with_composite_key(async); + await base.Multiple_order_bys_are_properly_lifted_from_subquery_created_by_include(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u1`.`Nickname`, `u1`.`SquadId`, `u1`.`AssignedCityName`, `u1`.`CityOfBirthName`, `u1`.`FullName`, `u1`.`HasSoulPatch`, `u1`.`LeaderNickname`, `u1`.`LeaderSquadId`, `u1`.`Rank`, `u1`.`Discriminator` +SELECT `u`.`FullName` FROM ( - SELECT `o`.`Nickname`, `o`.`SquadId` + SELECT `g`.`FullName`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`FullName`, `o`.`HasSoulPatch` FROM `Officers` AS `o` ) AS `u` -LEFT JOIN ( - SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` - FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` - ) AS `u0` - WHERE `u0`.`Nickname` <> 'Dom' -) AS `u1` ON `u`.`Nickname` = `u1`.`LeaderNickname` AND `u`.`SquadId` = `u1`.`LeaderSquadId` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u1`.`Nickname` +WHERE `u`.`HasSoulPatch` = FALSE +ORDER BY `u`.`FullName` """); } - public override async Task Select_correlated_filtered_collection_works_with_caching(bool async) + public override async Task Order_by_is_properly_lifted_from_subquery_with_same_order_by_in_the_outer_query(bool async) { - await base.Select_correlated_filtered_collection_works_with_caching(async); + await base.Order_by_is_properly_lifted_from_subquery_with_same_order_by_in_the_outer_query(async); AssertSql( """ -SELECT `t`.`Id`, `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT `u`.`FullName` +FROM ( + SELECT `g`.`FullName`, `g`.`HasSoulPatch` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`FullName`, `o`.`HasSoulPatch` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` -ORDER BY `t`.`Note`, `t`.`Id`, `u`.`Nickname` +) AS `u` +WHERE `u`.`HasSoulPatch` = FALSE +ORDER BY `u`.`FullName` """); } - public override async Task Join_predicate_value_equals_condition(bool async) + public override async Task Where_is_properly_lifted_from_subquery_created_by_include(bool async) { - await base.Join_predicate_value_equals_condition(async); + await base.Where_is_properly_lifted_from_subquery_created_by_include(async); AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] + """ +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -INNER JOIN [Weapons] AS [w] ON [w].[SynergyWithId] IS NOT NULL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` +WHERE `u`.`FullName` <> 'Augustus Cole' AND `u`.`HasSoulPatch` = FALSE +ORDER BY `u`.`FullName` """); } - public override async Task Join_predicate_value(bool async) + public override async Task Subquery_is_lifted_from_main_from_clause_of_SelectMany(bool async) { - await base.Join_predicate_value(async); + await base.Subquery_is_lifted_from_main_from_clause_of_SelectMany(async); AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] + """ +SELECT `u`.`FullName` AS `Name1`, `u0`.`FullName` AS `Name2` FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] + SELECT `g`.`FullName`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -INNER JOIN [Weapons] AS [w] ON [t].[HasSoulPatch] = CAST(1 AS bit) + SELECT `o`.`FullName`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u`, +( + SELECT `g0`.`FullName`, `g0`.`HasSoulPatch` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`FullName`, `o0`.`HasSoulPatch` + FROM `Officers` AS `o0` +) AS `u0` +WHERE `u`.`HasSoulPatch` = TRUE AND `u0`.`HasSoulPatch` = FALSE +ORDER BY `u`.`FullName` """); } - public override async Task Join_predicate_condition_equals_condition(bool async) + public override async Task Subquery_containing_SelectMany_projecting_main_from_clause_gets_lifted(bool async) { - await base.Join_predicate_condition_equals_condition(async); + await base.Subquery_containing_SelectMany_projecting_main_from_clause_gets_lifted(async); AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] + """ +SELECT `u`.`FullName` FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] + SELECT `g`.`FullName`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -INNER JOIN [Weapons] AS [w] ON [w].[SynergyWithId] IS NOT NULL + SELECT `o`.`FullName`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u`, +`Tags` AS `t` +WHERE `u`.`HasSoulPatch` = TRUE +ORDER BY `u`.`FullName` """); } - public override async Task Left_join_predicate_value_equals_condition(bool async) + public override async Task Subquery_containing_join_projecting_main_from_clause_gets_lifted(bool async) { - await base.Left_join_predicate_value_equals_condition(async); + await base.Subquery_containing_join_projecting_main_from_clause_gets_lifted(async); AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] + """ +SELECT `u`.`Nickname` FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] + SELECT `g`.`Nickname` + FROM `Gears` AS `g` UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -LEFT JOIN [Weapons] AS [w] ON [w].[SynergyWithId] IS NOT NULL + SELECT `o`.`Nickname` + FROM `Officers` AS `o` +) AS `u` +INNER JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` +ORDER BY `u`.`Nickname` """); } - public override async Task Left_join_predicate_value(bool async) + public override async Task Subquery_containing_left_join_projecting_main_from_clause_gets_lifted(bool async) { - await base.Left_join_predicate_value(async); + await base.Subquery_containing_left_join_projecting_main_from_clause_gets_lifted(async); AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] + """ +SELECT `u`.`Nickname` FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] + SELECT `g`.`Nickname` + FROM `Gears` AS `g` UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -LEFT JOIN [Weapons] AS [w] ON [t].[HasSoulPatch] = CAST(1 AS bit) + SELECT `o`.`Nickname` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` +ORDER BY `u`.`Nickname` """); } - public override async Task Left_join_predicate_condition_equals_condition(bool async) + public override async Task Subquery_containing_join_gets_lifted_clashing_names(bool async) { - await base.Left_join_predicate_condition_equals_condition(async); + await base.Subquery_containing_join_gets_lifted_clashing_names(async); AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] -FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] + """ +SELECT `u`.`Nickname` +FROM (( + SELECT `g`.`Nickname` + FROM `Gears` AS `g` UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -LEFT JOIN [Weapons] AS [w] ON [w].[SynergyWithId] IS NOT NULL + SELECT `o`.`Nickname` + FROM `Officers` AS `o` +) AS `u` +INNER JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName`) +INNER JOIN `Tags` AS `t0` ON `u`.`Nickname` = `t0`.`GearNickName` +WHERE `t`.`GearNickName` <> 'Cole Train' OR `t`.`GearNickName` IS NULL +ORDER BY `u`.`Nickname`, `t0`.`Id` """); } - public override async Task Where_datetimeoffset_now(bool async) + public override async Task Subquery_created_by_include_gets_lifted_nested(bool async) { - await base.Where_datetimeoffset_now(async); + await base.Subquery_created_by_include_gets_lifted_nested(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE `m`.`Timeline` <> NOW() +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `c`.`Name`, `c`.`Location`, `c`.`Nation` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +INNER JOIN `Cities` AS `c` ON `u`.`CityOfBirthName` = `c`.`Name` +WHERE EXISTS ( + SELECT 1 + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName`) AND `u`.`HasSoulPatch` = FALSE +ORDER BY `u`.`Nickname` """); } - public override async Task Where_datetimeoffset_utcnow(bool async) + public override async Task Subquery_is_lifted_from_additional_from_clause(bool async) { - var dtoffset = -1 * TimeZoneInfo.Local.BaseUtcOffset.TotalMinutes; - await base.Where_datetimeoffset_utcnow(async); + await base.Subquery_is_lifted_from_additional_from_clause(async); AssertSql( - $""" -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE `m`.`Timeline` <> DATEADD('n', {dtoffset}.0, NOW()) + """ +SELECT `u`.`FullName` AS `Name1`, `u0`.`FullName` AS `Name2` +FROM ( + SELECT `g`.`FullName`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`FullName`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u`, +( + SELECT `g0`.`FullName`, `g0`.`HasSoulPatch` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`FullName`, `o0`.`HasSoulPatch` + FROM `Officers` AS `o0` +) AS `u0` +WHERE `u`.`HasSoulPatch` = TRUE AND `u0`.`HasSoulPatch` = FALSE +ORDER BY `u`.`FullName` """); } - public override async Task Where_datetimeoffset_date_component(bool async) + public override async Task Subquery_with_result_operator_is_not_lifted(bool async) { - //We have to specifically use 1 JAn 100 as that is the minimum in Jet. - //The default 0 in DateTimeOffset is normally mapped to the OLE Automation date 30 Dec 1899 - //Investigate if we can pick the scenario up automatically and have a new DateTimeOffset().Date go to the required value if we have a comparison - //await base.Where_datetimeoffset_date_component(async); - await AssertQuery( - async, - ss => from m in ss.Set() - where m.Timeline.Date > new DateTimeOffset(100, 1, 1, 0, 0, 0, new TimeSpan()).Date - select m); + await base.Subquery_with_result_operator_is_not_lifted(async); AssertSql( """ -@__Date_0='0100-01-01T00:00:00.0000000' (DbType = DateTime) - -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEVALUE(`m`.`Timeline`) > CDATE(@__Date_0) +SELECT `u0`.`FullName` +FROM ( + SELECT TOP @p `u`.`FullName`, `u`.`Rank` + FROM ( + SELECT `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`Rank` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`Rank` + FROM `Officers` AS `o` + ) AS `u` + WHERE `u`.`HasSoulPatch` = FALSE + ORDER BY `u`.`FullName` +) AS `u0` +ORDER BY `u0`.`Rank` """); } - public override async Task Where_datetimeoffset_year_component(bool async) + public override async Task Skip_with_orderby_followed_by_orderBy_is_pushed_down(bool async) { - await AssertQuery( - async, - ss => from m in ss.Set() - where m.Timeline.Year == 102 - select m); + await base.Skip_with_orderby_followed_by_orderBy_is_pushed_down(async); AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('yyyy', `m`.`Timeline`) = 102 +""" +@__p_0='1' + +SELECT [t0].[FullName] +FROM ( + SELECT [t].[FullName], [t].[Rank] + FROM ( + SELECT [g].[FullName], [g].[HasSoulPatch], [g].[Rank] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[FullName], [o].[HasSoulPatch], [o].[Rank] + FROM [Officers] AS [o] + ) AS [t] + WHERE [t].[HasSoulPatch] = CAST(0 AS bit) + ORDER BY [t].[FullName] + OFFSET @__p_0 ROWS +) AS [t0] +ORDER BY [t0].[Rank] """); } - public override async Task Where_datetimeoffset_month_component(bool async) + public override async Task Take_without_orderby_followed_by_orderBy_is_pushed_down1(bool async) { - await base.Where_datetimeoffset_month_component(async); + await base.Take_without_orderby_followed_by_orderBy_is_pushed_down1(async); AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('m', `m`.`Timeline`) = 1 -"""); - } - - public override async Task Where_datetimeoffset_dayofyear_component(bool async) - { - await base.Where_datetimeoffset_dayofyear_component(async); +""" +@__p_0='999' - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('y', `m`.`Timeline`) = 2 +SELECT [t0].[FullName] +FROM ( + SELECT TOP(@__p_0) [t].[FullName], [t].[Rank] + FROM ( + SELECT [g].[FullName], [g].[HasSoulPatch], [g].[Rank] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[FullName], [o].[HasSoulPatch], [o].[Rank] + FROM [Officers] AS [o] + ) AS [t] + WHERE [t].[HasSoulPatch] = CAST(0 AS bit) +) AS [t0] +ORDER BY [t0].[Rank] """); } - public override async Task Where_datetimeoffset_day_component(bool async) + public override async Task Take_without_orderby_followed_by_orderBy_is_pushed_down2(bool async) { - await base.Where_datetimeoffset_day_component(async); + await base.Take_without_orderby_followed_by_orderBy_is_pushed_down2(async); AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('d', `m`.`Timeline`) = 2 +""" +@__p_0='999' + +SELECT [t0].[FullName] +FROM ( + SELECT TOP(@__p_0) [t].[FullName], [t].[Rank] + FROM ( + SELECT [g].[FullName], [g].[HasSoulPatch], [g].[Rank] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[FullName], [o].[HasSoulPatch], [o].[Rank] + FROM [Officers] AS [o] + ) AS [t] + WHERE [t].[HasSoulPatch] = CAST(0 AS bit) +) AS [t0] +ORDER BY [t0].[Rank] """); } - public override async Task Where_datetimeoffset_hour_component(bool async) + public override async Task Take_without_orderby_followed_by_orderBy_is_pushed_down3(bool async) { - await AssertQuery( - async, - ss => from m in ss.Set() - where m.Timeline.Hour == 8 - select m); + await base.Take_without_orderby_followed_by_orderBy_is_pushed_down3(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('h', `m`.`Timeline`) = 8 +SELECT `u0`.`FullName` +FROM ( + SELECT TOP @p `u`.`FullName`, `u`.`Rank` + FROM ( + SELECT `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`Rank` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`Rank` + FROM `Officers` AS `o` + ) AS `u` + WHERE `u`.`HasSoulPatch` = FALSE +) AS `u0` +ORDER BY `u0`.`FullName`, `u0`.`Rank` """); } - public override async Task Where_datetimeoffset_minute_component(bool async) + public override async Task Select_length_of_string_property(bool async) { - await base.Where_datetimeoffset_minute_component(async); + await base.Select_length_of_string_property(async); AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('n', `m`.`Timeline`) = 0 +""" +SELECT `w`.`Name`, IIF(LEN(`w`.`Name`) IS NULL, NULL, CLNG(LEN(`w`.`Name`))) AS `Length` +FROM `Weapons` AS `w` """); } - public override async Task Where_datetimeoffset_second_component(bool async) + public override async Task Client_method_on_collection_navigation_in_outer_join_key(bool async) { - await base.Where_datetimeoffset_second_component(async); + await base.Client_method_on_collection_navigation_in_outer_join_key(async); - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('s', `m`.`Timeline`) = 0 -"""); + AssertSql(); } - public override async Task Where_datetimeoffset_millisecond_component(bool async) + public override async Task Member_access_on_derived_entity_using_cast(bool async) { - await base.Where_datetimeoffset_millisecond_component(async); + await base.Member_access_on_derived_entity_using_cast(async); AssertSql( """ -SELECT [m].[Id], [m].[CodeName], [m].[Duration], [m].[Rating], [m].[Timeline] -FROM [Missions] AS [m] -WHERE DATEPART(millisecond, [m].[Timeline]) = 0 +SELECT `l`.`Name`, `l`.`Eradicated` +FROM `LocustHordes` AS `l` +ORDER BY `l`.`Name` """); } - public override async Task DateTimeOffset_DateAdd_AddMonths(bool async) + public override async Task Member_access_on_derived_materialized_entity_using_cast(bool async) { - await base.DateTimeOffset_DateAdd_AddMonths(async); + await base.Member_access_on_derived_materialized_entity_using_cast(async); AssertSql( """ -SELECT DATEADD('m', 1, `m`.`Timeline`) -FROM `Missions` AS `m` +SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated` +FROM `LocustHordes` AS `l` +ORDER BY `l`.`Name` """); } - public override async Task DateTimeOffset_DateAdd_AddDays(bool async) + public override async Task Member_access_on_derived_entity_using_cast_and_let(bool async) { - await base.DateTimeOffset_DateAdd_AddDays(async); + await base.Member_access_on_derived_entity_using_cast_and_let(async); AssertSql( - """ -SELECT DATEADD('d', 1.0, `m`.`Timeline`) -FROM `Missions` AS `m` +""" +SELECT `l`.`Name`, `l`.`Eradicated` +FROM `LocustHordes` AS `l` +ORDER BY `l`.`Name` """); } - public override async Task DateTimeOffset_DateAdd_AddHours(bool async) + public override async Task Property_access_on_derived_entity_using_cast(bool async) { - await base.DateTimeOffset_DateAdd_AddHours(async); + await base.Property_access_on_derived_entity_using_cast(async); AssertSql( - """ -SELECT DATEADD('h', 1.0, `m`.`Timeline`) -FROM `Missions` AS `m` +""" +SELECT `l`.`Name`, `l`.`Eradicated` +FROM `LocustHordes` AS `l` +ORDER BY `l`.`Name` """); } - public override async Task DateTimeOffset_DateAdd_AddMinutes(bool async) + public override async Task Navigation_access_on_derived_entity_using_cast(bool async) { - await base.DateTimeOffset_DateAdd_AddMinutes(async); + await base.Navigation_access_on_derived_entity_using_cast(async); AssertSql( - """ -SELECT DATEADD('n', 1.0, `m`.`Timeline`) -FROM `Missions` AS `m` +""" +SELECT `l`.`Name`, `l0`.`ThreatLevel` AS `Threat` +FROM `LocustHordes` AS `l` +LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` +ORDER BY `l`.`Name` """); } - public override async Task DateTimeOffset_DateAdd_AddSeconds(bool async) + public override async Task Navigation_access_on_derived_materialized_entity_using_cast(bool async) { - await base.DateTimeOffset_DateAdd_AddSeconds(async); + await base.Navigation_access_on_derived_materialized_entity_using_cast(async); AssertSql( """ -SELECT DATEADD('s', 1.0, `m`.`Timeline`) -FROM `Missions` AS `m` +SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, `l0`.`ThreatLevel` AS `Threat` +FROM `LocustHordes` AS `l` +LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` +ORDER BY `l`.`Name` """); } - public override async Task DateTimeOffset_DateAdd_AddMilliseconds(bool async) + public override async Task Navigation_access_via_EFProperty_on_derived_entity_using_cast(bool async) { - await base.DateTimeOffset_DateAdd_AddMilliseconds(async); + await base.Navigation_access_via_EFProperty_on_derived_entity_using_cast(async); AssertSql( """ -SELECT COUNT(*) -FROM `Missions` AS `m` -WHERE `m`.`Timeline` = #1902-01-02 10:00:00# +SELECT `l`.`Name`, `l0`.`ThreatLevel` AS `Threat` +FROM `LocustHordes` AS `l` +LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` +ORDER BY `l`.`Name` """); } - public override async Task Where_datetimeoffset_milliseconds_parameter_and_constant(bool async) + public override async Task Navigation_access_fk_on_derived_entity_using_cast(bool async) { - await base.Where_datetimeoffset_milliseconds_parameter_and_constant(async); + await base.Navigation_access_fk_on_derived_entity_using_cast(async); AssertSql( """ -SELECT COUNT(*) -FROM `Missions` AS `m` -WHERE `m`.`Timeline` = #1902-01-02 10:00:00# +SELECT `l`.`Name`, `l0`.`Name` AS `CommanderName` +FROM `LocustHordes` AS `l` +LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` +ORDER BY `l`.`Name` """); } - public override async Task Orderby_added_for_client_side_GroupJoin_composite_dependent_to_principal_LOJ_when_incomplete_key_is_used( - bool async) + public override async Task Collection_navigation_access_on_derived_entity_using_cast(bool async) { - await base.Orderby_added_for_client_side_GroupJoin_composite_dependent_to_principal_LOJ_when_incomplete_key_is_used(async); + await base.Collection_navigation_access_on_derived_entity_using_cast(async); - AssertSql(); + AssertSql( + """ +SELECT `l`.`Name`, ( + SELECT COUNT(*) + FROM ( + SELECT `l0`.`LocustHordeId` + FROM `LocustLeaders` AS `l0` + UNION ALL + SELECT `l1`.`LocustHordeId` + FROM `LocustCommanders` AS `l1` + ) AS `u` + WHERE `l`.`Id` = `u`.`LocustHordeId`) AS `LeadersCount` +FROM `LocustHordes` AS `l` +ORDER BY `l`.`Name` +"""); } - public override async Task Complex_predicate_with_AndAlso_and_nullable_bool_property(bool async) + public override async Task Collection_navigation_access_on_derived_entity_using_cast_in_SelectMany(bool async) { - await base.Complex_predicate_with_AndAlso_and_nullable_bool_property(async); + await base.Collection_navigation_access_on_derived_entity_using_cast_in_SelectMany(async); AssertSql( """ -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -LEFT JOIN ( - SELECT `g`.`FullName`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` +SELECT `l`.`Name`, `u`.`Name` AS `LeaderName` +FROM `LocustHordes` AS `l` +INNER JOIN ( + SELECT `l0`.`Name`, `l0`.`LocustHordeId` + FROM `LocustLeaders` AS `l0` UNION ALL - SELECT `o`.`FullName`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` ON `w`.`OwnerFullName` = `u`.`FullName` -WHERE `w`.`Id` <> 50 AND `u`.`HasSoulPatch` = FALSE + SELECT `l1`.`Name`, `l1`.`LocustHordeId` + FROM `LocustCommanders` AS `l1` +) AS `u` ON `l`.`Id` = `u`.`LocustHordeId` +ORDER BY `u`.`Name` """); } - public override async Task Distinct_with_optional_navigation_is_translated_to_sql(bool async) + public override async Task Include_on_derived_entity_using_OfType(bool async) { - await base.Distinct_with_optional_navigation_is_translated_to_sql(async); + await base.Include_on_derived_entity_using_OfType(async); AssertSql( """ -SELECT DISTINCT `u`.`HasSoulPatch` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` +SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, `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 ( + SELECT `l1`.`Name`, `l1`.`LocustHordeId`, `l1`.`ThreatLevel`, `l1`.`ThreatLevelByte`, `l1`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l1` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` -WHERE `t`.`Note` <> 'Foo' OR `t`.`Note` IS NULL + SELECT `l2`.`Name`, `l2`.`LocustHordeId`, `l2`.`ThreatLevel`, `l2`.`ThreatLevelByte`, `l2`.`ThreatLevelNullableByte`, `l2`.`DefeatedByNickname`, `l2`.`DefeatedBySquadId`, `l2`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l2` +) AS `u` ON `l`.`Id` = `u`.`LocustHordeId` +ORDER BY `l`.`Name`, `l`.`Id`, `l0`.`Name` """); } - public override async Task Sum_with_optional_navigation_is_translated_to_sql(bool async) + public override async Task Distinct_on_subquery_doesnt_get_lifted(bool async) { - await base.Sum_with_optional_navigation_is_translated_to_sql(async); + await base.Distinct_on_subquery_doesnt_get_lifted(async); AssertSql( """ -SELECT IIF(SUM(`u`.`SquadId`) IS NULL, 0, SUM(`u`.`SquadId`)) +SELECT `u0`.`HasSoulPatch` FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` -WHERE `t`.`Note` <> 'Foo' OR `t`.`Note` IS NULL + SELECT DISTINCT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` + FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` + ) AS `u` +) AS `u0` """); } - public override async Task Count_with_optional_navigation_is_translated_to_sql(bool async) + public override async Task Cast_result_operator_on_subquery_is_properly_lifted_to_a_convert(bool async) { - await base.Count_with_optional_navigation_is_translated_to_sql(async); + await base.Cast_result_operator_on_subquery_is_properly_lifted_to_a_convert(async); + + AssertSql( +""" +SELECT `l`.`Eradicated` +FROM `LocustHordes` AS `l` +"""); + } + + public override async Task Comparing_two_collection_navigations_composite_key(bool async) + { + await base.Comparing_two_collection_navigations_composite_key(async); AssertSql( """ -SELECT COUNT(*) +SELECT `u`.`Nickname` AS `Nickname1`, `u0`.`Nickname` AS `Nickname2` FROM ( SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` -WHERE `t`.`Note` <> 'Foo' OR `t`.`Note` IS NULL +) AS `u`, +( + SELECT `g0`.`Nickname`, `g0`.`SquadId` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId` + FROM `Officers` AS `o0` +) AS `u0` +WHERE `u`.`Nickname` = `u0`.`Nickname` AND `u`.`SquadId` = `u0`.`SquadId` +ORDER BY `u`.`Nickname` """); } - public override async Task FirstOrDefault_with_manually_created_groupjoin_is_translated_to_sql(bool async) + public override async Task Comparing_two_collection_navigations_inheritance(bool async) { - await base.FirstOrDefault_with_manually_created_groupjoin_is_translated_to_sql(async); + await base.Comparing_two_collection_navigations_inheritance(async); AssertSql( """ -SELECT TOP 1 `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` +SELECT `s`.`Name`, `s`.`Nickname` +FROM (( + SELECT `l`.`Name`, `l`.`CommanderName`, `u`.`Nickname`, `u`.`SquadId` + FROM `LocustHordes` AS `l`, + ( + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` + ) AS `u` + WHERE `u`.`HasSoulPatch` = TRUE +) AS `s` +LEFT JOIN `LocustCommanders` AS `l0` ON `s`.`CommanderName` = `l0`.`Name`) LEFT JOIN ( - SELECT `g`.`SquadId` + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `s`.`Id` = `u`.`SquadId` -WHERE `s`.`Name` = 'Kilo' + SELECT `o0`.`Nickname`, `o0`.`SquadId` + FROM `Officers` AS `o0` +) AS `u0` ON `l0`.`DefeatedByNickname` = `u0`.`Nickname` AND `l0`.`DefeatedBySquadId` = `u0`.`SquadId` +WHERE `u0`.`Nickname` = `s`.`Nickname` AND `u0`.`SquadId` = `s`.`SquadId` """); } - public override async Task Any_with_optional_navigation_as_subquery_predicate_is_translated_to_sql(bool async) + public override async Task Comparing_entities_using_Equals_inheritance(bool async) { - await base.Any_with_optional_navigation_as_subquery_predicate_is_translated_to_sql(async); + await base.Comparing_entities_using_Equals_inheritance(async); AssertSql( """ -SELECT `s`.`Name` -FROM `Squads` AS `s` -WHERE NOT EXISTS ( - SELECT 1 - FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` - ) AS `u` - LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` - WHERE `s`.`Id` = `u`.`SquadId` AND `t`.`Note` = 'Dom''s Tag') +SELECT `u`.`Nickname` AS `Nickname1`, `u0`.`Nickname` AS `Nickname2` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` +) AS `u`, +( + SELECT `o0`.`Nickname`, `o0`.`SquadId` + FROM `Officers` AS `o0` +) AS `u0` +WHERE `u`.`Nickname` = `u0`.`Nickname` AND `u`.`SquadId` = `u0`.`SquadId` +ORDER BY `u`.`Nickname`, `u0`.`Nickname` """); } - public override async Task All_with_optional_navigation_is_translated_to_sql(bool async) + public override async Task Contains_on_nullable_array_produces_correct_sql(bool async) { - await base.All_with_optional_navigation_is_translated_to_sql(async); + await base.Contains_on_nullable_array_produces_correct_sql(async); AssertSql( """ -SELECT IIF(NOT EXISTS ( - SELECT 1 - FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` - ) AS `u` - LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` - WHERE `t`.`Note` = 'Foo'), TRUE, FALSE) -FROM (SELECT COUNT(*) FROM `#Dual`) +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name` +WHERE `u`.`SquadId` < 2 AND (`c`.`Name` IS NULL OR `c`.`Name` = 'Ephyra') """); } - public override async Task Contains_with_local_nullable_guid_list_closure(bool async) + public override async Task Optional_navigation_with_collection_composite_key(bool async) { - await base.Contains_with_local_nullable_guid_list_closure(async); + await base.Optional_navigation_with_collection_composite_key(async); AssertSql( """ SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` FROM `Tags` AS `t` -WHERE `t`.`Id` IN ('{df36f493-463f-4123-83f9-6b135deeb7ba}', '{23cbcf9b-ce14-45cf-aafa-2c2667ebfdd3}', '{ab1b82d7-88db-42bd-a132-7eef9aa68af4}') -"""); - } - - public override async Task Unnecessary_include_doesnt_get_added_complex_when_projecting_EF_Property(bool async) - { - await base.Unnecessary_include_doesnt_get_added_complex_when_projecting_EF_Property(async); - - AssertSql( - """ -SELECT `u`.`FullName` -FROM ( - SELECT `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`Rank` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`Rank` + SELECT `o`.`Nickname`, `o`.`SquadId`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u` -WHERE `u`.`HasSoulPatch` = TRUE -ORDER BY `u`.`Rank` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE `u`.`Discriminator` = 'Officer' AND ( + SELECT COUNT(*) + FROM ( + SELECT `g0`.`Nickname`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` + FROM `Officers` AS `o0` + ) AS `u0` + WHERE `u`.`Nickname` IS NOT NULL AND `u`.`SquadId` IS NOT NULL AND `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId` AND `u0`.`Nickname` = 'Dom') > 0 """); } - public override async Task Multiple_order_bys_are_properly_lifted_from_subquery_created_by_include(bool async) + public override async Task Select_null_conditional_with_inheritance(bool async) { - await base.Multiple_order_bys_are_properly_lifted_from_subquery_created_by_include(async); + await base.Select_null_conditional_with_inheritance(async); AssertSql( - """ -SELECT `u`.`FullName` -FROM ( - SELECT `g`.`FullName`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`FullName`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` -WHERE `u`.`HasSoulPatch` = FALSE -ORDER BY `u`.`FullName` +""" +SELECT IIF(`l`.`CommanderName` IS NOT NULL, `l`.`CommanderName`, NULL) +FROM `LocustHordes` AS `l` """); } - public override async Task Order_by_is_properly_lifted_from_subquery_with_same_order_by_in_the_outer_query(bool async) + public override async Task Select_null_conditional_with_inheritance_negative(bool async) { - await base.Order_by_is_properly_lifted_from_subquery_with_same_order_by_in_the_outer_query(async); + await base.Select_null_conditional_with_inheritance_negative(async); AssertSql( """ -SELECT `u`.`FullName` -FROM ( - SELECT `g`.`FullName`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`FullName`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` -WHERE `u`.`HasSoulPatch` = FALSE -ORDER BY `u`.`FullName` +SELECT IIF(`l`.`CommanderName` IS NOT NULL, `l`.`Eradicated`, NULL) +FROM `LocustHordes` AS `l` """); } - public override async Task Where_is_properly_lifted_from_subquery_created_by_include(bool async) + public override async Task Project_collection_navigation_with_inheritance1(bool async) { - await base.Where_is_properly_lifted_from_subquery_created_by_include(async); + await base.Project_collection_navigation_with_inheritance1(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` +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` +FROM ((`LocustHordes` AS `l` +LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name`) +LEFT JOIN `LocustHordes` AS `l1` ON `l0`.`Name` = `l1`.`CommanderName`) +LEFT JOIN ( + SELECT `l2`.`Name`, `l2`.`LocustHordeId`, `l2`.`ThreatLevel`, `l2`.`ThreatLevelByte`, `l2`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l2` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` -WHERE `u`.`FullName` <> 'Augustus Cole' AND `u`.`HasSoulPatch` = FALSE -ORDER BY `u`.`FullName` + SELECT `l3`.`Name`, `l3`.`LocustHordeId`, `l3`.`ThreatLevel`, `l3`.`ThreatLevelByte`, `l3`.`ThreatLevelNullableByte`, `l3`.`DefeatedByNickname`, `l3`.`DefeatedBySquadId`, `l3`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l3` +) AS `u` ON `l1`.`Id` = `u`.`LocustHordeId` +ORDER BY `l`.`Id`, `l0`.`Name`, `l1`.`Id` """); } - public override async Task Subquery_is_lifted_from_main_from_clause_of_SelectMany(bool async) + public override async Task Project_collection_navigation_with_inheritance2(bool async) { - await base.Subquery_is_lifted_from_main_from_clause_of_SelectMany(async); - + await base.Project_collection_navigation_with_inheritance2(async); AssertSql( """ -SELECT `u`.`FullName` AS `Name1`, `u0`.`FullName` AS `Name2` -FROM ( - SELECT `g`.`FullName`, `g`.`HasSoulPatch` +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` +FROM ((`LocustHordes` AS `l` +LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name`) +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`FullName`, `o`.`HasSoulPatch` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u`, -( - SELECT `g0`.`FullName`, `g0`.`HasSoulPatch` +) AS `u` ON `l0`.`DefeatedByNickname` = `u`.`Nickname` AND `l0`.`DefeatedBySquadId` = `u`.`SquadId`) +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g0` UNION ALL - SELECT `o0`.`FullName`, `o0`.`HasSoulPatch` + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o0` -) AS `u0` -WHERE `u`.`HasSoulPatch` = TRUE AND `u0`.`HasSoulPatch` = FALSE -ORDER BY `u`.`FullName` +) 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` """); } - public override async Task Subquery_containing_SelectMany_projecting_main_from_clause_gets_lifted(bool async) + public override async Task Project_collection_navigation_with_inheritance3(bool async) { - await base.Subquery_containing_SelectMany_projecting_main_from_clause_gets_lifted(async); - + await base.Project_collection_navigation_with_inheritance3(async); AssertSql( """ -SELECT `u`.`FullName` -FROM ( - SELECT `g`.`FullName`, `g`.`HasSoulPatch` +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` +FROM ((`LocustHordes` AS `l` +LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name`) +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`FullName`, `o`.`HasSoulPatch` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u`, -`Tags` AS `t` -WHERE `u`.`HasSoulPatch` = TRUE -ORDER BY `u`.`FullName` +) AS `u` ON `l0`.`DefeatedByNickname` = `u`.`Nickname` AND `l0`.`DefeatedBySquadId` = `u`.`SquadId`) +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, '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` """); } - public override async Task Subquery_containing_join_projecting_main_from_clause_gets_lifted(bool async) + public override async Task Include_reference_on_derived_type_using_string(bool async) { - await base.Subquery_containing_join_projecting_main_from_clause_gets_lifted(async); + await base.Include_reference_on_derived_type_using_string(async); AssertSql( """ -SELECT `u`.`Nickname` +SELECT `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` FROM ( - SELECT `g`.`Nickname` + SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l` + UNION ALL + SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l0` +) AS `u` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u` -INNER JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` -ORDER BY `u`.`Nickname` +) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId` """); } - public override async Task Subquery_containing_left_join_projecting_main_from_clause_gets_lifted(bool async) + public override async Task Include_reference_on_derived_type_using_string_nested1(bool async) { - await base.Subquery_containing_left_join_projecting_main_from_clause_gets_lifted(async); + await base.Include_reference_on_derived_type_using_string_nested1(async); AssertSql( """ -SELECT `u`.`Nickname` -FROM ( - SELECT `g`.`Nickname` +SELECT `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`, `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` +FROM (( + SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l` + UNION ALL + SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l0` +) AS `u` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` -ORDER BY `u`.`Nickname` +) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId`) +LEFT JOIN `Squads` AS `s` ON `u0`.`SquadId` = `s`.`Id` """); } - public override async Task Subquery_containing_join_gets_lifted_clashing_names(bool async) + public override async Task Include_reference_on_derived_type_using_string_nested2(bool async) { - await base.Subquery_containing_join_gets_lifted_clashing_names(async); + await base.Include_reference_on_derived_type_using_string_nested2(async); AssertSql( """ -SELECT `u`.`Nickname` +SELECT `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`, `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 `g`.`Nickname` + SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l` + UNION ALL + SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l0` +) AS `u` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u` -INNER JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName`) -INNER JOIN `Tags` AS `t0` ON `u`.`Nickname` = `t0`.`GearNickName` -WHERE `t`.`GearNickName` <> 'Cole Train' OR `t`.`GearNickName` IS NULL -ORDER BY `u`.`Nickname`, `t0`.`Id` +) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId`) +LEFT JOIN ( + SELECT `u1`.`Nickname`, `u1`.`SquadId`, `u1`.`AssignedCityName`, `u1`.`CityOfBirthName`, `u1`.`FullName`, `u1`.`HasSoulPatch`, `u1`.`LeaderNickname`, `u1`.`LeaderSquadId`, `u1`.`Rank`, `u1`.`Discriminator`, `c`.`Name`, `c`.`Location`, `c`.`Nation` + FROM ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + 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` """); } - public override async Task Subquery_created_by_include_gets_lifted_nested(bool async) + public override async Task Include_reference_on_derived_type_using_lambda(bool async) { - await base.Subquery_created_by_include_gets_lifted_nested(async); + await base.Include_reference_on_derived_type_using_lambda(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `c`.`Name`, `c`.`Location`, `c`.`Nation` +SELECT `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` FROM ( + SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l` + UNION ALL + SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l0` +) AS `u` +LEFT JOIN ( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u` -INNER JOIN `Cities` AS `c` ON `u`.`CityOfBirthName` = `c`.`Name` -WHERE EXISTS ( - SELECT 1 - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName`) AND `u`.`HasSoulPatch` = FALSE -ORDER BY `u`.`Nickname` +) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId` """); } - public override async Task Subquery_is_lifted_from_additional_from_clause(bool async) + public override async Task Include_reference_on_derived_type_using_lambda_with_soft_cast(bool async) { - await base.Subquery_is_lifted_from_additional_from_clause(async); + await base.Include_reference_on_derived_type_using_lambda_with_soft_cast(async); AssertSql( """ -SELECT `u`.`FullName` AS `Name1`, `u0`.`FullName` AS `Name2` +SELECT `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` FROM ( - SELECT `g`.`FullName`, `g`.`HasSoulPatch` + SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l` + UNION ALL + SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l0` +) AS `u` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`FullName`, `o`.`HasSoulPatch` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u`, -( - SELECT `g0`.`FullName`, `g0`.`HasSoulPatch` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`FullName`, `o0`.`HasSoulPatch` - FROM `Officers` AS `o0` -) AS `u0` -WHERE `u`.`HasSoulPatch` = TRUE AND `u0`.`HasSoulPatch` = FALSE -ORDER BY `u`.`FullName` +) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId` """); } - public override async Task Subquery_with_result_operator_is_not_lifted(bool async) + public override async Task Include_reference_on_derived_type_using_lambda_with_tracking(bool async) { - await base.Subquery_with_result_operator_is_not_lifted(async); + await base.Include_reference_on_derived_type_using_lambda_with_tracking(async); AssertSql( """ -SELECT `u0`.`FullName` +SELECT `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` FROM ( - SELECT TOP 2 `u`.`FullName`, `u`.`Rank` - FROM ( - SELECT `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`Rank` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`Rank` - FROM `Officers` AS `o` - ) AS `u` - WHERE `u`.`HasSoulPatch` = FALSE - ORDER BY `u`.`FullName` -) AS `u0` -ORDER BY `u0`.`Rank` + SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l` + UNION ALL + SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l0` +) AS `u` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId` """); } - public override async Task Skip_with_orderby_followed_by_orderBy_is_pushed_down(bool async) + public override async Task Include_collection_on_derived_type_using_string(bool async) { - await base.Skip_with_orderby_followed_by_orderBy_is_pushed_down(async); + await base.Include_collection_on_derived_type_using_string(async); AssertSql( -""" -@__p_0='1' - -SELECT [t0].[FullName] + """ +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` FROM ( - SELECT [t].[FullName], [t].[Rank] - FROM ( - SELECT [g].[FullName], [g].[HasSoulPatch], [g].[Rank] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[FullName], [o].[HasSoulPatch], [o].[Rank] - FROM [Officers] AS [o] - ) AS [t] - WHERE [t].[HasSoulPatch] = CAST(0 AS bit) - ORDER BY [t].[FullName] - OFFSET @__p_0 ROWS -) AS [t0] -ORDER BY [t0].[Rank] + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` +) AS `u0` ON `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname` """); } - public override async Task Take_without_orderby_followed_by_orderBy_is_pushed_down1(bool async) + public override async Task Include_collection_on_derived_type_using_lambda(bool async) { - await base.Take_without_orderby_followed_by_orderBy_is_pushed_down1(async); + await base.Include_collection_on_derived_type_using_lambda(async); AssertSql( -""" -@__p_0='999' - -SELECT [t0].[FullName] + """ +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` FROM ( - SELECT TOP(@__p_0) [t].[FullName], [t].[Rank] - FROM ( - SELECT [g].[FullName], [g].[HasSoulPatch], [g].[Rank] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[FullName], [o].[HasSoulPatch], [o].[Rank] - FROM [Officers] AS [o] - ) AS [t] - WHERE [t].[HasSoulPatch] = CAST(0 AS bit) -) AS [t0] -ORDER BY [t0].[Rank] + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` +) AS `u0` ON `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname` """); } - public override async Task Take_without_orderby_followed_by_orderBy_is_pushed_down2(bool async) + public override async Task Include_collection_on_derived_type_using_lambda_with_soft_cast(bool async) { - await base.Take_without_orderby_followed_by_orderBy_is_pushed_down2(async); + await base.Include_collection_on_derived_type_using_lambda_with_soft_cast(async); AssertSql( -""" -@__p_0='999' - -SELECT [t0].[FullName] + """ +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` FROM ( - SELECT TOP(@__p_0) [t].[FullName], [t].[Rank] - FROM ( - SELECT [g].[FullName], [g].[HasSoulPatch], [g].[Rank] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[FullName], [o].[HasSoulPatch], [o].[Rank] - FROM [Officers] AS [o] - ) AS [t] - WHERE [t].[HasSoulPatch] = CAST(0 AS bit) -) AS [t0] -ORDER BY [t0].[Rank] + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` +) AS `u0` ON `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname` """); } - public override async Task Take_without_orderby_followed_by_orderBy_is_pushed_down3(bool async) + public override async Task Include_base_navigation_on_derived_entity(bool async) { - await base.Take_without_orderby_followed_by_orderBy_is_pushed_down3(async); + await base.Include_base_navigation_on_derived_entity(async); AssertSql( """ -SELECT `u0`.`FullName` -FROM ( - SELECT TOP 999 `u`.`FullName`, `u`.`Rank` - FROM ( - SELECT `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`Rank` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`Rank` - FROM `Officers` AS `o` - ) AS `u` - WHERE `u`.`HasSoulPatch` = FALSE -) AS `u0` -ORDER BY `u0`.`FullName`, `u0`.`Rank` -"""); +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM (( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + 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` +"""); } - public override async Task Select_length_of_string_property(bool async) + public override async Task ThenInclude_collection_on_derived_after_base_reference(bool async) { - await base.Select_length_of_string_property(async); + await base.ThenInclude_collection_on_derived_after_base_reference(async); AssertSql( -""" -SELECT `w`.`Name`, IIF(LEN(`w`.`Name`) IS NULL, NULL, CLNG(LEN(`w`.`Name`))) AS `Length` -FROM `Weapons` AS `w` + """ +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note`, `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM (`Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + 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` """); } - public override async Task Client_method_on_collection_navigation_in_outer_join_key(bool async) + public override async Task ThenInclude_collection_on_derived_after_derived_reference(bool async) { - await base.Client_method_on_collection_navigation_in_outer_join_key(async); + await base.ThenInclude_collection_on_derived_after_derived_reference(async); - AssertSql(); + AssertSql( + """ +SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `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 ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` ON `l0`.`DefeatedByNickname` = `u`.`Nickname` AND `l0`.`DefeatedBySquadId` = `u`.`SquadId`) +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, '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` +"""); } - public override async Task Member_access_on_derived_entity_using_cast(bool async) + public override async Task ThenInclude_collection_on_derived_after_derived_collection(bool async) { - await base.Member_access_on_derived_entity_using_cast(async); + await base.ThenInclude_collection_on_derived_after_derived_collection(async); AssertSql( -""" -SELECT `l`.`Name`, `l`.`Eradicated` -FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name` + """ +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `s`.`Nickname0`, `s`.`SquadId0`, `s`.`AssignedCityName0`, `s`.`CityOfBirthName0`, `s`.`FullName0`, `s`.`HasSoulPatch0`, `s`.`LeaderNickname0`, `s`.`LeaderSquadId0`, `s`.`Rank0`, `s`.`Discriminator0` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN ( + SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `u1`.`Nickname` AS `Nickname0`, `u1`.`SquadId` AS `SquadId0`, `u1`.`AssignedCityName` AS `AssignedCityName0`, `u1`.`CityOfBirthName` AS `CityOfBirthName0`, `u1`.`FullName` AS `FullName0`, `u1`.`HasSoulPatch` AS `HasSoulPatch0`, `u1`.`LeaderNickname` AS `LeaderNickname0`, `u1`.`LeaderSquadId` AS `LeaderSquadId0`, `u1`.`Rank` AS `Rank0`, `u1`.`Discriminator` AS `Discriminator0` + FROM ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` + ) AS `u0` + LEFT JOIN ( + SELECT `g1`.`Nickname`, `g1`.`SquadId`, `g1`.`AssignedCityName`, `g1`.`CityOfBirthName`, `g1`.`FullName`, `g1`.`HasSoulPatch`, `g1`.`LeaderNickname`, `g1`.`LeaderSquadId`, `g1`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g1` + UNION ALL + SELECT `o1`.`Nickname`, `o1`.`SquadId`, `o1`.`AssignedCityName`, `o1`.`CityOfBirthName`, `o1`.`FullName`, `o1`.`HasSoulPatch`, `o1`.`LeaderNickname`, `o1`.`LeaderSquadId`, `o1`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o1` + ) AS `u1` ON `u0`.`Nickname` = `u1`.`LeaderNickname` AND `u0`.`SquadId` = `u1`.`LeaderSquadId` +) AS `s` ON `u`.`Nickname` = `s`.`LeaderNickname` AND `u`.`SquadId` = `s`.`LeaderSquadId` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } - public override async Task Member_access_on_derived_materialized_entity_using_cast(bool async) + public override async Task ThenInclude_reference_on_derived_after_derived_collection(bool async) { - await base.Member_access_on_derived_materialized_entity_using_cast(async); + await base.ThenInclude_reference_on_derived_after_derived_collection(async); AssertSql( -""" -SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated` + """ +SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, `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` FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name` +LEFT JOIN ( + SELECT `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` + FROM ( + SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l0` + UNION ALL + SELECT `l1`.`Name`, `l1`.`LocustHordeId`, `l1`.`ThreatLevel`, `l1`.`ThreatLevelByte`, `l1`.`ThreatLevelNullableByte`, `l1`.`DefeatedByNickname`, `l1`.`DefeatedBySquadId`, `l1`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l1` + ) AS `u` + LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` + ) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId` +) AS `s` ON `l`.`Id` = `s`.`LocustHordeId` +ORDER BY `l`.`Id`, `s`.`Name`, `s`.`Nickname` """); } - public override async Task Member_access_on_derived_entity_using_cast_and_let(bool async) + public override async Task Multiple_derived_included_on_one_method(bool async) { - await base.Member_access_on_derived_entity_using_cast_and_let(async); + await base.Multiple_derived_included_on_one_method(async); AssertSql( -""" -SELECT `l`.`Name`, `l`.`Eradicated` -FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name` + """ +SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `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 ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` ON `l0`.`DefeatedByNickname` = `u`.`Nickname` AND `l0`.`DefeatedBySquadId` = `u`.`SquadId`) +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, '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` """); } - public override async Task Property_access_on_derived_entity_using_cast(bool async) + public override async Task Include_on_derived_multi_level(bool async) { - await base.Property_access_on_derived_entity_using_cast(async); + await base.Include_on_derived_multi_level(async); AssertSql( -""" -SELECT `l`.`Name`, `l`.`Eradicated` -FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name` + """ +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`AssignedCityName`, `s1`.`CityOfBirthName`, `s1`.`FullName`, `s1`.`HasSoulPatch`, `s1`.`LeaderNickname`, `s1`.`LeaderSquadId`, `s1`.`Rank`, `s1`.`Discriminator`, `s1`.`Id`, `s1`.`Banner`, `s1`.`Banner5`, `s1`.`InternalNumber`, `s1`.`Name`, `s1`.`SquadId0`, `s1`.`MissionId` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN ( + SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name`, `s0`.`SquadId` AS `SquadId0`, `s0`.`MissionId` + FROM (( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` + ) AS `u0` + 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` """); } - public override async Task Navigation_access_on_derived_entity_using_cast(bool async) + public override async Task Projecting_nullable_bool_in_conditional_works(bool async) { - await base.Navigation_access_on_derived_entity_using_cast(async); + await base.Projecting_nullable_bool_in_conditional_works(async); AssertSql( -""" -SELECT `l`.`Name`, `l0`.`ThreatLevel` AS `Threat` -FROM `LocustHordes` AS `l` -LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -ORDER BY `l`.`Name` + """ +SELECT IIF(`u`.`Nickname` IS NOT NULL AND `u`.`SquadId` IS NOT NULL, `u`.`HasSoulPatch`, FALSE) AS `Prop` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` """); } - public override async Task Navigation_access_on_derived_materialized_entity_using_cast(bool async) + public override async Task ToString_enum_property_projection(bool async) { - await base.Navigation_access_on_derived_materialized_entity_using_cast(async); + await base.ToString_enum_property_projection(async); AssertSql( -""" -SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, `l0`.`ThreatLevel` AS `Threat` -FROM `LocustHordes` AS `l` -LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -ORDER BY `l`.`Name` + """ +SELECT IIF(`u`.`Rank` = 0, 'None', IIF(`u`.`Rank` = 1, 'Private', IIF(`u`.`Rank` = 2, 'Corporal', IIF(`u`.`Rank` = 4, 'Sergeant', IIF(`u`.`Rank` = 8, 'Lieutenant', IIF(`u`.`Rank` = 16, 'Captain', IIF(`u`.`Rank` = 32, 'Major', IIF(`u`.`Rank` = 64, 'Colonel', IIF(`u`.`Rank` = 128, 'General', (`u`.`Rank` & '')))))))))) +FROM ( + SELECT `g`.`Rank` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Rank` + FROM `Officers` AS `o` +) AS `u` """); } - public override async Task Navigation_access_via_EFProperty_on_derived_entity_using_cast(bool async) + public override async Task ToString_nullable_enum_property_projection(bool async) { - await base.Navigation_access_via_EFProperty_on_derived_entity_using_cast(async); + await base.ToString_nullable_enum_property_projection(async); AssertSql( -""" -SELECT `l`.`Name`, `l0`.`ThreatLevel` AS `Threat` -FROM `LocustHordes` AS `l` -LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -ORDER BY `l`.`Name` + """ +SELECT IIF(`w`.`AmmunitionType` = 1, 'Cartridge', IIF(`w`.`AmmunitionType` = 2, 'Shell', IIF((`w`.`AmmunitionType` & '') IS NULL, '', (`w`.`AmmunitionType` & '')))) +FROM `Weapons` AS `w` """); } - public override async Task Navigation_access_fk_on_derived_entity_using_cast(bool async) + public override async Task ToString_enum_contains(bool async) { - await base.Navigation_access_fk_on_derived_entity_using_cast(async); + await base.ToString_enum_contains(async); AssertSql( -""" -SELECT `l`.`Name`, `l0`.`Name` AS `CommanderName` -FROM `LocustHordes` AS `l` -LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -ORDER BY `l`.`Name` + """ +SELECT `m`.`CodeName` +FROM `Missions` AS `m` +WHERE (`m`.`Difficulty` & '') LIKE '%Med%' """); } - public override async Task Collection_navigation_access_on_derived_entity_using_cast(bool async) + public override async Task ToString_nullable_enum_contains(bool async) { - await base.Collection_navigation_access_on_derived_entity_using_cast(async); + await base.ToString_nullable_enum_contains(async); AssertSql( """ -SELECT `l`.`Name`, ( - SELECT COUNT(*) - FROM ( - SELECT `l0`.`LocustHordeId` - FROM `LocustLeaders` AS `l0` - UNION ALL - SELECT `l1`.`LocustHordeId` - FROM `LocustCommanders` AS `l1` - ) AS `u` - WHERE `l`.`Id` = `u`.`LocustHordeId`) AS `LeadersCount` -FROM `LocustHordes` AS `l` -ORDER BY `l`.`Name` +SELECT `w`.`Name` +FROM `Weapons` AS `w` +WHERE IIF(`w`.`AmmunitionType` = 1, 'Cartridge', IIF(`w`.`AmmunitionType` = 2, 'Shell', IIF((`w`.`AmmunitionType` & '') IS NULL, '', (`w`.`AmmunitionType` & '')))) LIKE '%Cart%' """); } - public override async Task Collection_navigation_access_on_derived_entity_using_cast_in_SelectMany(bool async) + public override async Task Correlated_collections_naked_navigation_with_ToList(bool async) { - await base.Collection_navigation_access_on_derived_entity_using_cast_in_SelectMany(async); + await base.Correlated_collections_naked_navigation_with_ToList(async); AssertSql( """ -SELECT `l`.`Name`, `u`.`Name` AS `LeaderName` -FROM `LocustHordes` AS `l` -INNER JOIN ( - SELECT `l0`.`Name`, `l0`.`LocustHordeId` - FROM `LocustLeaders` AS `l0` +SELECT `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + FROM `Gears` AS `g` UNION ALL - SELECT `l1`.`Name`, `l1`.`LocustHordeId` - FROM `LocustCommanders` AS `l1` -) AS `u` ON `l`.`Id` = `u`.`LocustHordeId` -ORDER BY `u`.`Name` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` +WHERE `u`.`Nickname` <> 'Marcus' +ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Include_on_derived_entity_using_OfType(bool async) + public override async Task Correlated_collections_naked_navigation_with_ToList_followed_by_projecting_count(bool async) { - await base.Include_on_derived_entity_using_OfType(async); + await base.Correlated_collections_naked_navigation_with_ToList_followed_by_projecting_count(async); AssertSql( """ -SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, `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 ( - SELECT `l1`.`Name`, `l1`.`LocustHordeId`, `l1`.`ThreatLevel`, `l1`.`ThreatLevelByte`, `l1`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l1` +SELECT ( + SELECT COUNT(*) + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName`) +FROM ( + SELECT `g`.`Nickname`, `g`.`FullName` + FROM `Gears` AS `g` UNION ALL - SELECT `l2`.`Name`, `l2`.`LocustHordeId`, `l2`.`ThreatLevel`, `l2`.`ThreatLevelByte`, `l2`.`ThreatLevelNullableByte`, `l2`.`DefeatedByNickname`, `l2`.`DefeatedBySquadId`, `l2`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l2` -) AS `u` ON `l`.`Id` = `u`.`LocustHordeId` -ORDER BY `l`.`Name`, `l`.`Id`, `l0`.`Name` + SELECT `o`.`Nickname`, `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` +WHERE `u`.`Nickname` <> 'Marcus' +ORDER BY `u`.`Nickname` """); } - public override async Task Distinct_on_subquery_doesnt_get_lifted(bool async) + public override async Task Correlated_collections_naked_navigation_with_ToArray(bool async) { - await base.Distinct_on_subquery_doesnt_get_lifted(async); + await base.Correlated_collections_naked_navigation_with_ToArray(async); AssertSql( """ -SELECT `u0`.`HasSoulPatch` +SELECT `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM ( - SELECT DISTINCT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` - FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` - ) AS `u` -) AS `u0` -"""); - } - - public override async Task Cast_result_operator_on_subquery_is_properly_lifted_to_a_convert(bool async) - { - await base.Cast_result_operator_on_subquery_is_properly_lifted_to_a_convert(async); - - AssertSql( -""" -SELECT `l`.`Eradicated` -FROM `LocustHordes` AS `l` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` +WHERE `u`.`Nickname` <> 'Marcus' +ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Comparing_two_collection_navigations_composite_key(bool async) + public override async Task Correlated_collections_basic_projection(bool async) { - await base.Comparing_two_collection_navigations_composite_key(async); + await base.Correlated_collections_basic_projection(async); AssertSql( """ -SELECT `u`.`Nickname` AS `Nickname1`, `u0`.`Nickname` AS `Nickname2` +SELECT `u`.`Nickname`, `u`.`SquadId`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` -) AS `u`, -( - SELECT `g0`.`Nickname`, `g0`.`SquadId` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId` - FROM `Officers` AS `o0` -) AS `u0` -WHERE `u`.`Nickname` = `u0`.`Nickname` AND `u`.`SquadId` = `u0`.`SquadId` -ORDER BY `u`.`Nickname` +) AS `u` +LEFT JOIN ( + SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + FROM `Weapons` AS `w` + WHERE `w`.`IsAutomatic` = TRUE OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL +) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` +WHERE `u`.`Nickname` <> 'Marcus' +ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Comparing_two_collection_navigations_inheritance(bool async) + public override async Task Correlated_collections_basic_projection_explicit_to_list(bool async) { - await base.Comparing_two_collection_navigations_inheritance(async); + await base.Correlated_collections_basic_projection_explicit_to_list(async); AssertSql( """ -SELECT `s`.`Name`, `s`.`Nickname` -FROM (( - SELECT `l`.`Name`, `l`.`CommanderName`, `u`.`Nickname`, `u`.`SquadId` - FROM `LocustHordes` AS `l`, - ( - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` - ) AS `u` - WHERE `u`.`HasSoulPatch` = TRUE -) AS `s` -LEFT JOIN `LocustCommanders` AS `l0` ON `s`.`CommanderName` = `l0`.`Name`) -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` +SELECT `u`.`Nickname`, `u`.`SquadId`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId` - FROM `Officers` AS `o0` -) AS `u0` ON `l0`.`DefeatedByNickname` = `u0`.`Nickname` AND `l0`.`DefeatedBySquadId` = `u0`.`SquadId` -WHERE `u0`.`Nickname` = `s`.`Nickname` AND `u0`.`SquadId` = `s`.`SquadId` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN ( + SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + FROM `Weapons` AS `w` + WHERE `w`.`IsAutomatic` = TRUE OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL +) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` +WHERE `u`.`Nickname` <> 'Marcus' +ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Comparing_entities_using_Equals_inheritance(bool async) + public override async Task Correlated_collections_basic_projection_explicit_to_array(bool async) { - await base.Comparing_entities_using_Equals_inheritance(async); + await base.Correlated_collections_basic_projection_explicit_to_array(async); AssertSql( """ -SELECT `u`.`Nickname` AS `Nickname1`, `u0`.`Nickname` AS `Nickname2` +SELECT `u`.`Nickname`, `u`.`SquadId`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` -) AS `u`, -( - SELECT `o0`.`Nickname`, `o0`.`SquadId` - FROM `Officers` AS `o0` -) AS `u0` -WHERE `u`.`Nickname` = `u0`.`Nickname` AND `u`.`SquadId` = `u0`.`SquadId` -ORDER BY `u`.`Nickname`, `u0`.`Nickname` +) AS `u` +LEFT JOIN ( + SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + FROM `Weapons` AS `w` + WHERE `w`.`IsAutomatic` = TRUE OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL +) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` +WHERE `u`.`Nickname` <> 'Marcus' +ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Contains_on_nullable_array_produces_correct_sql(bool async) + public override async Task Correlated_collections_basic_projection_ordered(bool async) { - await base.Contains_on_nullable_array_produces_correct_sql(async); + await base.Correlated_collections_basic_projection_ordered(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +SELECT `u`.`Nickname`, `u`.`SquadId`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` ) AS `u` -LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name` -WHERE `u`.`SquadId` < 2 AND (`c`.`Name` IS NULL OR `c`.`Name` = 'Ephyra') +LEFT JOIN ( + SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + FROM `Weapons` AS `w` + WHERE `w`.`IsAutomatic` = TRUE OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL +) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` +WHERE `u`.`Nickname` <> 'Marcus' +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `w0`.`Name` DESC """); } - public override async Task Optional_navigation_with_collection_composite_key(bool async) + public override async Task Correlated_collections_basic_projection_composite_key(bool async) { - await base.Optional_navigation_with_collection_composite_key(async); + await base.Correlated_collections_basic_projection_composite_key(async); AssertSql( """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, 'Officer' AS `Discriminator` +SELECT `u`.`Nickname`, `u`.`SquadId`, `u1`.`Nickname`, `u1`.`FullName`, `u1`.`SquadId` +FROM ( + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE `u`.`Discriminator` = 'Officer' AND ( - SELECT COUNT(*) +) AS `u` +LEFT JOIN ( + SELECT `u0`.`Nickname`, `u0`.`FullName`, `u0`.`SquadId`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId` FROM ( - SELECT `g0`.`Nickname`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId` - FROM `Gears` AS `g0` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId` + FROM `Gears` AS `g` UNION ALL - SELECT `o0`.`Nickname`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` FROM `Officers` AS `o0` ) AS `u0` - WHERE `u`.`Nickname` IS NOT NULL AND `u`.`SquadId` IS NOT NULL AND `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId` AND `u0`.`Nickname` = 'Dom') > 0 -"""); - } - - public override async Task Select_null_conditional_with_inheritance(bool async) - { - await base.Select_null_conditional_with_inheritance(async); - - AssertSql( -""" -SELECT IIF(`l`.`CommanderName` IS NOT NULL, `l`.`CommanderName`, NULL) -FROM `LocustHordes` AS `l` + WHERE `u0`.`HasSoulPatch` = FALSE +) AS `u1` ON `u`.`Nickname` = `u1`.`LeaderNickname` AND `u`.`SquadId` = `u1`.`LeaderSquadId` +WHERE `u`.`Nickname` <> 'Foo' +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u1`.`Nickname` """); } - public override async Task Select_null_conditional_with_inheritance_negative(bool async) + public override async Task Correlated_collections_basic_projecting_single_property(bool async) { - await base.Select_null_conditional_with_inheritance_negative(async); + await base.Correlated_collections_basic_projecting_single_property(async); AssertSql( """ -SELECT IIF(`l`.`CommanderName` IS NOT NULL, `l`.`Eradicated`, NULL) -FROM `LocustHordes` AS `l` +SELECT `u`.`Nickname`, `u`.`SquadId`, `w0`.`Name`, `w0`.`Id` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN ( + SELECT `w`.`Name`, `w`.`Id`, `w`.`OwnerFullName` + FROM `Weapons` AS `w` + WHERE `w`.`IsAutomatic` = TRUE OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL +) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` +WHERE `u`.`Nickname` <> 'Marcus' +ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Project_collection_navigation_with_inheritance1(bool async) + public override async Task Correlated_collections_basic_projecting_constant(bool async) { - await base.Project_collection_navigation_with_inheritance1(async); + await base.Correlated_collections_basic_projecting_constant(async); 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` -FROM ((`LocustHordes` AS `l` -LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name`) -LEFT JOIN `LocustHordes` AS `l1` ON `l0`.`Name` = `l1`.`CommanderName`) -LEFT JOIN ( - SELECT `l2`.`Name`, `l2`.`LocustHordeId`, `l2`.`ThreatLevel`, `l2`.`ThreatLevelByte`, `l2`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l2` +SELECT `u`.`Nickname`, `u`.`SquadId`, `w0`.`c`, `w0`.`Id` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + FROM `Gears` AS `g` UNION ALL - SELECT `l3`.`Name`, `l3`.`LocustHordeId`, `l3`.`ThreatLevel`, `l3`.`ThreatLevelByte`, `l3`.`ThreatLevelNullableByte`, `l3`.`DefeatedByNickname`, `l3`.`DefeatedBySquadId`, `l3`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l3` -) AS `u` ON `l1`.`Id` = `u`.`LocustHordeId` -ORDER BY `l`.`Id`, `l0`.`Name`, `l1`.`Id` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN ( + SELECT 'BFG' AS `c`, `w`.`Id`, `w`.`OwnerFullName` + FROM `Weapons` AS `w` + WHERE `w`.`IsAutomatic` = TRUE OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL +) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` +WHERE `u`.`Nickname` <> 'Marcus' +ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Project_collection_navigation_with_inheritance2(bool async) + public override async Task Correlated_collections_basic_projecting_constant_bool(bool async) { - await base.Project_collection_navigation_with_inheritance2(async); + await base.Correlated_collections_basic_projecting_constant_bool(async); + 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` -FROM ((`LocustHordes` AS `l` -LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name`) -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` +SELECT `u`.`Nickname`, `u`.`SquadId`, `w0`.`c`, `w0`.`Id` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` -) AS `u` ON `l0`.`DefeatedByNickname` = `u`.`Nickname` AND `l0`.`DefeatedBySquadId` = `u`.`SquadId`) +) AS `u` LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, '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` + SELECT TRUE AS `c`, `w`.`Id`, `w`.`OwnerFullName` + FROM `Weapons` AS `w` + WHERE `w`.`IsAutomatic` = TRUE OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL +) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` +WHERE `u`.`Nickname` <> 'Marcus' +ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Project_collection_navigation_with_inheritance3(bool async) + public override async Task Correlated_collections_projection_of_collection_thru_navigation(bool async) { - await base.Project_collection_navigation_with_inheritance3(async); + await base.Correlated_collections_projection_of_collection_thru_navigation(async); + 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` -FROM ((`LocustHordes` AS `l` -LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name`) -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` +SELECT `u`.`Nickname`, `u`.`SquadId`, `s`.`Id`, `s1`.`SquadId`, `s1`.`MissionId` +FROM (( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` -) AS `u` ON `l0`.`DefeatedByNickname` = `u`.`Nickname` AND `l0`.`DefeatedBySquadId` = `u`.`SquadId`) +) AS `u` +INNER JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id`) LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, '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` + SELECT `s0`.`SquadId`, `s0`.`MissionId` + FROM `SquadMissions` AS `s0` + WHERE `s0`.`MissionId` <> 17 +) AS `s1` ON `s`.`Id` = `s1`.`SquadId` +WHERE `u`.`Nickname` <> 'Marcus' +ORDER BY `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `s`.`Id`, `s1`.`SquadId` """); } - public override async Task Include_reference_on_derived_type_using_string(bool async) + public override async Task Correlated_collections_project_anonymous_collection_result(bool async) { - await base.Include_reference_on_derived_type_using_string(async); + await base.Correlated_collections_project_anonymous_collection_result(async); AssertSql( """ -SELECT `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` -FROM ( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l` - UNION ALL - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l0` -) AS `u` +SELECT `s`.`Name`, `s`.`Id`, `u`.`FullName`, `u`.`Rank`, `u`.`Nickname`, `u`.`SquadId` +FROM `Squads` AS `s` LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`Rank` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`Rank` FROM `Officers` AS `o` -) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId` +) AS `u` ON `s`.`Id` = `u`.`SquadId` +WHERE `s`.`Id` < 20 +ORDER BY `s`.`Id`, `u`.`Nickname` """); } - public override async Task Include_reference_on_derived_type_using_string_nested1(bool async) + public override async Task Correlated_collections_nested(bool async) { - await base.Include_reference_on_derived_type_using_string_nested1(async); + await base.Correlated_collections_nested(async); AssertSql( """ -SELECT `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`, `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM (( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l` - UNION ALL - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l0` -) AS `u` +SELECT `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`Id`, `s3`.`SquadId0`, `s3`.`MissionId0` +FROM `Squads` AS `s` LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId`) -LEFT JOIN `Squads` AS `s` ON `u0`.`SquadId` = `s`.`Id` + SELECT `s0`.`SquadId`, `s0`.`MissionId`, `m`.`Id`, `s2`.`SquadId` AS `SquadId0`, `s2`.`MissionId` AS `MissionId0` + FROM (`SquadMissions` AS `s0` + INNER JOIN `Missions` AS `m` ON `s0`.`MissionId` = `m`.`Id`) + LEFT JOIN ( + SELECT `s1`.`SquadId`, `s1`.`MissionId` + FROM `SquadMissions` AS `s1` + 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` """); } - public override async Task Include_reference_on_derived_type_using_string_nested2(bool async) + public override async Task Correlated_collections_nested_mixed_streaming_with_buffer1(bool async) { - await base.Include_reference_on_derived_type_using_string_nested2(async); + await base.Correlated_collections_nested_mixed_streaming_with_buffer1(async); AssertSql( """ -SELECT `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`, `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 `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l` - UNION ALL - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l0` -) AS `u` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId`) +SELECT `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`Id`, `s3`.`SquadId0`, `s3`.`MissionId0` +FROM `Squads` AS `s` LEFT JOIN ( - SELECT `u1`.`Nickname`, `u1`.`SquadId`, `u1`.`AssignedCityName`, `u1`.`CityOfBirthName`, `u1`.`FullName`, `u1`.`HasSoulPatch`, `u1`.`LeaderNickname`, `u1`.`LeaderSquadId`, `u1`.`Rank`, `u1`.`Discriminator`, `c`.`Name`, `c`.`Location`, `c`.`Nation` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - 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` + SELECT `s0`.`SquadId`, `s0`.`MissionId`, `m`.`Id`, `s2`.`SquadId` AS `SquadId0`, `s2`.`MissionId` AS `MissionId0` + FROM (`SquadMissions` AS `s0` + INNER JOIN `Missions` AS `m` ON `s0`.`MissionId` = `m`.`Id`) + LEFT JOIN ( + SELECT `s1`.`SquadId`, `s1`.`MissionId` + FROM `SquadMissions` AS `s1` + 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` """); } - public override async Task Include_reference_on_derived_type_using_lambda(bool async) + public override async Task Correlated_collections_nested_mixed_streaming_with_buffer2(bool async) { - await base.Include_reference_on_derived_type_using_lambda(async); + await base.Correlated_collections_nested_mixed_streaming_with_buffer2(async); AssertSql( """ -SELECT `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` -FROM ( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l` - UNION ALL - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l0` -) AS `u` +SELECT `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`Id`, `s3`.`SquadId0`, `s3`.`MissionId0` +FROM `Squads` AS `s` LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId` + SELECT `s0`.`SquadId`, `s0`.`MissionId`, `m`.`Id`, `s2`.`SquadId` AS `SquadId0`, `s2`.`MissionId` AS `MissionId0` + FROM (`SquadMissions` AS `s0` + INNER JOIN `Missions` AS `m` ON `s0`.`MissionId` = `m`.`Id`) + LEFT JOIN ( + SELECT `s1`.`SquadId`, `s1`.`MissionId` + FROM `SquadMissions` AS `s1` + 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` """); } - public override async Task Include_reference_on_derived_type_using_lambda_with_soft_cast(bool async) + public override async Task Correlated_collections_nested_with_custom_ordering(bool async) { - await base.Include_reference_on_derived_type_using_lambda_with_soft_cast(async); + await base.Correlated_collections_nested_with_custom_ordering(async); AssertSql( """ -SELECT `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` +SELECT `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `s`.`FullName`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Id`, `s`.`AmmunitionType`, `s`.`IsAutomatic`, `s`.`Name`, `s`.`OwnerFullName`, `s`.`SynergyWithId` FROM ( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l` - UNION ALL - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l0` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` ) AS `u` LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId` + SELECT `u0`.`FullName`, `u0`.`Nickname`, `u0`.`SquadId`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId`, `u0`.`Rank`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId` + FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` + FROM `Gears` AS `g` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank` + FROM `Officers` AS `o0` + ) AS `u0` + LEFT JOIN ( + SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + FROM `Weapons` AS `w` + WHERE `w`.`Name` <> 'Bar' OR `w`.`Name` IS NULL + ) AS `w0` ON `u0`.`FullName` = `w0`.`OwnerFullName` + WHERE `u0`.`FullName` <> 'Foo' +) AS `s` ON `u`.`Nickname` = `s`.`LeaderNickname` AND `u`.`SquadId` = `s`.`LeaderSquadId` +ORDER BY NOT (`u`.`HasSoulPatch`) DESC, `u`.`Nickname`, `u`.`SquadId`, `s`.`Rank`, `s`.`Nickname`, `s`.`SquadId`, NOT (`s`.`IsAutomatic`) """); } - public override async Task Include_reference_on_derived_type_using_lambda_with_tracking(bool async) + public override async Task Correlated_collections_same_collection_projected_multiple_times(bool async) { - await base.Include_reference_on_derived_type_using_lambda_with_tracking(async); + await base.Correlated_collections_same_collection_projected_multiple_times(async); AssertSql( """ -SELECT `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` -FROM ( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l` - UNION ALL - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l0` -) AS `u` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `w1`.`Id`, `w1`.`AmmunitionType`, `w1`.`IsAutomatic`, `w1`.`Name`, `w1`.`OwnerFullName`, `w1`.`SynergyWithId`, `w2`.`Id`, `w2`.`AmmunitionType`, `w2`.`IsAutomatic`, `w2`.`Name`, `w2`.`OwnerFullName`, `w2`.`SynergyWithId` +FROM (( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` -) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId` +) AS `u` +LEFT JOIN ( + SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + FROM `Weapons` AS `w` + WHERE `w`.`IsAutomatic` = TRUE +) AS `w1` ON `u`.`FullName` = `w1`.`OwnerFullName`) +LEFT JOIN ( + SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` + FROM `Weapons` AS `w0` + WHERE `w0`.`IsAutomatic` = TRUE +) AS `w2` ON `u`.`FullName` = `w2`.`OwnerFullName` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `w1`.`Id` """); } - public override async Task Include_collection_on_derived_type_using_string(bool async) + public override async Task Correlated_collections_similar_collection_projected_multiple_times(bool async) { - await base.Include_collection_on_derived_type_using_string(async); + await base.Correlated_collections_similar_collection_projected_multiple_times(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `w1`.`Id`, `w1`.`AmmunitionType`, `w1`.`IsAutomatic`, `w1`.`Name`, `w1`.`OwnerFullName`, `w1`.`SynergyWithId`, `w2`.`Id`, `w2`.`AmmunitionType`, `w2`.`IsAutomatic`, `w2`.`Name`, `w2`.`OwnerFullName`, `w2`.`SynergyWithId` +FROM (( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`Rank` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`Rank` FROM `Officers` AS `o` ) AS `u` LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` -) AS `u0` ON `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname` + SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + FROM `Weapons` AS `w` + WHERE `w`.`IsAutomatic` = TRUE +) AS `w1` ON `u`.`FullName` = `w1`.`OwnerFullName`) +LEFT JOIN ( + SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` + FROM `Weapons` AS `w0` + WHERE `w0`.`IsAutomatic` = FALSE +) AS `w2` ON `u`.`FullName` = `w2`.`OwnerFullName` +ORDER BY `u`.`Rank`, `u`.`Nickname`, `u`.`SquadId`, `w1`.`OwnerFullName`, `w1`.`Id`, NOT (`w2`.`IsAutomatic`) """); } - public override async Task Include_collection_on_derived_type_using_lambda(bool async) + public override async Task Correlated_collections_different_collections_projected(bool async) { - await base.Include_collection_on_derived_type_using_lambda(async); + await base.Correlated_collections_different_collections_projected(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` +SELECT `u`.`Nickname`, `u`.`SquadId`, `w0`.`Name`, `w0`.`IsAutomatic`, `w0`.`Id`, `u0`.`Nickname`, `u0`.`Rank`, `u0`.`SquadId` +FROM (( + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` ) AS `u` LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` + SELECT `w`.`Name`, `w`.`IsAutomatic`, `w`.`Id`, `w`.`OwnerFullName` + FROM `Weapons` AS `w` + WHERE `w`.`IsAutomatic` = TRUE +) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName`) +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` + FROM `Gears` AS `g` UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank` FROM `Officers` AS `o0` ) AS `u0` ON `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname` +ORDER BY `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `w0`.`Id`, `u0`.`FullName`, `u0`.`Nickname` """); } - public override async Task Include_collection_on_derived_type_using_lambda_with_soft_cast(bool async) + public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys(bool async) { - await base.Include_collection_on_derived_type_using_lambda_with_soft_cast(async); - + await base.Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` +SELECT `u`.`FullName` FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` FROM `Officers` AS `o` ) AS `u` -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` -) AS `u0` ON `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname` +LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` +WHERE EXISTS ( + SELECT 1 + FROM ( + SELECT `g`.`LeaderNickname`, `g`.`LeaderSquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` + FROM `Officers` AS `o0` + ) AS `u0` + WHERE `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId`) +ORDER BY NOT (`u`.`HasSoulPatch`) DESC, `t`.`Note` """); } - public override async Task Include_base_navigation_on_derived_entity(bool async) + public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys_inside_subquery(bool async) { - await base.Include_base_navigation_on_derived_entity(async); - + await base.Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys_inside_subquery(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM (( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` +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` +FROM ((( + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` 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` -"""); - } - - public override async Task ThenInclude_collection_on_derived_after_base_reference(bool async) - { - await base.ThenInclude_collection_on_derived_after_base_reference(async); - - AssertSql( - """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note`, `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM (`Tags` AS `t` LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` + FROM `Gears` AS `g0` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - 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` + SELECT `o1`.`Nickname`, `o1`.`SquadId`, `o1`.`FullName` + 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` + FROM `Weapons` AS `w` + LEFT JOIN ( + SELECT `g1`.`Nickname`, `g1`.`SquadId`, `g1`.`FullName` + FROM `Gears` AS `g1` + UNION ALL + SELECT `o2`.`Nickname`, `o2`.`SquadId`, `o2`.`FullName` + FROM `Officers` AS `o2` + ) AS `u2` ON `w`.`OwnerFullName` = `u2`.`FullName` +) AS `s` ON `u1`.`FullName` = `s`.`OwnerFullName` +WHERE EXISTS ( + SELECT 1 + FROM ( + SELECT `g`.`LeaderNickname`, `g`.`LeaderSquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` + FROM `Officers` AS `o0` + ) AS `u0` + WHERE `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId`) +ORDER BY NOT (`u`.`HasSoulPatch`) DESC, `t`.`Note`, `u`.`Nickname`, `u`.`SquadId`, `t`.`Id`, `u1`.`Nickname`, `u1`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Nickname` DESC, `s`.`Id` """); } - public override async Task ThenInclude_collection_on_derived_after_derived_reference(bool async) + public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys_inside_subquery_duplicated_orderings( + bool async) { - await base.ThenInclude_collection_on_derived_after_derived_reference(async); + await base.Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys_inside_subquery_duplicated_orderings(async); AssertSql( """ -SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `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 ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` +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` +FROM ((( + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` FROM `Officers` AS `o` -) AS `u` ON `l0`.`DefeatedByNickname` = `u`.`Nickname` AND `l0`.`DefeatedBySquadId` = `u`.`SquadId`) +) AS `u` +LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId`) LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` FROM `Gears` AS `g0` UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, '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` -"""); - } - - public override async Task ThenInclude_collection_on_derived_after_derived_collection(bool async) - { - await base.ThenInclude_collection_on_derived_after_derived_collection(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `s`.`Nickname0`, `s`.`SquadId0`, `s`.`AssignedCityName0`, `s`.`CityOfBirthName0`, `s`.`FullName0`, `s`.`HasSoulPatch0`, `s`.`LeaderNickname0`, `s`.`LeaderSquadId0`, `s`.`Rank0`, `s`.`Discriminator0` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` + SELECT `o1`.`Nickname`, `o1`.`SquadId`, `o1`.`FullName` + FROM `Officers` AS `o1` +) AS `u1` ON `t`.`GearNickName` = `u1`.`Nickname` AND `t`.`GearSquadId` = `u1`.`SquadId`) LEFT JOIN ( - SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `u1`.`Nickname` AS `Nickname0`, `u1`.`SquadId` AS `SquadId0`, `u1`.`AssignedCityName` AS `AssignedCityName0`, `u1`.`CityOfBirthName` AS `CityOfBirthName0`, `u1`.`FullName` AS `FullName0`, `u1`.`HasSoulPatch` AS `HasSoulPatch0`, `u1`.`LeaderNickname` AS `LeaderNickname0`, `u1`.`LeaderSquadId` AS `LeaderSquadId0`, `u1`.`Rank` AS `Rank0`, `u1`.`Discriminator` AS `Discriminator0` + SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `u2`.`Nickname`, `u2`.`SquadId` + FROM `Weapons` AS `w` + LEFT JOIN ( + SELECT `g1`.`Nickname`, `g1`.`SquadId`, `g1`.`FullName` + FROM `Gears` AS `g1` + UNION ALL + SELECT `o2`.`Nickname`, `o2`.`SquadId`, `o2`.`FullName` + FROM `Officers` AS `o2` + ) AS `u2` ON `w`.`OwnerFullName` = `u2`.`FullName` +) AS `s` ON `u1`.`FullName` = `s`.`OwnerFullName` +WHERE EXISTS ( + SELECT 1 FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` + SELECT `g`.`LeaderNickname`, `g`.`LeaderSquadId` + FROM `Gears` AS `g` UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` FROM `Officers` AS `o0` ) AS `u0` - LEFT JOIN ( - SELECT `g1`.`Nickname`, `g1`.`SquadId`, `g1`.`AssignedCityName`, `g1`.`CityOfBirthName`, `g1`.`FullName`, `g1`.`HasSoulPatch`, `g1`.`LeaderNickname`, `g1`.`LeaderSquadId`, `g1`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g1` - UNION ALL - SELECT `o1`.`Nickname`, `o1`.`SquadId`, `o1`.`AssignedCityName`, `o1`.`CityOfBirthName`, `o1`.`FullName`, `o1`.`HasSoulPatch`, `o1`.`LeaderNickname`, `o1`.`LeaderSquadId`, `o1`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o1` - ) AS `u1` ON `u0`.`Nickname` = `u1`.`LeaderNickname` AND `u0`.`SquadId` = `u1`.`LeaderSquadId` -) AS `s` ON `u`.`Nickname` = `s`.`LeaderNickname` AND `u`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` + WHERE `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId`) +ORDER BY NOT (`u`.`HasSoulPatch`) DESC, `t`.`Note`, `u`.`Nickname`, `u`.`SquadId`, `t`.`Id`, `u1`.`Nickname`, `u1`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Nickname` DESC, `s`.`Id` """); } - public override async Task ThenInclude_reference_on_derived_after_derived_collection(bool async) + public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys_inside_subquery_complex_orderings( + bool async) { - await base.ThenInclude_reference_on_derived_after_derived_collection(async); - + await base.Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys_inside_subquery_complex_orderings(async); AssertSql( """ -SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, `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` -FROM `LocustHordes` AS `l` +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` +FROM ((( + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId`) LEFT JOIN ( - SELECT `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` - FROM ( - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l0` - UNION ALL - SELECT `l1`.`Name`, `l1`.`LocustHordeId`, `l1`.`ThreatLevel`, `l1`.`ThreatLevelByte`, `l1`.`ThreatLevelNullableByte`, `l1`.`DefeatedByNickname`, `l1`.`DefeatedBySquadId`, `l1`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l1` - ) AS `u` - LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` - ) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId` -) AS `s` ON `l`.`Id` = `s`.`LocustHordeId` -ORDER BY `l`.`Id`, `s`.`Name`, `s`.`Nickname` -"""); - } - - public override async Task Multiple_derived_included_on_one_method(bool async) - { - await base.Multiple_derived_included_on_one_method(async); - - AssertSql( - """ -SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `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 ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` ON `l0`.`DefeatedByNickname` = `u`.`Nickname` AND `l0`.`DefeatedBySquadId` = `u`.`SquadId`) -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` FROM `Gears` AS `g0` UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, '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` -"""); - } - - public override async Task Include_on_derived_multi_level(bool async) - { - await base.Include_on_derived_multi_level(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`AssignedCityName`, `s1`.`CityOfBirthName`, `s1`.`FullName`, `s1`.`HasSoulPatch`, `s1`.`LeaderNickname`, `s1`.`LeaderSquadId`, `s1`.`Rank`, `s1`.`Discriminator`, `s1`.`Id`, `s1`.`Banner`, `s1`.`Banner5`, `s1`.`InternalNumber`, `s1`.`Name`, `s1`.`SquadId0`, `s1`.`MissionId` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` + SELECT `o1`.`Nickname`, `o1`.`SquadId`, `o1`.`FullName` + FROM `Officers` AS `o1` +) AS `u1` ON `t`.`GearNickName` = `u1`.`Nickname` AND `t`.`GearSquadId` = `u1`.`SquadId`) LEFT JOIN ( - SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name`, `s0`.`SquadId` AS `SquadId0`, `s0`.`MissionId` - FROM (( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` + SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId`, `u2`.`Nickname`, `u2`.`SquadId`, ( + 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` + FROM `Gears` AS `g1` UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o2`.`Nickname`, `o2`.`SquadId`, `o2`.`FullName` + FROM `Officers` AS `o2` + ) AS `u2` ON `w`.`OwnerFullName` = `u2`.`FullName` +) AS `s` ON `u1`.`FullName` = `s`.`OwnerFullName` +WHERE EXISTS ( + SELECT 1 + FROM ( + SELECT `g`.`LeaderNickname`, `g`.`LeaderSquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` FROM `Officers` AS `o0` ) AS `u0` - 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` -"""); - } - - public override async Task Projecting_nullable_bool_in_conditional_works(bool async) - { - await base.Projecting_nullable_bool_in_conditional_works(async); - - AssertSql( - """ -SELECT IIF(`u`.`Nickname` IS NOT NULL AND `u`.`SquadId` IS NOT NULL, `u`.`HasSoulPatch`, FALSE) AS `Prop` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -"""); - } - - public override async Task ToString_enum_property_projection(bool async) - { - await base.ToString_enum_property_projection(async); - - AssertSql( - """ -SELECT IIF(`u`.`Rank` = 0, 'None', IIF(`u`.`Rank` = 1, 'Private', IIF(`u`.`Rank` = 2, 'Corporal', IIF(`u`.`Rank` = 4, 'Sergeant', IIF(`u`.`Rank` = 8, 'Lieutenant', IIF(`u`.`Rank` = 16, 'Captain', IIF(`u`.`Rank` = 32, 'Major', IIF(`u`.`Rank` = 64, 'Colonel', IIF(`u`.`Rank` = 128, 'General', (`u`.`Rank` & '')))))))))) -FROM ( - SELECT `g`.`Rank` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Rank` - FROM `Officers` AS `o` -) AS `u` -"""); - } - - public override async Task ToString_nullable_enum_property_projection(bool async) - { - await base.ToString_nullable_enum_property_projection(async); - - AssertSql( - """ -SELECT IIF(`w`.`AmmunitionType` = 1, 'Cartridge', IIF(`w`.`AmmunitionType` = 2, 'Shell', IIF((`w`.`AmmunitionType` & '') IS NULL, '', (`w`.`AmmunitionType` & '')))) -FROM `Weapons` AS `w` -"""); - } - - public override async Task ToString_enum_contains(bool async) - { - await base.ToString_enum_contains(async); - - AssertSql( - """ -SELECT `m`.`CodeName` -FROM `Missions` AS `m` -WHERE (`m`.`Difficulty` & '') LIKE '%Med%' -"""); - } - - public override async Task ToString_nullable_enum_contains(bool async) - { - await base.ToString_nullable_enum_contains(async); - - AssertSql( - """ -SELECT `w`.`Name` -FROM `Weapons` AS `w` -WHERE IIF(`w`.`AmmunitionType` = 1, 'Cartridge', IIF(`w`.`AmmunitionType` = 2, 'Shell', IIF((`w`.`AmmunitionType` & '') IS NULL, '', (`w`.`AmmunitionType` & '')))) LIKE '%Cart%' -"""); - } - - public override async Task Correlated_collections_naked_navigation_with_ToList(bool async) - { - await base.Correlated_collections_naked_navigation_with_ToList(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` -WHERE `u`.`Nickname` <> 'Marcus' -ORDER BY `u`.`Nickname`, `u`.`SquadId` -"""); - } - - public override async Task Correlated_collections_naked_navigation_with_ToList_followed_by_projecting_count(bool async) - { - await base.Correlated_collections_naked_navigation_with_ToList_followed_by_projecting_count(async); - - AssertSql( - """ -SELECT ( - SELECT COUNT(*) - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName`) -FROM ( - SELECT `g`.`Nickname`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -WHERE `u`.`Nickname` <> 'Marcus' -ORDER BY `u`.`Nickname` + WHERE `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId`) +ORDER BY NOT (`u`.`HasSoulPatch`) DESC, `t`.`Note`, `u`.`Nickname`, `u`.`SquadId`, `t`.`Id`, `u1`.`Nickname`, `u1`.`SquadId`, `s`.`Id` DESC, `s`.`c`, `s`.`Nickname` """); } - public override async Task Correlated_collections_naked_navigation_with_ToArray(bool async) + public override async Task Correlated_collections_multiple_nested_complex_collections(bool async) { - await base.Correlated_collections_naked_navigation_with_ToArray(async); + await base.Correlated_collections_multiple_nested_complex_collections(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` +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` +FROM (((( + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` FROM `Officers` AS `o` ) AS `u` -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` -WHERE `u`.`Nickname` <> 'Marcus' -ORDER BY `u`.`Nickname`, `u`.`SquadId` -"""); - } - - public override async Task Correlated_collections_basic_projection(bool async) - { - await base.Correlated_collections_basic_projection(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` +LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId`) +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` + FROM `Gears` AS `g0` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` + SELECT `o1`.`Nickname`, `o1`.`SquadId`, `o1`.`FullName` + 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` - FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` = TRUE OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL -) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` -WHERE `u`.`Nickname` <> 'Marcus' -ORDER BY `u`.`Nickname`, `u`.`SquadId` -"""); - } - - public override async Task Correlated_collections_basic_projection_explicit_to_list(bool async) - { - await base.Correlated_collections_basic_projection_explicit_to_list(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` = TRUE OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL -) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` -WHERE `u`.`Nickname` <> 'Marcus' -ORDER BY `u`.`Nickname`, `u`.`SquadId` -"""); - } - - public override async Task Correlated_collections_basic_projection_explicit_to_array(bool async) - { - await base.Correlated_collections_basic_projection_explicit_to_array(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` = TRUE OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL -) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` -WHERE `u`.`Nickname` <> 'Marcus' -ORDER BY `u`.`Nickname`, `u`.`SquadId` -"""); - } - - public override async Task Correlated_collections_basic_projection_ordered(bool async) - { - await base.Correlated_collections_basic_projection_ordered(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` = TRUE OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL -) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` -WHERE `u`.`Nickname` <> 'Marcus' -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `w0`.`Name` DESC -"""); - } - - public override async Task Correlated_collections_basic_projection_composite_key(bool async) - { - await base.Correlated_collections_basic_projection_composite_key(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u1`.`Nickname`, `u1`.`FullName`, `u1`.`SquadId` -FROM ( - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `u0`.`Nickname`, `u0`.`FullName`, `u0`.`SquadId`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId` - FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` - FROM `Officers` AS `o0` - ) AS `u0` - WHERE `u0`.`HasSoulPatch` = FALSE -) AS `u1` ON `u`.`Nickname` = `u1`.`LeaderNickname` AND `u`.`SquadId` = `u1`.`LeaderSquadId` -WHERE `u`.`Nickname` <> 'Foo' -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `u1`.`Nickname` -"""); - } - - public override async Task Correlated_collections_basic_projecting_single_property(bool async) - { - await base.Correlated_collections_basic_projecting_single_property(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `w0`.`Name`, `w0`.`Id` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `w`.`Name`, `w`.`Id`, `w`.`OwnerFullName` - FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` = TRUE OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL -) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` -WHERE `u`.`Nickname` <> 'Marcus' -ORDER BY `u`.`Nickname`, `u`.`SquadId` -"""); - } - - public override async Task Correlated_collections_basic_projecting_constant(bool async) - { - await base.Correlated_collections_basic_projecting_constant(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `w0`.`c`, `w0`.`Id` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT 'BFG' AS `c`, `w`.`Id`, `w`.`OwnerFullName` - FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` = TRUE OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL -) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` -WHERE `u`.`Nickname` <> 'Marcus' -ORDER BY `u`.`Nickname`, `u`.`SquadId` -"""); - } - - public override async Task Correlated_collections_basic_projecting_constant_bool(bool async) - { - await base.Correlated_collections_basic_projecting_constant_bool(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `w0`.`c`, `w0`.`Id` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT TRUE AS `c`, `w`.`Id`, `w`.`OwnerFullName` - FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` = TRUE OR `w`.`Name` <> 'foo' OR `w`.`Name` IS NULL -) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` -WHERE `u`.`Nickname` <> 'Marcus' -ORDER BY `u`.`Nickname`, `u`.`SquadId` -"""); - } - - public override async Task Correlated_collections_projection_of_collection_thru_navigation(bool async) - { - await base.Correlated_collections_projection_of_collection_thru_navigation(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `s`.`Id`, `s1`.`SquadId`, `s1`.`MissionId` -FROM (( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -INNER JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id`) -LEFT JOIN ( - SELECT `s0`.`SquadId`, `s0`.`MissionId` - FROM `SquadMissions` AS `s0` - WHERE `s0`.`MissionId` <> 17 -) AS `s1` ON `s`.`Id` = `s1`.`SquadId` -WHERE `u`.`Nickname` <> 'Marcus' -ORDER BY `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `s`.`Id`, `s1`.`SquadId` -"""); - } - - public override async Task Correlated_collections_project_anonymous_collection_result(bool async) - { - await base.Correlated_collections_project_anonymous_collection_result(async); - - AssertSql( - """ -SELECT `s`.`Name`, `s`.`Id`, `u`.`FullName`, `u`.`Rank`, `u`.`Nickname`, `u`.`SquadId` -FROM `Squads` AS `s` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`Rank` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`Rank` - FROM `Officers` AS `o` -) AS `u` ON `s`.`Id` = `u`.`SquadId` -WHERE `s`.`Id` < 20 -ORDER BY `s`.`Id`, `u`.`Nickname` -"""); - } - - public override async Task Correlated_collections_nested(bool async) - { - await base.Correlated_collections_nested(async); - - AssertSql( - """ -SELECT `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`Id`, `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` - FROM (`SquadMissions` AS `s0` - INNER JOIN `Missions` AS `m` ON `s0`.`MissionId` = `m`.`Id`) - LEFT JOIN ( - SELECT `s1`.`SquadId`, `s1`.`MissionId` - FROM `SquadMissions` AS `s1` - 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` -"""); - } - - public override async Task Correlated_collections_nested_mixed_streaming_with_buffer1(bool async) - { - await base.Correlated_collections_nested_mixed_streaming_with_buffer1(async); - - AssertSql( - """ -SELECT `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`Id`, `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` - FROM (`SquadMissions` AS `s0` - INNER JOIN `Missions` AS `m` ON `s0`.`MissionId` = `m`.`Id`) - LEFT JOIN ( - SELECT `s1`.`SquadId`, `s1`.`MissionId` - FROM `SquadMissions` AS `s1` - 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` -"""); - } - - public override async Task Correlated_collections_nested_mixed_streaming_with_buffer2(bool async) - { - await base.Correlated_collections_nested_mixed_streaming_with_buffer2(async); - - AssertSql( - """ -SELECT `s`.`Id`, `s3`.`SquadId`, `s3`.`MissionId`, `s3`.`Id`, `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` - FROM (`SquadMissions` AS `s0` - INNER JOIN `Missions` AS `m` ON `s0`.`MissionId` = `m`.`Id`) - LEFT JOIN ( - SELECT `s1`.`SquadId`, `s1`.`MissionId` - FROM `SquadMissions` AS `s1` - 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` -"""); - } - - public override async Task Correlated_collections_nested_with_custom_ordering(bool async) - { - await base.Correlated_collections_nested_with_custom_ordering(async); - - AssertSql( - """ -SELECT `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `s`.`FullName`, `s`.`Nickname`, `s`.`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` -) AS `u` -LEFT JOIN ( - SELECT `u0`.`FullName`, `u0`.`Nickname`, `u0`.`SquadId`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId`, `u0`.`Rank`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId` - FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` - FROM `Gears` AS `g` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - LEFT JOIN ( - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE `w`.`Name` <> 'Bar' OR `w`.`Name` IS NULL - ) AS `w0` ON `u0`.`FullName` = `w0`.`OwnerFullName` - WHERE `u0`.`FullName` <> 'Foo' -) AS `s` ON `u`.`Nickname` = `s`.`LeaderNickname` AND `u`.`SquadId` = `s`.`LeaderSquadId` -ORDER BY NOT (`u`.`HasSoulPatch`) DESC, `u`.`Nickname`, `u`.`SquadId`, `s`.`Rank`, `s`.`Nickname`, `s`.`SquadId`, NOT (`s`.`IsAutomatic`) -"""); - } - - public override async Task Correlated_collections_same_collection_projected_multiple_times(bool async) - { - await base.Correlated_collections_same_collection_projected_multiple_times(async); - - AssertSql( - """ -SELECT `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `w1`.`Id`, `w1`.`AmmunitionType`, `w1`.`IsAutomatic`, `w1`.`Name`, `w1`.`OwnerFullName`, `w1`.`SynergyWithId`, `w2`.`Id`, `w2`.`AmmunitionType`, `w2`.`IsAutomatic`, `w2`.`Name`, `w2`.`OwnerFullName`, `w2`.`SynergyWithId` -FROM (( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` = TRUE -) AS `w1` ON `u`.`FullName` = `w1`.`OwnerFullName`) -LEFT JOIN ( - SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` - FROM `Weapons` AS `w0` - WHERE `w0`.`IsAutomatic` = TRUE -) AS `w2` ON `u`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `w1`.`Id` -"""); - } - - public override async Task Correlated_collections_similar_collection_projected_multiple_times(bool async) - { - await base.Correlated_collections_similar_collection_projected_multiple_times(async); - - AssertSql( - """ -SELECT `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `w1`.`Id`, `w1`.`AmmunitionType`, `w1`.`IsAutomatic`, `w1`.`Name`, `w1`.`OwnerFullName`, `w1`.`SynergyWithId`, `w2`.`Id`, `w2`.`AmmunitionType`, `w2`.`IsAutomatic`, `w2`.`Name`, `w2`.`OwnerFullName`, `w2`.`SynergyWithId` -FROM (( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`Rank` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`Rank` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` = TRUE -) AS `w1` ON `u`.`FullName` = `w1`.`OwnerFullName`) -LEFT JOIN ( - SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` - FROM `Weapons` AS `w0` - WHERE `w0`.`IsAutomatic` = FALSE -) AS `w2` ON `u`.`FullName` = `w2`.`OwnerFullName` -ORDER BY `u`.`Rank`, `u`.`Nickname`, `u`.`SquadId`, `w1`.`OwnerFullName`, `w1`.`Id`, NOT (`w2`.`IsAutomatic`) -"""); - } - - public override async Task Correlated_collections_different_collections_projected(bool async) - { - await base.Correlated_collections_different_collections_projected(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `w0`.`Name`, `w0`.`IsAutomatic`, `w0`.`Id`, `u0`.`Nickname`, `u0`.`Rank`, `u0`.`SquadId` -FROM (( - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `w`.`Name`, `w`.`IsAutomatic`, `w`.`Id`, `w`.`OwnerFullName` - FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` = TRUE -) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName`) -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` - FROM `Gears` AS `g` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank` - FROM `Officers` AS `o0` -) AS `u0` ON `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId` -ORDER BY `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `w0`.`Id`, `u0`.`FullName`, `u0`.`Nickname` -"""); - } - - public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys(bool async) - { - await base.Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys(async); - AssertSql( - """ -SELECT `u`.`FullName` -FROM ( - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` -WHERE EXISTS ( - SELECT 1 - FROM ( - SELECT `g`.`LeaderNickname`, `g`.`LeaderSquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` - FROM `Officers` AS `o0` - ) AS `u0` - WHERE `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId`) -ORDER BY NOT (`u`.`HasSoulPatch`) DESC, `t`.`Note` -"""); - } - - public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys_inside_subquery(bool async) - { - await base.Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys_inside_subquery(async); - 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` -FROM ((( - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId`) -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o1`.`Nickname`, `o1`.`SquadId`, `o1`.`FullName` - 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` - FROM `Weapons` AS `w` - LEFT JOIN ( - SELECT `g1`.`Nickname`, `g1`.`SquadId`, `g1`.`FullName` - FROM `Gears` AS `g1` - UNION ALL - SELECT `o2`.`Nickname`, `o2`.`SquadId`, `o2`.`FullName` - FROM `Officers` AS `o2` - ) AS `u2` ON `w`.`OwnerFullName` = `u2`.`FullName` -) AS `s` ON `u1`.`FullName` = `s`.`OwnerFullName` -WHERE EXISTS ( - SELECT 1 - FROM ( - SELECT `g`.`LeaderNickname`, `g`.`LeaderSquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` - FROM `Officers` AS `o0` - ) AS `u0` - WHERE `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId`) -ORDER BY NOT (`u`.`HasSoulPatch`) DESC, `t`.`Note`, `u`.`Nickname`, `u`.`SquadId`, `t`.`Id`, `u1`.`Nickname`, `u1`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Nickname` DESC, `s`.`Id` -"""); - } - - public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys_inside_subquery_duplicated_orderings( - bool async) - { - await base.Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys_inside_subquery_duplicated_orderings(async); - - 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` -FROM ((( - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId`) -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o1`.`Nickname`, `o1`.`SquadId`, `o1`.`FullName` - 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` - FROM `Weapons` AS `w` - LEFT JOIN ( - SELECT `g1`.`Nickname`, `g1`.`SquadId`, `g1`.`FullName` - FROM `Gears` AS `g1` - UNION ALL - SELECT `o2`.`Nickname`, `o2`.`SquadId`, `o2`.`FullName` - FROM `Officers` AS `o2` - ) AS `u2` ON `w`.`OwnerFullName` = `u2`.`FullName` -) AS `s` ON `u1`.`FullName` = `s`.`OwnerFullName` -WHERE EXISTS ( - SELECT 1 - FROM ( - SELECT `g`.`LeaderNickname`, `g`.`LeaderSquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` - FROM `Officers` AS `o0` - ) AS `u0` - WHERE `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId`) -ORDER BY NOT (`u`.`HasSoulPatch`) DESC, `t`.`Note`, `u`.`Nickname`, `u`.`SquadId`, `t`.`Id`, `u1`.`Nickname`, `u1`.`SquadId`, NOT (`s`.`IsAutomatic`), `s`.`Nickname` DESC, `s`.`Id` -"""); - } - - public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys_inside_subquery_complex_orderings( - bool async) - { - await base.Multiple_orderby_with_navigation_expansion_on_one_of_the_order_bys_inside_subquery_complex_orderings(async); - 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` -FROM ((( - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId`) -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o1`.`Nickname`, `o1`.`SquadId`, `o1`.`FullName` - 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 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` - FROM `Gears` AS `g1` - UNION ALL - SELECT `o2`.`Nickname`, `o2`.`SquadId`, `o2`.`FullName` - FROM `Officers` AS `o2` - ) AS `u2` ON `w`.`OwnerFullName` = `u2`.`FullName` -) AS `s` ON `u1`.`FullName` = `s`.`OwnerFullName` -WHERE EXISTS ( - SELECT 1 - FROM ( - SELECT `g`.`LeaderNickname`, `g`.`LeaderSquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` - FROM `Officers` AS `o0` - ) AS `u0` - WHERE `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId`) -ORDER BY NOT (`u`.`HasSoulPatch`) DESC, `t`.`Note`, `u`.`Nickname`, `u`.`SquadId`, `t`.`Id`, `u1`.`Nickname`, `u1`.`SquadId`, `s`.`Id` DESC, `s`.`c`, `s`.`Nickname` -"""); - } - - public override async Task Correlated_collections_multiple_nested_complex_collections(bool async) - { - await base.Correlated_collections_multiple_nested_complex_collections(async); - - 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` -FROM (((( - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId`) -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o1`.`Nickname`, `o1`.`SquadId`, `o1`.`FullName` - 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` - FROM ( - SELECT `g1`.`Nickname`, `g1`.`SquadId`, `g1`.`FullName`, `g1`.`LeaderNickname`, `g1`.`LeaderSquadId`, `g1`.`Rank` - FROM `Gears` AS `g1` - UNION ALL - SELECT `o2`.`Nickname`, `o2`.`SquadId`, `o2`.`FullName`, `o2`.`LeaderNickname`, `o2`.`LeaderSquadId`, `o2`.`Rank` - 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` - FROM (((`Weapons` AS `w` - LEFT JOIN ( - SELECT `g2`.`Nickname`, `g2`.`SquadId`, `g2`.`FullName` - FROM `Gears` AS `g2` - UNION ALL - SELECT `o3`.`Nickname`, `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`) - LEFT JOIN `Weapons` AS `w0` ON `u3`.`FullName` = `w0`.`OwnerFullName`) - LEFT JOIN ( - SELECT `g3`.`Nickname`, `g3`.`SquadId`, `g3`.`HasSoulPatch` - FROM `Gears` AS `g3` - UNION ALL - SELECT `o4`.`Nickname`, `o4`.`SquadId`, `o4`.`HasSoulPatch` - FROM `Officers` AS `o4` - ) AS `u4` ON `s`.`Id` = `u4`.`SquadId` - WHERE `w`.`Name` <> 'Bar' OR `w`.`Name` IS NULL - ) AS `s0` ON `u2`.`FullName` = `s0`.`OwnerFullName` - WHERE `u2`.`FullName` <> '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` - FROM `Weapons` AS `w1` - LEFT JOIN ( - SELECT `g4`.`Nickname`, `g4`.`SquadId`, `g4`.`FullName` - FROM `Gears` AS `g4` - UNION ALL - SELECT `o5`.`Nickname`, `o5`.`SquadId`, `o5`.`FullName` - FROM `Officers` AS `o5` - ) AS `u5` ON `w1`.`OwnerFullName` = `u5`.`FullName` -) AS `s2` ON `u1`.`FullName` = `s2`.`OwnerFullName` -WHERE EXISTS ( - SELECT 1 - FROM ( - SELECT `g`.`LeaderNickname`, `g`.`LeaderSquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` - FROM `Officers` AS `o0` - ) AS `u0` - WHERE `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId`) -ORDER BY NOT (`u`.`HasSoulPatch`) DESC, `t`.`Note`, `u`.`Nickname`, `u`.`SquadId`, `t`.`Id`, `u1`.`Nickname`, `u1`.`SquadId`, `s1`.`Rank`, `s1`.`Nickname`, `s1`.`SquadId`, NOT (`s1`.`IsAutomatic0`), `s1`.`Id`, `s1`.`Nickname0`, `s1`.`SquadId0`, `s1`.`Id0`, `s1`.`Id1`, `s1`.`Nickname00`, `s1`.`SquadId00`, NOT (`s2`.`IsAutomatic`), `s2`.`Nickname` DESC, `s2`.`Id` -"""); - } - - public override async Task Correlated_collections_inner_subquery_selector_references_outer_qsre(bool async) - { - await base.Correlated_collections_inner_subquery_selector_references_outer_qsre(async); - - AssertSql( -""" -SELECT [t].[FullName], [t].[Nickname], [t].[SquadId], [t0].[ReportName], [t0].[OfficerName], [t0].[Nickname], [t0].[SquadId] -FROM ( - SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] - FROM [Officers] AS [o] -) AS [t] -OUTER APPLY ( - SELECT [t1].[FullName] AS [ReportName], [t].[FullName] AS [OfficerName], [t1].[Nickname], [t1].[SquadId] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[FullName], [g].[LeaderNickname], [g].[LeaderSquadId] - FROM [Gears] AS [g] - UNION ALL - SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName], [o0].[LeaderNickname], [o0].[LeaderSquadId] - FROM [Officers] AS [o0] - ) AS [t1] - WHERE [t].[Nickname] = [t1].[LeaderNickname] AND [t].[SquadId] = [t1].[LeaderSquadId] -) AS [t0] -ORDER BY [t].[Nickname], [t].[SquadId], [t0].[Nickname] -"""); - } - - public override async Task Correlated_collections_inner_subquery_predicate_references_outer_qsre(bool async) - { - await base.Correlated_collections_inner_subquery_predicate_references_outer_qsre(async); - - AssertSql( -""" -SELECT [t].[FullName], [t].[Nickname], [t].[SquadId], [t0].[ReportName], [t0].[Nickname], [t0].[SquadId] -FROM ( - SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] - FROM [Officers] AS [o] -) AS [t] -OUTER APPLY ( - SELECT [t1].[FullName] AS [ReportName], [t1].[Nickname], [t1].[SquadId] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[FullName], [g].[LeaderNickname], [g].[LeaderSquadId] - FROM [Gears] AS [g] - UNION ALL - SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName], [o0].[LeaderNickname], [o0].[LeaderSquadId] - FROM [Officers] AS [o0] - ) AS [t1] - WHERE [t].[Nickname] = [t1].[LeaderNickname] AND [t].[SquadId] = [t1].[LeaderSquadId] AND [t].[FullName] <> N'Foo' -) AS [t0] -ORDER BY [t].[Nickname], [t].[SquadId], [t0].[Nickname] -"""); - } - - public override async Task Correlated_collections_nested_inner_subquery_references_outer_qsre_one_level_up(bool async) - { - await base.Correlated_collections_nested_inner_subquery_references_outer_qsre_one_level_up(async); - - AssertSql( -""" -SELECT [t].[FullName], [t].[Nickname], [t].[SquadId], [t1].[FullName], [t1].[Nickname], [t1].[SquadId], [t1].[Name], [t1].[Nickname0], [t1].[Id] -FROM ( - SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] - FROM [Officers] AS [o] -) AS [t] -LEFT JOIN ( - SELECT [t0].[FullName], [t0].[Nickname], [t0].[SquadId], [t2].[Name], [t2].[Nickname] AS [Nickname0], [t2].[Id], [t0].[LeaderNickname], [t0].[LeaderSquadId] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[FullName], [g].[LeaderNickname], [g].[LeaderSquadId] - FROM [Gears] AS [g] - UNION ALL - SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName], [o0].[LeaderNickname], [o0].[LeaderSquadId] - FROM [Officers] AS [o0] - ) AS [t0] - OUTER APPLY ( - SELECT [w].[Name], [t0].[Nickname], [w].[Id] - FROM [Weapons] AS [w] - WHERE [t0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR ([w].[Name] IS NULL)) - ) AS [t2] - WHERE [t0].[FullName] <> N'Foo' -) AS [t1] ON [t].[Nickname] = [t1].[LeaderNickname] AND [t].[SquadId] = [t1].[LeaderSquadId] -ORDER BY [t].[Nickname], [t].[SquadId], [t1].[Nickname], [t1].[SquadId] -"""); - } - - public override async Task Correlated_collections_nested_inner_subquery_references_outer_qsre_two_levels_up(bool async) - { - await base.Correlated_collections_nested_inner_subquery_references_outer_qsre_two_levels_up(async); - - AssertSql( -""" -SELECT [t].[FullName], [t].[Nickname], [t].[SquadId], [t1].[FullName], [t1].[Nickname], [t1].[SquadId], [t1].[Name], [t1].[Nickname0], [t1].[Id] -FROM ( - SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] - FROM [Officers] AS [o] -) AS [t] -OUTER APPLY ( - SELECT [t0].[FullName], [t0].[Nickname], [t0].[SquadId], [t2].[Name], [t2].[Nickname] AS [Nickname0], [t2].[Id] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[FullName], [g].[LeaderNickname], [g].[LeaderSquadId] - FROM [Gears] AS [g] - UNION ALL - SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName], [o0].[LeaderNickname], [o0].[LeaderSquadId] - FROM [Officers] AS [o0] - ) AS [t0] - LEFT JOIN ( - SELECT [w].[Name], [t].[Nickname], [w].[Id], [w].[OwnerFullName] - FROM [Weapons] AS [w] - WHERE [w].[Name] <> N'Bar' OR ([w].[Name] IS NULL) - ) AS [t2] ON [t0].[FullName] = [t2].[OwnerFullName] - WHERE [t].[Nickname] = [t0].[LeaderNickname] AND [t].[SquadId] = [t0].[LeaderSquadId] AND [t0].[FullName] <> N'Foo' -) AS [t1] -ORDER BY [t].[Nickname], [t].[SquadId], [t1].[Nickname], [t1].[SquadId] -"""); - } - - public override async Task Correlated_collections_on_select_many(bool async) - { - await base.Correlated_collections_on_select_many(async); - - AssertSql( -""" -SELECT [t].[Nickname], [s].[Name], [t].[SquadId], [s].[Id], [t0].[Id], [t0].[AmmunitionType], [t0].[IsAutomatic], [t0].[Name], [t0].[OwnerFullName], [t0].[SynergyWithId], [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] -FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[FullName], [g].[HasSoulPatch] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[FullName], [o].[HasSoulPatch] - FROM [Officers] AS [o] -) AS [t] -CROSS JOIN [Squads] AS [s] -LEFT JOIN ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) -) AS [t0] ON [t].[FullName] = [t0].[OwnerFullName] -LEFT JOIN ( - SELECT [t2].[Nickname], [t2].[SquadId], [t2].[AssignedCityName], [t2].[CityOfBirthName], [t2].[FullName], [t2].[HasSoulPatch], [t2].[LeaderNickname], [t2].[LeaderSquadId], [t2].[Rank], [t2].[Discriminator] - 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] - 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 [t2] - WHERE [t2].[HasSoulPatch] = CAST(0 AS bit) -) AS [t1] ON [s].[Id] = [t1].[SquadId] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) -ORDER BY [t].[Nickname], [s].[Id] DESC, [t].[SquadId], [t0].[Id], [t1].[Nickname] -"""); - } - - public override async Task Correlated_collections_with_Skip(bool async) - { - await base.Correlated_collections_with_Skip(async); - - AssertSql( -""" -SELECT [s].[Id], [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] -FROM [Squads] AS [s] -LEFT JOIN ( - SELECT [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] - FROM ( - SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], ROW_NUMBER() OVER(PARTITION BY [t].[SquadId] ORDER BY [t].[Nickname]) AS [row] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] - ) AS [t] - ) AS [t0] - WHERE 1 < [t0].[row] -) AS [t1] ON [s].[Id] = [t1].[SquadId] -ORDER BY [s].[Name], [s].[Id], [t1].[SquadId], [t1].[Nickname] -"""); - } - - public override async Task Correlated_collections_with_Take(bool async) - { - await base.Correlated_collections_with_Take(async); - - AssertSql( -""" -SELECT [s].[Id], [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] -FROM [Squads] AS [s] -LEFT JOIN ( - SELECT [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] - FROM ( - SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], ROW_NUMBER() OVER(PARTITION BY [t].[SquadId] ORDER BY [t].[Nickname]) AS [row] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] - ) AS [t] - ) AS [t0] - WHERE [t0].[row] <= 2 -) AS [t1] ON [s].[Id] = [t1].[SquadId] -ORDER BY [s].[Name], [s].[Id], [t1].[SquadId], [t1].[Nickname] -"""); - } - - public override async Task Correlated_collections_with_Distinct(bool async) - { - await base.Correlated_collections_with_Distinct(async); - - AssertSql( -""" -SELECT [s].[Id], [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] -FROM [Squads] AS [s] -OUTER APPLY ( - SELECT DISTINCT [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] - FROM ( - SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] - ) AS [t] - WHERE [s].[Id] = [t].[SquadId] - ORDER BY [t].[Nickname] - OFFSET 0 ROWS - ) AS [t0] -) AS [t1] -ORDER BY [s].[Name], [s].[Id], [t1].[Nickname] -"""); - } - - public override async Task Correlated_collections_with_FirstOrDefault(bool async) - { - await base.Correlated_collections_with_FirstOrDefault(async); - - AssertSql( - """ -SELECT ( - SELECT TOP 1 `u`.`FullName` - FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` - ) AS `u` - WHERE `s`.`Id` = `u`.`SquadId` - ORDER BY `u`.`Nickname`) -FROM `Squads` AS `s` -ORDER BY `s`.`Name` -"""); - } - - public override async Task Correlated_collections_on_left_join_with_predicate(bool async) - { - await base.Correlated_collections_on_left_join_with_predicate(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `t`.`Id`, `u`.`SquadId`, `w`.`Name`, `w`.`Id` -FROM (`Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname`) -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` -WHERE `u`.`HasSoulPatch` = FALSE -ORDER BY `t`.`Id`, `u`.`Nickname`, `u`.`SquadId` -"""); - } - - public override async Task Correlated_collections_on_left_join_with_null_value(bool async) - { - await base.Correlated_collections_on_left_join_with_null_value(async); - - AssertSql( - """ -SELECT `t`.`Id`, `u`.`Nickname`, `u`.`SquadId`, `w`.`Name`, `w`.`Id` -FROM (`Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname`) -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` -ORDER BY `t`.`Note`, `t`.`Id`, `u`.`Nickname`, `u`.`SquadId` -"""); - } - - public override async Task Correlated_collections_left_join_with_self_reference(bool async) - { - await base.Correlated_collections_left_join_with_self_reference(async); - - AssertSql( - """ -SELECT `t`.`Note`, `t`.`Id`, `u`.`Nickname`, `u`.`SquadId`, `u0`.`FullName`, `u0`.`Nickname`, `u0`.`SquadId` -FROM (`Tags` AS `t` -LEFT JOIN ( - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname`) -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`LeaderNickname`, `g`.`LeaderSquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` - 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 `t`.`Id`, `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname` -"""); - } - - public override async Task Correlated_collections_deeply_nested_left_join(bool async) - { - await base.Correlated_collections_deeply_nested_left_join(async); - - 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` -FROM ((`Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname`) -LEFT JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id`) -LEFT JOIN ( - SELECT `u0`.`Nickname`, `u0`.`SquadId`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName`, `g0`.`HasSoulPatch` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName`, `o0`.`HasSoulPatch` - FROM `Officers` AS `o0` - ) AS `u0` - LEFT JOIN ( - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` = TRUE - ) AS `w0` ON `u0`.`FullName` = `w0`.`OwnerFullName` - WHERE `u0`.`HasSoulPatch` = TRUE -) AS `s0` ON `s`.`Id` = `s0`.`SquadId` -ORDER BY `t`.`Note`, `u`.`Nickname` DESC, `t`.`Id`, `u`.`SquadId`, `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` -"""); - } - - public override async Task Correlated_collections_from_left_join_with_additional_elements_projected_of_that_join(bool async) - { - await base.Correlated_collections_from_left_join_with_additional_elements_projected_of_that_join(async); - - 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` -FROM ((`Weapons` AS `w` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `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`) -LEFT JOIN ( - SELECT `u0`.`Nickname`, `u0`.`SquadId`, `w1`.`Id`, `w1`.`AmmunitionType`, `w1`.`IsAutomatic`, `w1`.`Name`, `w1`.`OwnerFullName`, `w1`.`SynergyWithId`, `u0`.`Rank`, `u0`.`FullName` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName`, `g0`.`Rank` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName`, `o0`.`Rank` - FROM `Officers` AS `o0` - ) AS `u0` - LEFT JOIN ( - SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` - FROM `Weapons` AS `w0` - WHERE `w0`.`IsAutomatic` = FALSE - ) 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` -"""); - } - - public override async Task Correlated_collections_complex_scenario1(bool async) - { - await base.Correlated_collections_complex_scenario1(async); - - AssertSql( - """ -SELECT `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `s0`.`Id`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Id0`, `s0`.`Nickname0`, `s0`.`HasSoulPatch`, `s0`.`SquadId0` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - 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` - FROM ((`Weapons` AS `w` - LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `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`) - LEFT JOIN ( - SELECT `g1`.`Nickname`, `g1`.`SquadId`, `g1`.`HasSoulPatch` - FROM `Gears` AS `g1` - UNION ALL - SELECT `o1`.`Nickname`, `o1`.`SquadId`, `o1`.`HasSoulPatch` - 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` -"""); - } - - public override async Task Correlated_collections_complex_scenario2(bool async) - { - await base.Correlated_collections_complex_scenario2(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` -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` - FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`LeaderNickname`, `g`.`LeaderSquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` - 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` - FROM ((`Weapons` AS `w` - LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o1`.`Nickname`, `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`) - LEFT JOIN ( - SELECT `g1`.`Nickname`, `g1`.`SquadId`, `g1`.`HasSoulPatch` - FROM `Gears` AS `g1` - UNION ALL - SELECT `o2`.`Nickname`, `o2`.`SquadId`, `o2`.`HasSoulPatch` - 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` -"""); - } - - public override async Task Correlated_collections_with_funky_orderby_complex_scenario1(bool async) - { - await base.Correlated_collections_with_funky_orderby_complex_scenario1(async); - - AssertSql( - """ -SELECT `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `s0`.`Id`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Id0`, `s0`.`Nickname0`, `s0`.`HasSoulPatch`, `s0`.`SquadId0` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - 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` - FROM ((`Weapons` AS `w` - LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `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`) - LEFT JOIN ( - SELECT `g1`.`Nickname`, `g1`.`SquadId`, `g1`.`HasSoulPatch` - FROM `Gears` AS `g1` - UNION ALL - SELECT `o1`.`Nickname`, `o1`.`SquadId`, `o1`.`HasSoulPatch` - 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` -"""); - } - - public override async Task Correlated_collections_with_funky_orderby_complex_scenario2(bool async) - { - await base.Correlated_collections_with_funky_orderby_complex_scenario2(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` -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` - FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` - 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` - FROM ((`Weapons` AS `w` - LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o1`.`Nickname`, `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`) - LEFT JOIN ( - SELECT `g1`.`Nickname`, `g1`.`SquadId`, `g1`.`HasSoulPatch` - FROM `Gears` AS `g1` - UNION ALL - SELECT `o2`.`Nickname`, `o2`.`SquadId`, `o2`.`HasSoulPatch` - 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 NOT (`u`.`HasSoulPatch`), `u`.`LeaderNickname`, `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `s1`.`FullName`, NOT (`s1`.`HasSoulPatch0`) DESC, `s1`.`Nickname`, `s1`.`SquadId`, NOT (`s1`.`IsAutomatic`), `s1`.`Name` DESC, `s1`.`Id`, `s1`.`Nickname0`, `s1`.`SquadId0`, `s1`.`Id0`, `s1`.`Nickname00` -"""); - } - - public override async Task Correlated_collection_with_top_level_FirstOrDefault(bool async) - { - await base.Correlated_collection_with_top_level_FirstOrDefault(async); - - AssertSql( - """ -SELECT `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM ( - SELECT TOP 1 `u`.`Nickname`, `u`.`SquadId`, `u`.`FullName` - FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` - ) AS `u` - ORDER BY `u`.`Nickname` -) AS `u0` -LEFT JOIN `Weapons` AS `w` ON `u0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `u0`.`Nickname`, `u0`.`SquadId` -"""); - } - - public override async Task Correlated_collection_with_top_level_Count(bool async) - { - await base.Correlated_collection_with_top_level_Count(async); - - AssertSql( - """ -SELECT COUNT(*) -FROM ( - SELECT 1 - FROM `Gears` AS `g` - UNION ALL - SELECT 1 - FROM `Officers` AS `o` -) AS `u` -"""); - } - - public override async Task Correlated_collection_with_top_level_Last_with_orderby_on_outer(bool async) - { - await base.Correlated_collection_with_top_level_Last_with_orderby_on_outer(async); - - AssertSql( - """ -SELECT `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM ( - SELECT TOP 1 `u`.`Nickname`, `u`.`SquadId`, `u`.`FullName` - FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` - ) AS `u` - ORDER BY `u`.`FullName` -) AS `u0` -LEFT JOIN `Weapons` AS `w` ON `u0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `u0`.`FullName`, `u0`.`Nickname`, `u0`.`SquadId` -"""); - } - - public override async Task Correlated_collection_with_top_level_Last_with_order_by_on_inner(bool async) - { - await base.Correlated_collection_with_top_level_Last_with_order_by_on_inner(async); - - AssertSql( - """ -SELECT `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM ( - SELECT TOP 1 `u`.`Nickname`, `u`.`SquadId`, `u`.`FullName` - FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` - ) AS `u` - ORDER BY `u`.`FullName` DESC -) AS `u0` -LEFT JOIN `Weapons` AS `w` ON `u0`.`FullName` = `w`.`OwnerFullName` -ORDER BY `u0`.`FullName` DESC, `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Name` -"""); - } - - public override async Task Null_semantics_on_nullable_bool_from_inner_join_subquery_is_fully_applied(bool async) - { - await base.Null_semantics_on_nullable_bool_from_inner_join_subquery_is_fully_applied(async); - - AssertSql( - """ -SELECT `l2`.`Id`, `l2`.`CapitalName`, `l2`.`Name`, `l2`.`ServerAddress`, `l2`.`CommanderName`, `l2`.`Eradicated` -FROM ( - SELECT `l`.`Name` - FROM `LocustLeaders` AS `l` - UNION ALL - SELECT `l0`.`Name` - FROM `LocustCommanders` AS `l0` -) AS `u` -INNER JOIN ( - SELECT `l1`.`Id`, `l1`.`CapitalName`, `l1`.`Name`, `l1`.`ServerAddress`, `l1`.`CommanderName`, `l1`.`Eradicated` - FROM `LocustHordes` AS `l1` - WHERE `l1`.`Name` = 'Swarm' -) AS `l2` ON `u`.`Name` = `l2`.`CommanderName` -WHERE `l2`.`Eradicated` <> TRUE OR `l2`.`Eradicated` IS NULL -"""); - } - - public override async Task Null_semantics_on_nullable_bool_from_left_join_subquery_is_fully_applied(bool async) - { - await base.Null_semantics_on_nullable_bool_from_left_join_subquery_is_fully_applied(async); - - AssertSql( - """ -SELECT `l2`.`Id`, `l2`.`CapitalName`, `l2`.`Name`, `l2`.`ServerAddress`, `l2`.`CommanderName`, `l2`.`Eradicated` -FROM ( - SELECT `l`.`Name` - FROM `LocustLeaders` AS `l` - UNION ALL - SELECT `l0`.`Name` - FROM `LocustCommanders` AS `l0` -) AS `u` -LEFT JOIN ( - SELECT `l1`.`Id`, `l1`.`CapitalName`, `l1`.`Name`, `l1`.`ServerAddress`, `l1`.`CommanderName`, `l1`.`Eradicated` - FROM `LocustHordes` AS `l1` - WHERE `l1`.`Name` = 'Swarm' -) AS `l2` ON `u`.`Name` = `l2`.`CommanderName` -WHERE `l2`.`Eradicated` <> TRUE OR `l2`.`Eradicated` IS NULL -"""); - } - - public override async Task Include_on_derived_type_with_order_by_and_paging(bool async) - { - await base.Include_on_derived_type_with_order_by_and_paging(async); - - AssertSql( - """ -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` -FROM ( - SELECT TOP 10 `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` - FROM (( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l` - UNION ALL - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l0` - ) AS `u` - LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` - ) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId`) - LEFT JOIN `Tags` AS `t` ON (`u0`.`Nickname` = `t`.`GearNickName` OR (`u0`.`Nickname` IS NULL AND `t`.`GearNickName` IS NULL)) AND (`u0`.`SquadId` = `t`.`GearSquadId` OR (`u0`.`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` -"""); - } - - public override async Task Select_required_navigation_on_derived_type(bool async) - { - await base.Select_required_navigation_on_derived_type(async); - - AssertSql( - """ -SELECT `l1`.`Name` -FROM ( - SELECT CVar(NULL) AS `HighCommandId` - FROM `LocustLeaders` AS `l` - UNION ALL - SELECT `l0`.`HighCommandId` - FROM `LocustCommanders` AS `l0` -) AS `u` -LEFT JOIN `LocustHighCommands` AS `l1` ON IIF(`u`.`HighCommandId` IS NULL, NULL, CLNG(`u`.`HighCommandId`)) = `l1`.`Id` -"""); - } - - public override async Task Select_required_navigation_on_the_same_type_with_cast(bool async) - { - await base.Select_required_navigation_on_the_same_type_with_cast(async); - - AssertSql( - """ -SELECT `c`.`Name` -FROM ( - SELECT `g`.`CityOfBirthName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`CityOfBirthName` - FROM `Officers` AS `o` -) AS `u` -INNER JOIN `Cities` AS `c` ON `u`.`CityOfBirthName` = `c`.`Name` -"""); - } - - public override async Task Where_required_navigation_on_derived_type(bool async) - { - await base.Where_required_navigation_on_derived_type(async); - - AssertSql( - """ -SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` -FROM ( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l` - UNION ALL - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l0` -) AS `u` -LEFT JOIN `LocustHighCommands` AS `l1` ON IIF(`u`.`HighCommandId` IS NULL, NULL, CLNG(`u`.`HighCommandId`)) = `l1`.`Id` -WHERE `l1`.`IsOperational` = TRUE -"""); - } - - public override async Task Outer_parameter_in_join_key(bool async) - { - await base.Outer_parameter_in_join_key(async); - - AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t1].[Note], [t1].[Id], [t1].[Nickname], [t1].[SquadId] -FROM ( - SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] - FROM [Officers] AS [o] -) AS [t] -OUTER APPLY ( - SELECT [t0].[Note], [t0].[Id], [t2].[Nickname], [t2].[SquadId] - FROM [Tags] AS [t0] - INNER 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 [t2] ON [t].[FullName] = [t2].[FullName] -) AS [t1] -ORDER BY [t].[Nickname], [t].[SquadId], [t1].[Id], [t1].[Nickname] -"""); - } - - public override async Task Outer_parameter_in_join_key_inner_and_outer(bool async) - { - await base.Outer_parameter_in_join_key_inner_and_outer(async); - - AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t1].[Note], [t1].[Id], [t1].[Nickname], [t1].[SquadId] -FROM ( - SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] - FROM [Officers] AS [o] -) AS [t] -OUTER APPLY ( - SELECT [t0].[Note], [t0].[Id], [t2].[Nickname], [t2].[SquadId] - FROM [Tags] AS [t0] - INNER JOIN ( - SELECT [g].[Nickname], [g].[SquadId] - FROM [Gears] AS [g] - UNION ALL - SELECT [o0].[Nickname], [o0].[SquadId] - FROM [Officers] AS [o0] - ) AS [t2] ON [t].[FullName] = [t].[Nickname] -) AS [t1] -ORDER BY [t].[Nickname], [t].[SquadId], [t1].[Id], [t1].[Nickname] -"""); - } - - public override async Task Outer_parameter_in_group_join_with_DefaultIfEmpty(bool async) - { - await base.Outer_parameter_in_group_join_with_DefaultIfEmpty(async); - - AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [t1].[Note], [t1].[Id], [t1].[Nickname], [t1].[SquadId] -FROM ( - SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] - FROM [Officers] AS [o] -) AS [t] -OUTER APPLY ( - SELECT [t0].[Note], [t0].[Id], [t2].[Nickname], [t2].[SquadId] - FROM [Tags] AS [t0] - 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 [t2] ON [t].[FullName] = [t2].[FullName] -) AS [t1] -ORDER BY [t].[Nickname], [t].[SquadId], [t1].[Id], [t1].[Nickname] -"""); - } - - public override async Task Negated_bool_ternary_inside_anonymous_type_in_projection(bool async) - { - await base.Negated_bool_ternary_inside_anonymous_type_in_projection(async); - - AssertSql( - """ -SELECT IIF(`u`.`HasSoulPatch` = TRUE, TRUE, IIF(`u`.`HasSoulPatch` IS NULL, TRUE, `u`.`HasSoulPatch`)) BXOR TRUE AS `c` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -"""); - } - - public override async Task Order_by_entity_qsre(bool async) - { - await base.Order_by_entity_qsre(async); - - AssertSql( - """ -SELECT `u`.`FullName` -FROM ( - SELECT `g`.`Nickname`, `g`.`AssignedCityName`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`AssignedCityName`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name` -ORDER BY `c`.`Name`, `u`.`Nickname` DESC -"""); - } - - public override async Task Order_by_entity_qsre_with_inheritance(bool async) - { - await base.Order_by_entity_qsre_with_inheritance(async); - - AssertSql( - """ -SELECT `u`.`Name` -FROM ( - SELECT `l`.`Name`, `l`.`HighCommandId` - FROM `LocustCommanders` AS `l` -) AS `u` -INNER JOIN `LocustHighCommands` AS `l0` ON `u`.`HighCommandId` = `l0`.`Id` -ORDER BY `l0`.`Id`, `u`.`Name` -"""); - } - - public override async Task Order_by_entity_qsre_composite_key(bool async) - { - await base.Order_by_entity_qsre_composite_key(async); - - AssertSql( - """ -SELECT `w`.`Name` -FROM `Weapons` AS `w` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` ON `w`.`OwnerFullName` = `u`.`FullName` -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `w`.`Id` -"""); - } - - public override async Task Order_by_entity_qsre_with_other_orderbys(bool async) - { - await base.Order_by_entity_qsre_with_other_orderbys(async); - - AssertSql( - """ -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM (`Weapons` AS `w` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` ON `w`.`OwnerFullName` = `u`.`FullName`) -LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w`.`IsAutomatic`), `u`.`Nickname` DESC, `u`.`SquadId` DESC, `w0`.`Id`, `w`.`Name` -"""); - } - - public override async Task Join_on_entity_qsre_keys(bool async) - { - await base.Join_on_entity_qsre_keys(async); - - AssertSql( -""" -SELECT `w`.`Name` AS `Name1`, `w0`.`Name` AS `Name2` -FROM `Weapons` AS `w` -INNER JOIN `Weapons` AS `w0` ON `w`.`Id` = `w0`.`Id` -"""); - } - - public override async Task Join_on_entity_qsre_keys_composite_key(bool async) - { - await base.Join_on_entity_qsre_keys_composite_key(async); - - AssertSql( - """ -SELECT `u`.`FullName` AS `GearName1`, `u0`.`FullName` AS `GearName2` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -INNER JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName` - FROM `Officers` AS `o0` -) AS `u0` ON `u`.`Nickname` = `u0`.`Nickname` AND `u`.`SquadId` = `u0`.`SquadId` -"""); - } - - public override async Task Join_on_entity_qsre_keys_inheritance(bool async) - { - await base.Join_on_entity_qsre_keys_inheritance(async); - - AssertSql( - """ -SELECT `u`.`FullName` AS `GearName`, `u0`.`FullName` AS `OfficerName` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -INNER JOIN ( - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName` - FROM `Officers` AS `o0` -) AS `u0` ON `u`.`Nickname` = `u0`.`Nickname` AND `u`.`SquadId` = `u0`.`SquadId` -"""); - } - - public override async Task Join_on_entity_qsre_keys_outer_key_is_navigation(bool async) - { - await base.Join_on_entity_qsre_keys_outer_key_is_navigation(async); - - AssertSql( - """ -SELECT `w`.`Name` AS `Name1`, `w1`.`Name` AS `Name2` -FROM (`Weapons` AS `w` -LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id`) -LEFT JOIN `Weapons` AS `w1` ON `w0`.`Id` = `w1`.`Id` -WHERE `w0`.`Id` IS NOT NULL AND `w1`.`Id` IS NOT NULL -"""); - } - - public override async Task Join_on_entity_qsre_keys_inner_key_is_navigation(bool async) - { - await base.Join_on_entity_qsre_keys_inner_key_is_navigation(async); - - AssertSql( - """ -SELECT `c`.`Name` AS `CityName`, `s`.`Nickname` AS `GearNickname` -FROM `Cities` AS `c` -INNER JOIN ( - SELECT `u`.`Nickname`, `c0`.`Name` - FROM ( - SELECT `g`.`Nickname`, `g`.`AssignedCityName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`AssignedCityName` - FROM `Officers` AS `o` - ) AS `u` - LEFT JOIN `Cities` AS `c0` ON `u`.`AssignedCityName` = `c0`.`Name` -) AS `s` ON `c`.`Name` = `s`.`Name` -"""); - } - - public override async Task Join_on_entity_qsre_keys_inner_key_is_navigation_composite_key(bool async) - { - await base.Join_on_entity_qsre_keys_inner_key_is_navigation_composite_key(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `s`.`Note` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` -INNER JOIN ( - SELECT `t`.`Note`, `u0`.`Nickname`, `u0`.`SquadId` - FROM `Tags` AS `t` - LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId` - FROM `Officers` AS `o0` - ) AS `u0` ON `t`.`GearNickName` = `u0`.`Nickname` AND `t`.`GearSquadId` = `u0`.`SquadId` - WHERE `t`.`Note` IN ('Cole''s Tag', 'Dom''s Tag') -) AS `s` ON `u`.`Nickname` = `s`.`Nickname` AND `u`.`SquadId` = `s`.`SquadId` -"""); - } - - public override async Task Join_on_entity_qsre_keys_inner_key_is_nested_navigation(bool async) - { - await base.Join_on_entity_qsre_keys_inner_key_is_nested_navigation(async); - - AssertSql( - """ -SELECT `s`.`Name` AS `SquadName`, `s1`.`Name` AS `WeaponName` -FROM `Squads` AS `s` -INNER JOIN ( - SELECT `w`.`Name`, `s0`.`Id` AS `Id0` - FROM (`Weapons` AS `w` - LEFT JOIN ( - SELECT `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` - ) AS `u` ON `w`.`OwnerFullName` = `u`.`FullName`) - LEFT JOIN `Squads` AS `s0` ON `u`.`SquadId` = `s0`.`Id` - WHERE `w`.`IsAutomatic` = TRUE -) AS `s1` ON `s`.`Id` = `s1`.`Id0` -"""); - } - - public override async Task GroupJoin_on_entity_qsre_keys_inner_key_is_nested_navigation(bool async) - { - await base.GroupJoin_on_entity_qsre_keys_inner_key_is_nested_navigation(async); - - AssertSql( - """ -SELECT `s`.`Name` AS `SquadName`, `s1`.`Name` AS `WeaponName` -FROM `Squads` AS `s` -LEFT JOIN ( - SELECT `w`.`Name`, `s0`.`Id` AS `Id0` - FROM (`Weapons` AS `w` - LEFT JOIN ( - SELECT `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` - ) AS `u` ON `w`.`OwnerFullName` = `u`.`FullName`) - LEFT JOIN `Squads` AS `s0` ON `u`.`SquadId` = `s0`.`Id` -) AS `s1` ON `s`.`Id` = `s1`.`Id0` -"""); - } - - public override async Task Streaming_correlated_collection_issue_11403(bool async) - { - await base.Streaming_correlated_collection_issue_11403(async); - - AssertSql( - """ -SELECT `u0`.`Nickname`, `u0`.`SquadId`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` -FROM ( - SELECT TOP 1 `u`.`Nickname`, `u`.`SquadId`, `u`.`FullName` - FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` - ) AS `u` - ORDER BY `u`.`Nickname` -) AS `u0` -LEFT JOIN ( - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` = FALSE -) AS `w0` ON `u0`.`FullName` = `w0`.`OwnerFullName` -ORDER BY `u0`.`Nickname`, `u0`.`SquadId`, `w0`.`Id` -"""); - } - - public override async Task Project_one_value_type_from_empty_collection(bool async) - { - await base.Project_one_value_type_from_empty_collection(async); - AssertSql( - """ -SELECT `s`.`Name`, IIF(( - SELECT TOP 1 `u`.`SquadId` - FROM ( - SELECT `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` - ) AS `u` - WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE) IS NULL, 0, ( - SELECT TOP 1 `u`.`SquadId` - FROM ( - SELECT `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` - ) AS `u` - WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE)) AS `SquadId` -FROM `Squads` AS `s` -WHERE `s`.`Name` = 'Kilo' -"""); - } - - public override async Task Project_one_value_type_converted_to_nullable_from_empty_collection(bool async) - { - await base.Project_one_value_type_converted_to_nullable_from_empty_collection(async); - AssertSql( - """ -SELECT `s`.`Name`, ( - SELECT TOP 1 `u`.`SquadId` - FROM ( - SELECT `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` - ) AS `u` - WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE) AS `SquadId` -FROM `Squads` AS `s` -WHERE `s`.`Name` = 'Kilo' -"""); - } - - public override async Task Project_one_value_type_with_client_projection_from_empty_collection(bool async) - { - await base.Project_one_value_type_with_client_projection_from_empty_collection(async); - - AssertSql( -""" -SELECT [s].[Name], [t1].[SquadId], [t1].[LeaderSquadId], [t1].[c] -FROM [Squads] AS [s] -LEFT JOIN ( - SELECT [t0].[SquadId], [t0].[LeaderSquadId], [t0].[c] - FROM ( - SELECT [t].[SquadId], [t].[LeaderSquadId], 1 AS [c], ROW_NUMBER() OVER(PARTITION BY [t].[SquadId] ORDER BY [t].[Nickname], [t].[SquadId]) AS [row] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch], [g].[LeaderSquadId] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch], [o].[LeaderSquadId] - FROM [Officers] AS [o] - ) AS [t] - WHERE [t].[HasSoulPatch] = CAST(1 AS bit) - ) AS [t0] - WHERE [t0].[row] <= 1 -) AS [t1] ON [s].[Id] = [t1].[SquadId] -WHERE [s].[Name] = N'Kilo' -"""); - } - - public override async Task Filter_on_subquery_projecting_one_value_type_from_empty_collection(bool async) - { - await base.Filter_on_subquery_projecting_one_value_type_from_empty_collection(async); - - AssertSql( - """ -SELECT `s`.`Name` -FROM `Squads` AS `s` -WHERE `s`.`Name` = 'Kilo' AND IIF(( - SELECT TOP 1 `u`.`SquadId` - FROM ( - SELECT `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` - ) AS `u` - WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE) IS NULL, 0, ( - SELECT TOP 1 `u`.`SquadId` - FROM ( - SELECT `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` - ) AS `u` - WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE)) <> 0 -"""); - } - - public override async Task Select_subquery_projecting_single_constant_int(bool async) - { - await base.Select_subquery_projecting_single_constant_int(async); - - AssertSql( - """ -SELECT `s`.`Name`, IIF(( - SELECT TOP 1 42 - FROM ( - SELECT `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` - ) AS `u` - WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE) IS NULL, 0, ( - SELECT TOP 1 42 - FROM ( - SELECT `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` - ) AS `u` - WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE)) AS `Gear` -FROM `Squads` AS `s` -"""); - } - - public override async Task Select_subquery_projecting_single_constant_string(bool async) - { - await base.Select_subquery_projecting_single_constant_string(async); - - AssertSql( - """ -SELECT `s`.`Name`, ( - SELECT TOP 1 'Foo' + 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` FROM ( - SELECT `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` + SELECT `g1`.`Nickname`, `g1`.`SquadId`, `g1`.`FullName`, `g1`.`LeaderNickname`, `g1`.`LeaderSquadId`, `g1`.`Rank` + FROM `Gears` AS `g1` UNION ALL - SELECT `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` - ) AS `u` - WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE) AS `Gear` -FROM `Squads` AS `s` -"""); - } - - public override async Task Select_subquery_projecting_single_constant_bool(bool async) - { - await base.Select_subquery_projecting_single_constant_bool(async); - - AssertSql( - """ -SELECT `s`.`Name`, IIF(( - SELECT TOP 1 TRUE - FROM ( - SELECT `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` - ) AS `u` - WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE) IS NULL, FALSE, ( - SELECT TOP 1 TRUE - FROM ( - SELECT `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` + SELECT `o2`.`Nickname`, `o2`.`SquadId`, `o2`.`FullName`, `o2`.`LeaderNickname`, `o2`.`LeaderSquadId`, `o2`.`Rank` + 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` + FROM (((`Weapons` AS `w` + LEFT JOIN ( + SELECT `g2`.`Nickname`, `g2`.`SquadId`, `g2`.`FullName` + FROM `Gears` AS `g2` UNION ALL - SELECT `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` - ) AS `u` - WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE)) AS `Gear` -FROM `Squads` AS `s` -"""); - } - - public override async Task Select_subquery_projecting_single_constant_inside_anonymous(bool async) - { - await base.Select_subquery_projecting_single_constant_inside_anonymous(async); - - AssertSql( -""" -SELECT [s].[Name], [t1].[One] -FROM [Squads] AS [s] -LEFT JOIN ( - SELECT [t0].[One], [t0].[SquadId] - FROM ( - SELECT 1 AS [One], [t].[SquadId], ROW_NUMBER() OVER(PARTITION BY [t].[SquadId] ORDER BY [t].[Nickname], [t].[SquadId]) AS [row] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] - FROM [Gears] AS [g] + SELECT `o3`.`Nickname`, `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`) + LEFT JOIN `Weapons` AS `w0` ON `u3`.`FullName` = `w0`.`OwnerFullName`) + LEFT JOIN ( + SELECT `g3`.`Nickname`, `g3`.`SquadId`, `g3`.`HasSoulPatch` + FROM `Gears` AS `g3` UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] - FROM [Officers] AS [o] - ) AS [t] - WHERE [t].[HasSoulPatch] = CAST(1 AS bit) - ) AS [t0] - WHERE [t0].[row] <= 1 -) AS [t1] ON [s].[Id] = [t1].[SquadId] -"""); - } - - public override async Task Select_subquery_projecting_multiple_constants_inside_anonymous(bool async) - { - await base.Select_subquery_projecting_multiple_constants_inside_anonymous(async); - - AssertSql( -""" -SELECT [s].[Name], [t1].[True1], [t1].[False1], [t1].[c] -FROM [Squads] AS [s] + SELECT `o4`.`Nickname`, `o4`.`SquadId`, `o4`.`HasSoulPatch` + FROM `Officers` AS `o4` + ) AS `u4` ON `s`.`Id` = `u4`.`SquadId` + WHERE `w`.`Name` <> 'Bar' OR `w`.`Name` IS NULL + ) AS `s0` ON `u2`.`FullName` = `s0`.`OwnerFullName` + WHERE `u2`.`FullName` <> 'Foo' +) AS `s1` ON `u`.`Nickname` = `s1`.`LeaderNickname` AND `u`.`SquadId` = `s1`.`LeaderSquadId`) LEFT JOIN ( - SELECT [t0].[True1], [t0].[False1], [t0].[c], [t0].[SquadId] + SELECT `w1`.`Id`, `w1`.`AmmunitionType`, `w1`.`IsAutomatic`, `w1`.`Name`, `w1`.`OwnerFullName`, `w1`.`SynergyWithId`, `u5`.`Nickname`, `u5`.`SquadId` + FROM `Weapons` AS `w1` + LEFT JOIN ( + SELECT `g4`.`Nickname`, `g4`.`SquadId`, `g4`.`FullName` + FROM `Gears` AS `g4` + UNION ALL + SELECT `o5`.`Nickname`, `o5`.`SquadId`, `o5`.`FullName` + FROM `Officers` AS `o5` + ) AS `u5` ON `w1`.`OwnerFullName` = `u5`.`FullName` +) AS `s2` ON `u1`.`FullName` = `s2`.`OwnerFullName` +WHERE EXISTS ( + SELECT 1 FROM ( - SELECT CAST(1 AS bit) AS [True1], CAST(0 AS bit) AS [False1], 1 AS [c], [t].[SquadId], ROW_NUMBER() OVER(PARTITION BY [t].[SquadId] ORDER BY [t].[Nickname], [t].[SquadId]) AS [row] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] - FROM [Officers] AS [o] - ) AS [t] - WHERE [t].[HasSoulPatch] = CAST(1 AS bit) - ) AS [t0] - WHERE [t0].[row] <= 1 -) AS [t1] ON [s].[Id] = [t1].[SquadId] + SELECT `g`.`LeaderNickname`, `g`.`LeaderSquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` + FROM `Officers` AS `o0` + ) AS `u0` + WHERE `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId`) +ORDER BY NOT (`u`.`HasSoulPatch`) DESC, `t`.`Note`, `u`.`Nickname`, `u`.`SquadId`, `t`.`Id`, `u1`.`Nickname`, `u1`.`SquadId`, `s1`.`Rank`, `s1`.`Nickname`, `s1`.`SquadId`, NOT (`s1`.`IsAutomatic0`), `s1`.`Id`, `s1`.`Nickname0`, `s1`.`SquadId0`, `s1`.`Id0`, `s1`.`Id1`, `s1`.`Nickname00`, `s1`.`SquadId00`, NOT (`s2`.`IsAutomatic`), `s2`.`Nickname` DESC, `s2`.`Id` """); } - public override async Task Include_with_order_by_constant(bool async) + public override async Task Correlated_collections_inner_subquery_selector_references_outer_qsre(bool async) { - await base.Include_with_order_by_constant(async); + await base.Correlated_collections_inner_subquery_selector_references_outer_qsre(async); AssertSql( - """ -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name`, `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM `Squads` AS `s` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` ON `s`.`Id` = `u`.`SquadId` -ORDER BY `s`.`Id`, `u`.`Nickname` +""" +SELECT [t].[FullName], [t].[Nickname], [t].[SquadId], [t0].[ReportName], [t0].[OfficerName], [t0].[Nickname], [t0].[SquadId] +FROM ( + SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] + FROM [Officers] AS [o] +) AS [t] +OUTER APPLY ( + SELECT [t1].[FullName] AS [ReportName], [t].[FullName] AS [OfficerName], [t1].[Nickname], [t1].[SquadId] + FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[FullName], [g].[LeaderNickname], [g].[LeaderSquadId] + FROM [Gears] AS [g] + UNION ALL + SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName], [o0].[LeaderNickname], [o0].[LeaderSquadId] + FROM [Officers] AS [o0] + ) AS [t1] + WHERE [t].[Nickname] = [t1].[LeaderNickname] AND [t].[SquadId] = [t1].[LeaderSquadId] +) AS [t0] +ORDER BY [t].[Nickname], [t].[SquadId], [t0].[Nickname] """); } - public override async Task Correlated_collection_order_by_constant(bool async) + public override async Task Correlated_collections_inner_subquery_predicate_references_outer_qsre(bool async) { - await base.Correlated_collection_order_by_constant(async); + await base.Correlated_collections_inner_subquery_predicate_references_outer_qsre(async); AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `w`.`Name`, `w`.`Id` +""" +SELECT [t].[FullName], [t].[Nickname], [t].[SquadId], [t0].[ReportName], [t0].[Nickname], [t0].[SquadId] FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` -ORDER BY `u`.`Nickname`, `u`.`SquadId` + SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] + FROM [Officers] AS [o] +) AS [t] +OUTER APPLY ( + SELECT [t1].[FullName] AS [ReportName], [t1].[Nickname], [t1].[SquadId] + FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[FullName], [g].[LeaderNickname], [g].[LeaderSquadId] + FROM [Gears] AS [g] + UNION ALL + SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName], [o0].[LeaderNickname], [o0].[LeaderSquadId] + FROM [Officers] AS [o0] + ) AS [t1] + WHERE [t].[Nickname] = [t1].[LeaderNickname] AND [t].[SquadId] = [t1].[LeaderSquadId] AND [t].[FullName] <> N'Foo' +) AS [t0] +ORDER BY [t].[Nickname], [t].[SquadId], [t0].[Nickname] """); } - public override async Task Select_subquery_projecting_single_constant_null_of_non_mapped_type(bool async) + public override async Task Correlated_collections_nested_inner_subquery_references_outer_qsre_one_level_up(bool async) { - await base.Select_subquery_projecting_single_constant_null_of_non_mapped_type(async); + await base.Correlated_collections_nested_inner_subquery_references_outer_qsre_one_level_up(async); AssertSql( """ -SELECT [s].[Name], [t1].[c] -FROM [Squads] AS [s] +SELECT [t].[FullName], [t].[Nickname], [t].[SquadId], [t1].[FullName], [t1].[Nickname], [t1].[SquadId], [t1].[Name], [t1].[Nickname0], [t1].[Id] +FROM ( + SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] + FROM [Officers] AS [o] +) AS [t] LEFT JOIN ( - SELECT [t0].[c], [t0].[SquadId] + SELECT [t0].[FullName], [t0].[Nickname], [t0].[SquadId], [t2].[Name], [t2].[Nickname] AS [Nickname0], [t2].[Id], [t0].[LeaderNickname], [t0].[LeaderSquadId] FROM ( - SELECT 1 AS [c], [t].[SquadId], ROW_NUMBER() OVER(PARTITION BY [t].[SquadId] ORDER BY [t].[Nickname], [t].[SquadId]) AS [row] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] - FROM [Officers] AS [o] - ) AS [t] - WHERE [t].[HasSoulPatch] = CAST(1 AS bit) + SELECT [g].[Nickname], [g].[SquadId], [g].[FullName], [g].[LeaderNickname], [g].[LeaderSquadId] + FROM [Gears] AS [g] + UNION ALL + SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName], [o0].[LeaderNickname], [o0].[LeaderSquadId] + FROM [Officers] AS [o0] ) AS [t0] - WHERE [t0].[row] <= 1 -) AS [t1] ON [s].[Id] = [t1].[SquadId] + OUTER APPLY ( + SELECT [w].[Name], [t0].[Nickname], [w].[Id] + FROM [Weapons] AS [w] + WHERE [t0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR ([w].[Name] IS NULL)) + ) AS [t2] + WHERE [t0].[FullName] <> N'Foo' +) AS [t1] ON [t].[Nickname] = [t1].[LeaderNickname] AND [t].[SquadId] = [t1].[LeaderSquadId] +ORDER BY [t].[Nickname], [t].[SquadId], [t1].[Nickname], [t1].[SquadId] """); } - public override async Task Select_subquery_projecting_single_constant_of_non_mapped_type(bool async) + public override async Task Correlated_collections_nested_inner_subquery_references_outer_qsre_two_levels_up(bool async) { - await base.Select_subquery_projecting_single_constant_of_non_mapped_type(async); + await base.Correlated_collections_nested_inner_subquery_references_outer_qsre_two_levels_up(async); AssertSql( """ -SELECT [s].[Name], [t1].[c] -FROM [Squads] AS [s] -LEFT JOIN ( - SELECT [t0].[c], [t0].[SquadId] +SELECT [t].[FullName], [t].[Nickname], [t].[SquadId], [t1].[FullName], [t1].[Nickname], [t1].[SquadId], [t1].[Name], [t1].[Nickname0], [t1].[Id] +FROM ( + SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] + FROM [Officers] AS [o] +) AS [t] +OUTER APPLY ( + SELECT [t0].[FullName], [t0].[Nickname], [t0].[SquadId], [t2].[Name], [t2].[Nickname] AS [Nickname0], [t2].[Id] FROM ( - SELECT 1 AS [c], [t].[SquadId], ROW_NUMBER() OVER(PARTITION BY [t].[SquadId] ORDER BY [t].[Nickname], [t].[SquadId]) AS [row] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] - FROM [Officers] AS [o] - ) AS [t] - WHERE [t].[HasSoulPatch] = CAST(1 AS bit) + SELECT [g].[Nickname], [g].[SquadId], [g].[FullName], [g].[LeaderNickname], [g].[LeaderSquadId] + FROM [Gears] AS [g] + UNION ALL + SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName], [o0].[LeaderNickname], [o0].[LeaderSquadId] + FROM [Officers] AS [o0] ) AS [t0] - WHERE [t0].[row] <= 1 -) AS [t1] ON [s].[Id] = [t1].[SquadId] + LEFT JOIN ( + SELECT [w].[Name], [t].[Nickname], [w].[Id], [w].[OwnerFullName] + FROM [Weapons] AS [w] + WHERE [w].[Name] <> N'Bar' OR ([w].[Name] IS NULL) + ) AS [t2] ON [t0].[FullName] = [t2].[OwnerFullName] + WHERE [t].[Nickname] = [t0].[LeaderNickname] AND [t].[SquadId] = [t0].[LeaderSquadId] AND [t0].[FullName] <> N'Foo' +) AS [t1] +ORDER BY [t].[Nickname], [t].[SquadId], [t1].[Nickname], [t1].[SquadId] """); } - public override async Task Include_collection_OrderBy_aggregate(bool async) + public override async Task Correlated_collections_on_select_many(bool async) { - await base.Include_collection_OrderBy_aggregate(async); + await base.Correlated_collections_on_select_many(async); AssertSql( - """ -SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `s`.`Nickname0`, `s`.`SquadId0`, `s`.`AssignedCityName0`, `s`.`CityOfBirthName0`, `s`.`FullName0`, `s`.`HasSoulPatch0`, `s`.`LeaderNickname0`, `s`.`LeaderSquadId0`, `s`.`Rank0`, `s`.`Discriminator0`, `s`.`c` +""" +SELECT [t].[Nickname], [s].[Name], [t].[SquadId], [s].[Id], [t0].[Id], [t0].[AmmunitionType], [t0].[IsAutomatic], [t0].[Name], [t0].[OwnerFullName], [t0].[SynergyWithId], [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] FROM ( - SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname` AS `Nickname0`, `u0`.`SquadId` AS `SquadId0`, `u0`.`AssignedCityName` AS `AssignedCityName0`, `u0`.`CityOfBirthName` AS `CityOfBirthName0`, `u0`.`FullName` AS `FullName0`, `u0`.`HasSoulPatch` AS `HasSoulPatch0`, `u0`.`LeaderNickname` AS `LeaderNickname0`, `u0`.`LeaderSquadId` AS `LeaderSquadId0`, `u0`.`Rank` AS `Rank0`, `u0`.`Discriminator` AS `Discriminator0`, ( - SELECT COUNT(*) - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName`) AS `c` + SELECT [g].[Nickname], [g].[SquadId], [g].[FullName], [g].[HasSoulPatch] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], [o].[FullName], [o].[HasSoulPatch] + FROM [Officers] AS [o] +) AS [t] +CROSS JOIN [Squads] AS [s] +LEFT JOIN ( + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) +) AS [t0] ON [t].[FullName] = [t0].[OwnerFullName] +LEFT JOIN ( + SELECT [t2].[Nickname], [t2].[SquadId], [t2].[AssignedCityName], [t2].[CityOfBirthName], [t2].[FullName], [t2].[HasSoulPatch], [t2].[LeaderNickname], [t2].[LeaderSquadId], [t2].[Rank], [t2].[Discriminator] FROM ( - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` - ) AS `u` - LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` + 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] UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` - ) AS `u0` ON `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId` -) AS `s` -ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` + 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 [t2] + WHERE [t2].[HasSoulPatch] = CAST(0 AS bit) +) AS [t1] ON [s].[Id] = [t1].[SquadId] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) +ORDER BY [t].[Nickname], [s].[Id] DESC, [t].[SquadId], [t0].[Id], [t1].[Nickname] """); } - public override async Task Include_collection_with_complex_OrderBy2(bool async) + public override async Task Correlated_collections_with_Skip(bool async) { - await base.Include_collection_with_complex_OrderBy2(async); + await base.Correlated_collections_with_Skip(async); AssertSql( - """ -SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `s`.`Nickname0`, `s`.`SquadId0`, `s`.`AssignedCityName0`, `s`.`CityOfBirthName0`, `s`.`FullName0`, `s`.`HasSoulPatch0`, `s`.`LeaderNickname0`, `s`.`LeaderSquadId0`, `s`.`Rank0`, `s`.`Discriminator0`, `s`.`c` -FROM ( - SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname` AS `Nickname0`, `u0`.`SquadId` AS `SquadId0`, `u0`.`AssignedCityName` AS `AssignedCityName0`, `u0`.`CityOfBirthName` AS `CityOfBirthName0`, `u0`.`FullName` AS `FullName0`, `u0`.`HasSoulPatch` AS `HasSoulPatch0`, `u0`.`LeaderNickname` AS `LeaderNickname0`, `u0`.`LeaderSquadId` AS `LeaderSquadId0`, `u0`.`Rank` AS `Rank0`, `u0`.`Discriminator` AS `Discriminator0`, ( - SELECT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`) AS `c` +""" +SELECT [s].[Id], [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] +FROM [Squads] AS [s] +LEFT JOIN ( + SELECT [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] FROM ( - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` - ) AS `u` - LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` - ) AS `u0` ON `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId` -) AS `s` -ORDER BY NOT (`s`.`c`), `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` + SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], ROW_NUMBER() OVER(PARTITION BY [t].[SquadId] ORDER BY [t].[Nickname]) AS [row] + FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] + ) AS [t] + ) AS [t0] + WHERE 1 < [t0].[row] +) AS [t1] ON [s].[Id] = [t1].[SquadId] +ORDER BY [s].[Name], [s].[Id], [t1].[SquadId], [t1].[Nickname] """); } - public override async Task Include_collection_with_complex_OrderBy3(bool async) + public override async Task Correlated_collections_with_Take(bool async) { - await base.Include_collection_with_complex_OrderBy3(async); + await base.Correlated_collections_with_Take(async); AssertSql( - """ -SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `s`.`Nickname0`, `s`.`SquadId0`, `s`.`AssignedCityName0`, `s`.`CityOfBirthName0`, `s`.`FullName0`, `s`.`HasSoulPatch0`, `s`.`LeaderNickname0`, `s`.`LeaderSquadId0`, `s`.`Rank0`, `s`.`Discriminator0`, `s`.`c` -FROM ( - SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname` AS `Nickname0`, `u0`.`SquadId` AS `SquadId0`, `u0`.`AssignedCityName` AS `AssignedCityName0`, `u0`.`CityOfBirthName` AS `CityOfBirthName0`, `u0`.`FullName` AS `FullName0`, `u0`.`HasSoulPatch` AS `HasSoulPatch0`, `u0`.`LeaderNickname` AS `LeaderNickname0`, `u0`.`LeaderSquadId` AS `LeaderSquadId0`, `u0`.`Rank` AS `Rank0`, `u0`.`Discriminator` AS `Discriminator0`, IIF(( - SELECT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`) IS NULL, FALSE, ( - SELECT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`)) AS `c` +""" +SELECT [s].[Id], [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] +FROM [Squads] AS [s] +LEFT JOIN ( + SELECT [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] FROM ( - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` - ) AS `u` - LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` - ) AS `u0` ON `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId` -) AS `s` -ORDER BY NOT (`s`.`c`), `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` + SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], ROW_NUMBER() OVER(PARTITION BY [t].[SquadId] ORDER BY [t].[Nickname]) AS [row] + FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] + ) AS [t] + ) AS [t0] + WHERE [t0].[row] <= 2 +) AS [t1] ON [s].[Id] = [t1].[SquadId] +ORDER BY [s].[Name], [s].[Id], [t1].[SquadId], [t1].[Nickname] """); } - public override async Task Correlated_collection_with_complex_OrderBy(bool async) + public override async Task Correlated_collections_with_Distinct(bool async) { - await base.Correlated_collection_with_complex_OrderBy(async); + await base.Correlated_collections_with_Distinct(async); AssertSql( - """ -SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `s`.`c` -FROM ( - SELECT `u`.`Nickname`, `u`.`SquadId`, `u1`.`Nickname` AS `Nickname0`, `u1`.`SquadId` AS `SquadId0`, `u1`.`AssignedCityName`, `u1`.`CityOfBirthName`, `u1`.`FullName`, `u1`.`HasSoulPatch`, `u1`.`LeaderNickname`, `u1`.`LeaderSquadId`, `u1`.`Rank`, `u1`.`Discriminator`, ( - SELECT COUNT(*) - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName`) AS `c` +""" +SELECT [s].[Id], [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] +FROM [Squads] AS [s] +OUTER APPLY ( + SELECT DISTINCT [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] FROM ( - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` - ) AS `u` - LEFT JOIN ( - SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` + SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` - ) AS `u0` - WHERE `u0`.`HasSoulPatch` = FALSE - ) AS `u1` ON `u`.`Nickname` = `u1`.`LeaderNickname` AND `u`.`SquadId` = `u1`.`LeaderSquadId` -) AS `s` -ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] + ) AS [t] + WHERE [s].[Id] = [t].[SquadId] + ORDER BY [t].[Nickname] + OFFSET 0 ROWS + ) AS [t0] +) AS [t1] +ORDER BY [s].[Name], [s].[Id], [t1].[Nickname] """); } - public override async Task Correlated_collection_with_very_complex_order_by(bool async) + public override async Task Correlated_collections_with_FirstOrDefault(bool async) { - await base.Correlated_collection_with_very_complex_order_by(async); + await base.Correlated_collections_with_FirstOrDefault(async); AssertSql( """ -SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `s`.`c` -FROM ( - SELECT `u`.`Nickname`, `u`.`SquadId`, `u2`.`Nickname` AS `Nickname0`, `u2`.`SquadId` AS `SquadId0`, `u2`.`AssignedCityName`, `u2`.`CityOfBirthName`, `u2`.`FullName`, `u2`.`HasSoulPatch`, `u2`.`LeaderNickname`, `u2`.`LeaderSquadId`, `u2`.`Rank`, `u2`.`Discriminator`, ( - SELECT COUNT(*) - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` AND `w`.`IsAutomatic` = IIF(( - SELECT TOP 1 `u0`.`HasSoulPatch` - FROM ( - SELECT `g`.`Nickname`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`HasSoulPatch` - FROM `Officers` AS `o0` - ) AS `u0` - WHERE `u0`.`Nickname` = 'Marcus') IS NULL, FALSE, ( - SELECT TOP 1 `u0`.`HasSoulPatch` - FROM ( - SELECT `g`.`Nickname`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`HasSoulPatch` - FROM `Officers` AS `o0` - ) AS `u0` - WHERE `u0`.`Nickname` = 'Marcus'))) AS `c` +SELECT ( + SELECT TOP 1 `u`.`FullName` FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` ) AS `u` - LEFT JOIN ( - SELECT `u1`.`Nickname`, `u1`.`SquadId`, `u1`.`AssignedCityName`, `u1`.`CityOfBirthName`, `u1`.`FullName`, `u1`.`HasSoulPatch`, `u1`.`LeaderNickname`, `u1`.`LeaderSquadId`, `u1`.`Rank`, `u1`.`Discriminator` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o1`.`Nickname`, `o1`.`SquadId`, `o1`.`AssignedCityName`, `o1`.`CityOfBirthName`, `o1`.`FullName`, `o1`.`HasSoulPatch`, `o1`.`LeaderNickname`, `o1`.`LeaderSquadId`, `o1`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o1` - ) AS `u1` - WHERE `u1`.`HasSoulPatch` = FALSE - ) AS `u2` ON `u`.`Nickname` = `u2`.`LeaderNickname` AND `u`.`SquadId` = `u2`.`LeaderSquadId` -) AS `s` -ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` + WHERE `s`.`Id` = `u`.`SquadId` + ORDER BY `u`.`Nickname`) +FROM `Squads` AS `s` +ORDER BY `s`.`Name` """); } - public override async Task Cast_to_derived_type_after_OfType_works(bool async) + public override async Task Correlated_collections_on_left_join_with_predicate(bool async) { - await base.Cast_to_derived_type_after_OfType_works(async); + await base.Correlated_collections_on_left_join_with_predicate(async); AssertSql( -""" -SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` -FROM `Officers` AS `o` + """ +SELECT `u`.`Nickname`, `t`.`Id`, `u`.`SquadId`, `w`.`Name`, `w`.`Id` +FROM (`Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname`) +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` +WHERE `u`.`HasSoulPatch` = FALSE +ORDER BY `t`.`Id`, `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Select_subquery_boolean(bool async) + public override async Task Correlated_collections_on_RightJoin_with_predicate(bool async) { - await base.Select_subquery_boolean(async); + await base.Correlated_collections_on_RightJoin_with_predicate(async); AssertSql( """ -SELECT IIF(( - SELECT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`) IS NULL, FALSE, ( - SELECT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`)) +SELECT [u].[Nickname], [u].[SquadId], [t].[Id], [w].[Name], [w].[Id] FROM ( - SELECT `g`.`FullName` + SELECT [g].[Nickname], [g].[SquadId], [g].[FullName], [g].[HasSoulPatch] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], [o].[FullName], [o].[HasSoulPatch] + FROM [Officers] AS [o] +) AS [u] +RIGHT JOIN [Tags] AS [t] ON [u].[Nickname] = [t].[GearNickName] +LEFT JOIN [Weapons] AS [w] ON [u].[FullName] = [w].[OwnerFullName] +WHERE [u].[HasSoulPatch] = CAST(0 AS bit) +ORDER BY [u].[Nickname], [u].[SquadId], [t].[Id] +"""); + } + + public override async Task Correlated_collections_on_left_join_with_null_value(bool async) + { + await base.Correlated_collections_on_left_join_with_null_value(async); + + AssertSql( + """ +SELECT `t`.`Id`, `u`.`Nickname`, `u`.`SquadId`, `w`.`Name`, `w`.`Id` +FROM (`Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`FullName` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` -) AS `u` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname`) +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` +ORDER BY `t`.`Note`, `t`.`Id`, `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Select_subquery_boolean_with_pushdown(bool async) + public override async Task Correlated_collections_left_join_with_self_reference(bool async) { - await base.Select_subquery_boolean_with_pushdown(async); + await base.Correlated_collections_left_join_with_self_reference(async); AssertSql( """ -SELECT ( - SELECT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`) -FROM ( - SELECT `g`.`FullName` +SELECT `t`.`Note`, `t`.`Id`, `u`.`Nickname`, `u`.`SquadId`, `u0`.`FullName`, `u0`.`Nickname`, `u0`.`SquadId` +FROM (`Tags` AS `t` +LEFT JOIN ( + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname`) +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`LeaderNickname`, `g`.`LeaderSquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` + 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 `t`.`Id`, `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname` """); } - public override async Task Select_subquery_int_with_inside_cast_and_coalesce(bool async) + public override async Task Correlated_collections_deeply_nested_left_join(bool async) { - await base.Select_subquery_int_with_inside_cast_and_coalesce(async); + await base.Correlated_collections_deeply_nested_left_join(async); AssertSql( """ -SELECT IIF(( - SELECT TOP 1 `w`.`Id` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`) IS NULL, 42, ( - SELECT TOP 1 `w`.`Id` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`)) -FROM ( - SELECT `g`.`FullName` +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` +FROM ((`Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`FullName` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname`) +LEFT JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id`) +LEFT JOIN ( + SELECT `u0`.`Nickname`, `u0`.`SquadId`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` + FROM ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName`, `g0`.`HasSoulPatch` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName`, `o0`.`HasSoulPatch` + FROM `Officers` AS `o0` + ) AS `u0` + LEFT JOIN ( + SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + FROM `Weapons` AS `w` + WHERE `w`.`IsAutomatic` = TRUE + ) AS `w0` ON `u0`.`FullName` = `w0`.`OwnerFullName` + WHERE `u0`.`HasSoulPatch` = TRUE +) AS `s0` ON `s`.`Id` = `s0`.`SquadId` +ORDER BY `t`.`Note`, `u`.`Nickname` DESC, `t`.`Id`, `u`.`SquadId`, `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` """); } - public override async Task Select_subquery_int_with_outside_cast_and_coalesce(bool async) + public override async Task Correlated_collections_from_left_join_with_additional_elements_projected_of_that_join(bool async) { - await base.Select_subquery_int_with_outside_cast_and_coalesce(async); + await base.Correlated_collections_from_left_join_with_additional_elements_projected_of_that_join(async); AssertSql( """ -SELECT IIF(( - SELECT TOP 1 `w`.`Id` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`) IS NULL, 0, ( - SELECT TOP 1 `w`.`Id` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`)) -FROM ( - SELECT `g`.`FullName` +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` +FROM ((`Weapons` AS `w` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`FullName` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` -) AS `u` +) AS `u` ON `w`.`OwnerFullName` = `u`.`FullName`) +LEFT JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id`) +LEFT JOIN ( + SELECT `u0`.`Nickname`, `u0`.`SquadId`, `w1`.`Id`, `w1`.`AmmunitionType`, `w1`.`IsAutomatic`, `w1`.`Name`, `w1`.`OwnerFullName`, `w1`.`SynergyWithId`, `u0`.`Rank`, `u0`.`FullName` + FROM ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName`, `g0`.`Rank` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName`, `o0`.`Rank` + FROM `Officers` AS `o0` + ) AS `u0` + LEFT JOIN ( + SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` + FROM `Weapons` AS `w0` + WHERE `w0`.`IsAutomatic` = FALSE + ) 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` """); } - public override async Task Select_subquery_int_with_pushdown_and_coalesce(bool async) + public override async Task Correlated_collections_complex_scenario1(bool async) { - await base.Select_subquery_int_with_pushdown_and_coalesce(async); + await base.Correlated_collections_complex_scenario1(async); AssertSql( """ -SELECT IIF(( - SELECT TOP 1 `w`.`Id` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`) IS NULL, 42, ( - SELECT TOP 1 `w`.`Id` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`)) +SELECT `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `s0`.`Id`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Id0`, `s0`.`Nickname0`, `s0`.`HasSoulPatch`, `s0`.`SquadId0` FROM ( - SELECT `g`.`FullName` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`FullName` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` 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` + FROM ((`Weapons` AS `w` + LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `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`) + LEFT JOIN ( + SELECT `g1`.`Nickname`, `g1`.`SquadId`, `g1`.`HasSoulPatch` + FROM `Gears` AS `g1` + UNION ALL + SELECT `o1`.`Nickname`, `o1`.`SquadId`, `o1`.`HasSoulPatch` + 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` """); } - public override async Task Select_subquery_int_with_pushdown_and_coalesce2(bool async) + public override async Task Correlated_collections_complex_scenario2(bool async) { - await base.Select_subquery_int_with_pushdown_and_coalesce2(async); + await base.Correlated_collections_complex_scenario2(async); AssertSql( """ -SELECT IIF(( - SELECT TOP 1 `w`.`Id` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`) IS NULL, ( - SELECT TOP 1 `w0`.`Id` - FROM `Weapons` AS `w0` - WHERE `u`.`FullName` = `w0`.`OwnerFullName` - ORDER BY `w0`.`Id`), ( - SELECT TOP 1 `w`.`Id` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`)) +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` FROM ( - SELECT `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`FullName` + 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` + FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`LeaderNickname`, `g`.`LeaderSquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` + 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` + FROM ((`Weapons` AS `w` + LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o1`.`Nickname`, `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`) + LEFT JOIN ( + SELECT `g1`.`Nickname`, `g1`.`SquadId`, `g1`.`HasSoulPatch` + FROM `Gears` AS `g1` + UNION ALL + SELECT `o2`.`Nickname`, `o2`.`SquadId`, `o2`.`HasSoulPatch` + 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` """); } - public override async Task Select_subquery_boolean_empty(bool async) + public override async Task Correlated_collections_with_funky_orderby_complex_scenario1(bool async) { - await base.Select_subquery_boolean_empty(async); + await base.Correlated_collections_with_funky_orderby_complex_scenario1(async); AssertSql( """ -SELECT IIF(( - SELECT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` AND `w`.`Name` = 'BFG' - ORDER BY `w`.`Id`) IS NULL, FALSE, ( - SELECT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` AND `w`.`Name` = 'BFG' - ORDER BY `w`.`Id`)) +SELECT `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `s0`.`Id`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`Id0`, `s0`.`Nickname0`, `s0`.`HasSoulPatch`, `s0`.`SquadId0` FROM ( - SELECT `g`.`FullName` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`FullName` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` 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` + FROM ((`Weapons` AS `w` + LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `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`) + LEFT JOIN ( + SELECT `g1`.`Nickname`, `g1`.`SquadId`, `g1`.`HasSoulPatch` + FROM `Gears` AS `g1` + UNION ALL + SELECT `o1`.`Nickname`, `o1`.`SquadId`, `o1`.`HasSoulPatch` + 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` """); } - public override async Task Select_subquery_boolean_empty_with_pushdown(bool async) + public override async Task Correlated_collections_with_funky_orderby_complex_scenario2(bool async) { - await base.Select_subquery_boolean_empty_with_pushdown(async); + await base.Correlated_collections_with_funky_orderby_complex_scenario2(async); AssertSql( """ -SELECT ( - SELECT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` AND `w`.`Name` = 'BFG' - ORDER BY `w`.`Id`) +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` FROM ( - SELECT `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`FullName` + 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` + FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` + 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` + FROM ((`Weapons` AS `w` + LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o1`.`Nickname`, `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`) + LEFT JOIN ( + SELECT `g1`.`Nickname`, `g1`.`SquadId`, `g1`.`HasSoulPatch` + FROM `Gears` AS `g1` + UNION ALL + SELECT `o2`.`Nickname`, `o2`.`SquadId`, `o2`.`HasSoulPatch` + 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 NOT (`u`.`HasSoulPatch`), `u`.`LeaderNickname`, `u`.`FullName`, `u`.`Nickname`, `u`.`SquadId`, `s1`.`FullName`, NOT (`s1`.`HasSoulPatch0`) DESC, `s1`.`Nickname`, `s1`.`SquadId`, NOT (`s1`.`IsAutomatic`), `s1`.`Name` DESC, `s1`.`Id`, `s1`.`Nickname0`, `s1`.`SquadId0`, `s1`.`Id0`, `s1`.`Nickname00` """); } - public override async Task Select_subquery_distinct_singleordefault_boolean1(bool async) + public override async Task Correlated_collection_with_top_level_FirstOrDefault(bool async) { - await base.Select_subquery_distinct_singleordefault_boolean1(async); + await base.Correlated_collection_with_top_level_FirstOrDefault(async); AssertSql( -""" -SELECT COALESCE(( - SELECT TOP(1) [t0].[IsAutomatic] - FROM ( - SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') - ) AS [t0]), CAST(0 AS bit)) + """ +SELECT `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM ( - SELECT [g].[FullName], [g].[HasSoulPatch] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[FullName], [o].[HasSoulPatch] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) + SELECT TOP 1 `u`.`Nickname`, `u`.`SquadId`, `u`.`FullName` + FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` + ) AS `u` + ORDER BY `u`.`Nickname` +) AS `u0` +LEFT JOIN `Weapons` AS `w` ON `u0`.`FullName` = `w`.`OwnerFullName` +ORDER BY `u0`.`Nickname`, `u0`.`SquadId` """); } - public override async Task Select_subquery_distinct_singleordefault_boolean2(bool async) + public override async Task Correlated_collection_with_top_level_Count(bool async) { - await base.Select_subquery_distinct_singleordefault_boolean2(async); + await base.Correlated_collection_with_top_level_Count(async); AssertSql( """ -SELECT IIF(( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%')) IS NULL, FALSE, ( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%'))) +SELECT COUNT(*) FROM ( - SELECT `g`.`FullName`, `g`.`HasSoulPatch` + SELECT 1 FROM `Gears` AS `g` UNION ALL - SELECT `o`.`FullName`, `o`.`HasSoulPatch` + SELECT 1 FROM `Officers` AS `o` ) AS `u` -WHERE `u`.`HasSoulPatch` = TRUE """); } - public override async Task Select_subquery_distinct_singleordefault_boolean_with_pushdown(bool async) + public override async Task Correlated_collection_with_top_level_Last_with_orderby_on_outer(bool async) { - await base.Select_subquery_distinct_singleordefault_boolean_with_pushdown(async); + await base.Correlated_collection_with_top_level_Last_with_orderby_on_outer(async); AssertSql( -""" -SELECT ( - SELECT TOP(1) [t0].[IsAutomatic] - FROM ( - SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') - ) AS [t0]) + """ +SELECT `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM ( - SELECT [g].[FullName], [g].[HasSoulPatch] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[FullName], [o].[HasSoulPatch] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) + SELECT TOP 1 `u`.`Nickname`, `u`.`SquadId`, `u`.`FullName` + FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` + ) AS `u` + ORDER BY `u`.`FullName` +) AS `u0` +LEFT JOIN `Weapons` AS `w` ON `u0`.`FullName` = `w`.`OwnerFullName` +ORDER BY `u0`.`FullName`, `u0`.`Nickname`, `u0`.`SquadId` """); } - public override async Task Select_subquery_distinct_singleordefault_boolean_empty1(bool async) + public override async Task Correlated_collection_with_top_level_Last_with_order_by_on_inner(bool async) { - await base.Select_subquery_distinct_singleordefault_boolean_empty1(async); + await base.Correlated_collection_with_top_level_Last_with_order_by_on_inner(async); AssertSql( -""" -SELECT COALESCE(( - SELECT TOP(1) [t0].[IsAutomatic] - FROM ( - SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG' - ) AS [t0]), CAST(0 AS bit)) + """ +SELECT `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM ( - SELECT [g].[FullName], [g].[HasSoulPatch] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[FullName], [o].[HasSoulPatch] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) + SELECT TOP 1 `u`.`Nickname`, `u`.`SquadId`, `u`.`FullName` + FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` + ) AS `u` + ORDER BY `u`.`FullName` DESC +) AS `u0` +LEFT JOIN `Weapons` AS `w` ON `u0`.`FullName` = `w`.`OwnerFullName` +ORDER BY `u0`.`FullName` DESC, `u0`.`Nickname`, `u0`.`SquadId`, `w`.`Name` """); } - public override async Task Select_subquery_distinct_singleordefault_boolean_empty2(bool async) + public override async Task Null_semantics_on_nullable_bool_from_inner_join_subquery_is_fully_applied(bool async) { - await base.Select_subquery_distinct_singleordefault_boolean_empty2(async); + await base.Null_semantics_on_nullable_bool_from_inner_join_subquery_is_fully_applied(async); AssertSql( """ -SELECT IIF(( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` AND `w`.`Name` = 'BFG') IS NULL, FALSE, ( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` AND `w`.`Name` = 'BFG')) +SELECT `l2`.`Id`, `l2`.`CapitalName`, `l2`.`Name`, `l2`.`ServerAddress`, `l2`.`CommanderName`, `l2`.`DeputyCommanderName`, `l2`.`Eradicated` FROM ( - SELECT `g`.`FullName`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` + SELECT `l`.`Name` + FROM `LocustLeaders` AS `l` UNION ALL - SELECT `o`.`FullName`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` + SELECT `l0`.`Name` + FROM `LocustCommanders` AS `l0` ) AS `u` -WHERE `u`.`HasSoulPatch` = TRUE +INNER JOIN ( + SELECT `l1`.`Id`, `l1`.`CapitalName`, `l1`.`Name`, `l1`.`ServerAddress`, `l1`.`CommanderName`, `l1`.`DeputyCommanderName`, `l1`.`Eradicated` + FROM `LocustHordes` AS `l1` + WHERE `l1`.`Name` = 'Swarm' +) AS `l2` ON `u`.`Name` = `l2`.`CommanderName` +WHERE `l2`.`Eradicated` <> TRUE OR `l2`.`Eradicated` IS NULL """); } - public override async Task Select_subquery_distinct_singleordefault_boolean_empty_with_pushdown(bool async) + public override async Task Null_semantics_on_nullable_bool_from_left_join_subquery_is_fully_applied(bool async) { - await base.Select_subquery_distinct_singleordefault_boolean_empty_with_pushdown(async); + await base.Null_semantics_on_nullable_bool_from_left_join_subquery_is_fully_applied(async); AssertSql( -""" -SELECT ( - SELECT TOP(1) [t0].[IsAutomatic] - FROM ( - SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG' - ) AS [t0]) + """ +SELECT `l2`.`Id`, `l2`.`CapitalName`, `l2`.`Name`, `l2`.`ServerAddress`, `l2`.`CommanderName`, `l2`.`DeputyCommanderName`, `l2`.`Eradicated` FROM ( - SELECT [g].[FullName], [g].[HasSoulPatch] - FROM [Gears] AS [g] + SELECT `l`.`Name` + FROM `LocustLeaders` AS `l` UNION ALL - SELECT [o].[FullName], [o].[HasSoulPatch] - FROM [Officers] AS [o] -) AS [t] -WHERE [t].[HasSoulPatch] = CAST(1 AS bit) + SELECT `l0`.`Name` + FROM `LocustCommanders` AS `l0` +) AS `u` +LEFT JOIN ( + SELECT `l1`.`Id`, `l1`.`CapitalName`, `l1`.`Name`, `l1`.`ServerAddress`, `l1`.`CommanderName`, `l1`.`DeputyCommanderName`, `l1`.`Eradicated` + FROM `LocustHordes` AS `l1` + WHERE `l1`.`Name` = 'Swarm' +) AS `l2` ON `u`.`Name` = `l2`.`CommanderName` +WHERE `l2`.`Eradicated` <> TRUE OR `l2`.`Eradicated` IS NULL """); } - public override async Task Cast_subquery_to_base_type_using_typed_ToList(bool async) + public override async Task Include_on_derived_type_with_order_by_and_paging(bool async) { - await base.Cast_subquery_to_base_type_using_typed_ToList(async); + await base.Include_on_derived_type_with_order_by_and_paging(async); AssertSql( """ -SELECT `c`.`Name`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Nickname`, `u`.`Rank`, `u`.`SquadId` -FROM `Cities` AS `c` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank` - FROM `Officers` AS `o` -) AS `u` ON `c`.`Name` = `u`.`AssignedCityName` -WHERE `c`.`Name` = 'Ephyra' -ORDER BY `c`.`Name`, `u`.`Nickname` +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` +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` + FROM (( + SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l` + UNION ALL + SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l0` + ) AS `u` + LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` + ) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId`) + LEFT JOIN `Tags` AS `t` ON (`u0`.`Nickname` = `t`.`GearNickName` OR (`u0`.`Nickname` IS NULL AND `t`.`GearNickName` IS NULL)) AND (`u0`.`SquadId` = `t`.`GearSquadId` OR (`u0`.`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` """); } - public override async Task Cast_ordered_subquery_to_base_type_using_typed_ToArray(bool async) + public override async Task Select_required_navigation_on_derived_type(bool async) { - await base.Cast_ordered_subquery_to_base_type_using_typed_ToArray(async); + await base.Select_required_navigation_on_derived_type(async); AssertSql( """ -SELECT `c`.`Name`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Nickname`, `u`.`Rank`, `u`.`SquadId` -FROM `Cities` AS `c` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` - FROM `Gears` AS `g` +SELECT `l1`.`Name` +FROM ( + SELECT CVar(NULL) AS `HighCommandId` + FROM `LocustLeaders` AS `l` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank` - FROM `Officers` AS `o` -) AS `u` ON `c`.`Name` = `u`.`AssignedCityName` -WHERE `c`.`Name` = 'Ephyra' -ORDER BY `c`.`Name`, `u`.`Nickname` DESC + SELECT `l0`.`HighCommandId` + FROM `LocustCommanders` AS `l0` +) AS `u` +LEFT JOIN `LocustHighCommands` AS `l1` ON IIF(`u`.`HighCommandId` IS NULL, NULL, CLNG(`u`.`HighCommandId`)) = `l1`.`Id` """); } - public override async Task Correlated_collection_with_complex_order_by_funcletized_to_constant_bool(bool async) + public override async Task Select_required_navigation_on_the_same_type_with_cast(bool async) { - await base.Correlated_collection_with_complex_order_by_funcletized_to_constant_bool(async); + await base.Select_required_navigation_on_the_same_type_with_cast(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `w`.`Name`, `w`.`Id` +SELECT `c`.`Name` FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + SELECT `g`.`CityOfBirthName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + SELECT `o`.`CityOfBirthName` FROM `Officers` AS `o` ) AS `u` -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` -ORDER BY `u`.`Nickname`, `u`.`SquadId` -"""); - } - - public override async Task Double_order_by_on_nullable_bool_coming_from_optional_navigation(bool async) - { - await base.Double_order_by_on_nullable_bool_coming_from_optional_navigation(async); - - AssertSql( -""" -SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` -FROM `Weapons` AS `w` -LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id` +INNER JOIN `Cities` AS `c` ON `u`.`CityOfBirthName` = `c`.`Name` """); } - public override async Task Double_order_by_on_Like(bool async) + public override async Task Where_required_navigation_on_derived_type(bool async) { - await base.Double_order_by_on_Like(async); + await base.Where_required_navigation_on_derived_type(async); AssertSql( """ -SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` -FROM `Weapons` AS `w` -LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (IIF((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL, TRUE, FALSE)) +SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` +FROM ( + SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l` + UNION ALL + SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l0` +) AS `u` +LEFT JOIN `LocustHighCommands` AS `l1` ON IIF(`u`.`HighCommandId` IS NULL, NULL, CLNG(`u`.`HighCommandId`)) = `l1`.`Id` +WHERE `l1`.`IsOperational` = TRUE """); } - public override async Task Double_order_by_on_is_null(bool async) + public override async Task Outer_parameter_in_join_key(bool async) { - await base.Double_order_by_on_is_null(async); + await base.Outer_parameter_in_join_key(async); AssertSql( """ -SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` -FROM `Weapons` AS `w` -LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (IIF(`w0`.`Name` IS NULL, TRUE, FALSE)) +SELECT [t].[Nickname], [t].[SquadId], [t1].[Note], [t1].[Id], [t1].[Nickname], [t1].[SquadId] +FROM ( + SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] + FROM [Officers] AS [o] +) AS [t] +OUTER APPLY ( + SELECT [t0].[Note], [t0].[Id], [t2].[Nickname], [t2].[SquadId] + FROM [Tags] AS [t0] + INNER 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 [t2] ON [t].[FullName] = [t2].[FullName] +) AS [t1] +ORDER BY [t].[Nickname], [t].[SquadId], [t1].[Id], [t1].[Nickname] """); } - public override async Task Double_order_by_on_string_compare(bool async) + public override async Task Outer_parameter_in_join_key_inner_and_outer(bool async) { - await base.Double_order_by_on_string_compare(async); + await base.Outer_parameter_in_join_key_inner_and_outer(async); AssertSql( """ -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -ORDER BY NOT (IIF(`w`.`Name` = 'Marcus'' Lancer' AND `w`.`Name` IS NOT NULL, TRUE, FALSE)), `w`.`Id` +SELECT [t].[Nickname], [t].[SquadId], [t1].[Note], [t1].[Id], [t1].[Nickname], [t1].[SquadId] +FROM ( + SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] + FROM [Officers] AS [o] +) AS [t] +OUTER APPLY ( + SELECT [t0].[Note], [t0].[Id], [t2].[Nickname], [t2].[SquadId] + FROM [Tags] AS [t0] + INNER JOIN ( + SELECT [g].[Nickname], [g].[SquadId] + FROM [Gears] AS [g] + UNION ALL + SELECT [o0].[Nickname], [o0].[SquadId] + FROM [Officers] AS [o0] + ) AS [t2] ON [t].[FullName] = [t].[Nickname] +) AS [t1] +ORDER BY [t].[Nickname], [t].[SquadId], [t1].[Id], [t1].[Nickname] """); } - public override async Task Double_order_by_binary_expression(bool async) + public override async Task Outer_parameter_in_group_join_with_DefaultIfEmpty(bool async) { - await base.Double_order_by_binary_expression(async); + await base.Outer_parameter_in_group_join_with_DefaultIfEmpty(async); AssertSql( - """ -SELECT `w0`.`Binary` +""" +SELECT [t].[Nickname], [t].[SquadId], [t1].[Note], [t1].[Id], [t1].[Nickname], [t1].[SquadId] FROM ( - SELECT `w`.`Id` + 2 AS `Binary` - FROM `Weapons` AS `w` -) AS `w0` -ORDER BY `w0`.`Binary` + SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] + FROM [Officers] AS [o] +) AS [t] +OUTER APPLY ( + SELECT [t0].[Note], [t0].[Id], [t2].[Nickname], [t2].[SquadId] + FROM [Tags] AS [t0] + 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 [t2] ON [t].[FullName] = [t2].[FullName] +) AS [t1] +ORDER BY [t].[Nickname], [t].[SquadId], [t1].[Id], [t1].[Nickname] """); } - public override async Task String_compare_with_null_conditional_argument(bool async) + public override async Task Negated_bool_ternary_inside_anonymous_type_in_projection(bool async) { - await base.String_compare_with_null_conditional_argument(async); + await base.Negated_bool_ternary_inside_anonymous_type_in_projection(async); AssertSql( -""" -SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` -FROM `Weapons` AS `w` -LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (IIF(`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL, TRUE, FALSE)) + """ +SELECT IIF(`u`.`HasSoulPatch` = TRUE, TRUE, IIF(`u`.`HasSoulPatch` IS NULL, TRUE, `u`.`HasSoulPatch`)) BXOR TRUE AS `c` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` """); } - public override async Task String_compare_with_null_conditional_argument2(bool async) + public override async Task Order_by_entity_qsre(bool async) { - await base.String_compare_with_null_conditional_argument2(async); + await base.Order_by_entity_qsre(async); AssertSql( -""" -SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` -FROM `Weapons` AS `w` -LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (IIF('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL, TRUE, FALSE)) + """ +SELECT `u`.`FullName` +FROM ( + SELECT `g`.`Nickname`, `g`.`AssignedCityName`, `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`AssignedCityName`, `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name` +ORDER BY `c`.`Name`, `u`.`Nickname` DESC """); } - public override async Task String_concat_with_null_conditional_argument(bool async) + public override async Task Order_by_entity_qsre_with_inheritance(bool async) { - await base.String_concat_with_null_conditional_argument(async); + await base.Order_by_entity_qsre_with_inheritance(async); AssertSql( -""" -SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` -FROM `Weapons` AS `w` -LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & (5 & '') + """ +SELECT `u`.`Name` +FROM ( + SELECT `l`.`Name`, `l`.`HighCommandId` + FROM `LocustCommanders` AS `l` +) AS `u` +INNER JOIN `LocustHighCommands` AS `l0` ON `u`.`HighCommandId` = `l0`.`Id` +ORDER BY `l0`.`Id`, `u`.`Name` """); } - public override async Task String_concat_with_null_conditional_argument2(bool async) + public override async Task Order_by_entity_qsre_composite_key(bool async) { - await base.String_concat_with_null_conditional_argument2(async); + await base.Order_by_entity_qsre_composite_key(async); AssertSql( -""" -SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` + """ +SELECT `w`.`Name` FROM `Weapons` AS `w` -LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & 'Marcus'' Lancer' +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` ON `w`.`OwnerFullName` = `u`.`FullName` +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `w`.`Id` """); } - public override async Task String_concat_on_various_types(bool async) + public override async Task Order_by_entity_qsre_with_other_orderbys(bool async) { - await base.String_concat_on_various_types(async); + await base.Order_by_entity_qsre_with_other_orderbys(async); AssertSql( """ -SELECT ('HasSoulPatch ' & (`u`.`HasSoulPatch` & '')) & ' HasSoulPatch' AS `HasSoulPatch`, ('Rank ' & (`u`.`Rank` & '')) & ' Rank' AS `Rank`, ('SquadId ' & (`u`.`SquadId` & '')) & ' SquadId' AS `SquadId`, ('Rating ' & IIF((`m`.`Rating` & '') IS NULL, '', (`m`.`Rating` & ''))) & ' Rating' AS `Rating`, ('Timeline ' & (`m`.`Timeline` & '')) & ' Timeline' AS `Timeline` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch`, `g`.`Rank` +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM (`Weapons` AS `w` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch`, `o`.`Rank` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` -) AS `u`, -`Missions` AS `m` -ORDER BY `u`.`Nickname`, `m`.`Id` +) AS `u` ON `w`.`OwnerFullName` = `u`.`FullName`) +LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +ORDER BY NOT (`w`.`IsAutomatic`), `u`.`Nickname` DESC, `u`.`SquadId` DESC, `w0`.`Id`, `w`.`Name` """); } - public override async Task Time_of_day_datetimeoffset(bool async) + public override async Task Join_on_entity_qsre_keys(bool async) { - await base.Time_of_day_datetimeoffset(async); + await base.Join_on_entity_qsre_keys(async); AssertSql( - """ -SELECT TIMEVALUE(`m`.`Timeline`) -FROM `Missions` AS `m` +""" +SELECT `w`.`Name` AS `Name1`, `w0`.`Name` AS `Name2` +FROM `Weapons` AS `w` +INNER JOIN `Weapons` AS `w0` ON `w`.`Id` = `w0`.`Id` """); } - public override async Task GroupBy_Property_Include_Select_Average(bool async) + public override async Task Join_on_entity_qsre_keys_composite_key(bool async) { - await base.GroupBy_Property_Include_Select_Average(async); + await base.Join_on_entity_qsre_keys_composite_key(async); AssertSql( """ -SELECT AVG(CDBL(`u`.`SquadId`)) +SELECT `u`.`FullName` AS `GearName1`, `u0`.`FullName` AS `GearName2` FROM ( - SELECT `g`.`SquadId`, `g`.`Rank` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`SquadId`, `o`.`Rank` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` ) AS `u` -GROUP BY `u`.`Rank` +INNER JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName` + FROM `Officers` AS `o0` +) AS `u0` ON `u`.`Nickname` = `u0`.`Nickname` AND `u`.`SquadId` = `u0`.`SquadId` """); } - public override async Task GroupBy_Property_Include_Select_Sum(bool async) + public override async Task Join_on_entity_qsre_keys_inheritance(bool async) { - await base.GroupBy_Property_Include_Select_Sum(async); + await base.Join_on_entity_qsre_keys_inheritance(async); AssertSql( """ -SELECT IIF(SUM(`u`.`SquadId`) IS NULL, 0, SUM(`u`.`SquadId`)) +SELECT `u`.`FullName` AS `GearName`, `u0`.`FullName` AS `OfficerName` FROM ( - SELECT `g`.`SquadId`, `g`.`Rank` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`SquadId`, `o`.`Rank` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` ) AS `u` -GROUP BY `u`.`Rank` +INNER JOIN ( + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`FullName` + FROM `Officers` AS `o0` +) AS `u0` ON `u`.`Nickname` = `u0`.`Nickname` AND `u`.`SquadId` = `u0`.`SquadId` """); } - public override async Task GroupBy_Property_Include_Select_Count(bool async) + public override async Task Join_on_entity_qsre_keys_outer_key_is_navigation(bool async) { - await base.GroupBy_Property_Include_Select_Count(async); + await base.Join_on_entity_qsre_keys_outer_key_is_navigation(async); AssertSql( """ -SELECT COUNT(*) -FROM ( - SELECT `g`.`Rank` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Rank` - FROM `Officers` AS `o` -) AS `u` -GROUP BY `u`.`Rank` +SELECT `w`.`Name` AS `Name1`, `w1`.`Name` AS `Name2` +FROM (`Weapons` AS `w` +LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id`) +LEFT JOIN `Weapons` AS `w1` ON `w0`.`Id` = `w1`.`Id` +WHERE `w0`.`Id` IS NOT NULL AND `w1`.`Id` IS NOT NULL """); } - public override async Task GroupBy_Property_Include_Select_LongCount(bool async) + public override async Task Join_on_entity_qsre_keys_inner_key_is_navigation(bool async) { - await base.GroupBy_Property_Include_Select_LongCount(async); + await base.Join_on_entity_qsre_keys_inner_key_is_navigation(async); AssertSql( """ -SELECT COUNT(*) +SELECT `c`.`Name` AS `CityName`, `s`.`Nickname` AS `GearNickname` +FROM `Cities` AS `c` +INNER JOIN ( + SELECT `u`.`Nickname`, `c0`.`Name` + FROM ( + SELECT `g`.`Nickname`, `g`.`AssignedCityName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`AssignedCityName` + FROM `Officers` AS `o` + ) AS `u` + LEFT JOIN `Cities` AS `c0` ON `u`.`AssignedCityName` = `c0`.`Name` +) AS `s` ON `c`.`Name` = `s`.`Name` +"""); + } + + public override async Task Join_on_entity_qsre_keys_inner_key_is_navigation_composite_key(bool async) + { + await base.Join_on_entity_qsre_keys_inner_key_is_navigation_composite_key(async); + + AssertSql( + """ +SELECT `u`.`Nickname`, `s`.`Note` FROM ( - SELECT `g`.`Rank` + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Rank` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` ) AS `u` -GROUP BY `u`.`Rank` +INNER JOIN ( + SELECT `t`.`Note`, `u0`.`Nickname`, `u0`.`SquadId` + FROM `Tags` AS `t` + LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId` + FROM `Officers` AS `o0` + ) AS `u0` ON `t`.`GearNickName` = `u0`.`Nickname` AND `t`.`GearSquadId` = `u0`.`SquadId` + WHERE `t`.`Note` IN ('Cole''s Tag', 'Dom''s Tag') +) AS `s` ON `u`.`Nickname` = `s`.`Nickname` AND `u`.`SquadId` = `s`.`SquadId` """); } - public override async Task GroupBy_Property_Include_Select_Min(bool async) + public override async Task Join_on_entity_qsre_keys_inner_key_is_nested_navigation(bool async) { - await base.GroupBy_Property_Include_Select_Min(async); + await base.Join_on_entity_qsre_keys_inner_key_is_nested_navigation(async); AssertSql( """ -SELECT MIN(`u`.`SquadId`) -FROM ( - SELECT `g`.`SquadId`, `g`.`Rank` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`SquadId`, `o`.`Rank` - FROM `Officers` AS `o` -) AS `u` -GROUP BY `u`.`Rank` +SELECT `s`.`Name` AS `SquadName`, `s1`.`Name` AS `WeaponName` +FROM `Squads` AS `s` +INNER JOIN ( + SELECT `w`.`Name`, `s0`.`Id` AS `Id0` + FROM (`Weapons` AS `w` + LEFT JOIN ( + SELECT `g`.`SquadId`, `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` + ) AS `u` ON `w`.`OwnerFullName` = `u`.`FullName`) + LEFT JOIN `Squads` AS `s0` ON `u`.`SquadId` = `s0`.`Id` + WHERE `w`.`IsAutomatic` = TRUE +) AS `s1` ON `s`.`Id` = `s1`.`Id0` """); } - public override async Task GroupBy_Property_Include_Aggregate_with_anonymous_selector(bool async) + public override async Task GroupJoin_on_entity_qsre_keys_inner_key_is_nested_navigation(bool async) { - await base.GroupBy_Property_Include_Aggregate_with_anonymous_selector(async); + await base.GroupJoin_on_entity_qsre_keys_inner_key_is_nested_navigation(async); AssertSql( """ -SELECT `u`.`Nickname` AS `Key`, COUNT(*) AS `c` -FROM ( - SELECT `g`.`Nickname` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname` - FROM `Officers` AS `o` -) AS `u` -GROUP BY `u`.`Nickname` -ORDER BY `u`.`Nickname` +SELECT `s`.`Name` AS `SquadName`, `s1`.`Name` AS `WeaponName` +FROM `Squads` AS `s` +LEFT JOIN ( + SELECT `w`.`Name`, `s0`.`Id` AS `Id0` + FROM (`Weapons` AS `w` + LEFT JOIN ( + SELECT `g`.`SquadId`, `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` + ) AS `u` ON `w`.`OwnerFullName` = `u`.`FullName`) + LEFT JOIN `Squads` AS `s0` ON `u`.`SquadId` = `s0`.`Id` +) AS `s1` ON `s`.`Id` = `s1`.`Id0` """); } - public override async Task Group_by_with_include_with_entity_in_result_selector(bool async) + public override async Task Streaming_correlated_collection_issue_11403(bool async) { - await base.Group_by_with_include_with_entity_in_result_selector(async); + await base.Streaming_correlated_collection_issue_11403(async); AssertSql( -""" -SELECT [t0].[Rank], [t0].[c], [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator], [t1].[Name], [t1].[Location], [t1].[Nation] + """ +SELECT `u0`.`Nickname`, `u0`.`SquadId`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` FROM ( - SELECT [t].[Rank], COUNT(*) AS [c] + SELECT TOP 1 `u`.`Nickname`, `u`.`SquadId`, `u`.`FullName` FROM ( - SELECT [g].[Rank] - FROM [Gears] AS [g] + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + FROM `Gears` AS `g` UNION ALL - SELECT [o].[Rank] - FROM [Officers] AS [o] - ) AS [t] - GROUP BY [t].[Rank] -) AS [t0] + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` + ) AS `u` + ORDER BY `u`.`Nickname` +) AS `u0` LEFT JOIN ( - SELECT [t2].[Nickname], [t2].[SquadId], [t2].[AssignedCityName], [t2].[CityOfBirthName], [t2].[FullName], [t2].[HasSoulPatch], [t2].[LeaderNickname], [t2].[LeaderSquadId], [t2].[Rank], [t2].[Discriminator], [t2].[Name], [t2].[Location], [t2].[Nation] - FROM ( - SELECT [t3].[Nickname], [t3].[SquadId], [t3].[AssignedCityName], [t3].[CityOfBirthName], [t3].[FullName], [t3].[HasSoulPatch], [t3].[LeaderNickname], [t3].[LeaderSquadId], [t3].[Rank], [t3].[Discriminator], [c].[Name], [c].[Location], [c].[Nation], ROW_NUMBER() OVER(PARTITION BY [t3].[Rank] ORDER BY [t3].[Nickname]) AS [row] + SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + FROM `Weapons` AS `w` + WHERE `w`.`IsAutomatic` = FALSE +) AS `w0` ON `u0`.`FullName` = `w0`.`OwnerFullName` +ORDER BY `u0`.`Nickname`, `u0`.`SquadId`, `w0`.`Id` +"""); + } + + public override async Task Project_one_value_type_from_empty_collection(bool async) + { + await base.Project_one_value_type_from_empty_collection(async); + AssertSql( + """ +SELECT `s`.`Name`, IIF(( + SELECT TOP 1 `u`.`SquadId` 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] + SELECT `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` 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 [t3] - INNER JOIN [Cities] AS [c] ON [t3].[CityOfBirthName] = [c].[Name] - ) AS [t2] - WHERE [t2].[row] <= 1 -) AS [t1] ON [t0].[Rank] = [t1].[Rank] -ORDER BY [t0].[Rank] + SELECT `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` + ) AS `u` + WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE) IS NULL, 0, ( + SELECT TOP 1 `u`.`SquadId` + FROM ( + SELECT `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` + ) AS `u` + WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE)) AS `SquadId` +FROM `Squads` AS `s` +WHERE `s`.`Name` = 'Kilo' """); } - public override async Task GroupBy_Property_Include_Select_Max(bool async) + public override async Task Project_one_value_type_converted_to_nullable_from_empty_collection(bool async) { - await base.GroupBy_Property_Include_Select_Max(async); - + await base.Project_one_value_type_converted_to_nullable_from_empty_collection(async); AssertSql( """ -SELECT MAX(`u`.`SquadId`) -FROM ( - SELECT `g`.`SquadId`, `g`.`Rank` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`SquadId`, `o`.`Rank` - FROM `Officers` AS `o` -) AS `u` -GROUP BY `u`.`Rank` +SELECT `s`.`Name`, ( + SELECT TOP 1 `u`.`SquadId` + FROM ( + SELECT `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` + ) AS `u` + WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE) AS `SquadId` +FROM `Squads` AS `s` +WHERE `s`.`Name` = 'Kilo' """); } - public override async Task Include_with_group_by_and_FirstOrDefault_gets_properly_applied(bool async) + public override async Task Project_one_value_type_with_client_projection_from_empty_collection(bool async) { - await base.Include_with_group_by_and_FirstOrDefault_gets_properly_applied(async); + await base.Project_one_value_type_with_client_projection_from_empty_collection(async); AssertSql( """ -SELECT [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator], [t1].[Name], [t1].[Location], [t1].[Nation] -FROM ( - SELECT [t].[Rank] - FROM ( - SELECT [g].[Rank] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Rank] - FROM [Officers] AS [o] - ) AS [t] - GROUP BY [t].[Rank] -) AS [t0] +SELECT [s].[Name], [t1].[SquadId], [t1].[LeaderSquadId], [t1].[c] +FROM [Squads] AS [s] LEFT JOIN ( - SELECT [t2].[Nickname], [t2].[SquadId], [t2].[AssignedCityName], [t2].[CityOfBirthName], [t2].[FullName], [t2].[HasSoulPatch], [t2].[LeaderNickname], [t2].[LeaderSquadId], [t2].[Rank], [t2].[Discriminator], [t2].[Name], [t2].[Location], [t2].[Nation] + SELECT [t0].[SquadId], [t0].[LeaderSquadId], [t0].[c] FROM ( - SELECT [t3].[Nickname], [t3].[SquadId], [t3].[AssignedCityName], [t3].[CityOfBirthName], [t3].[FullName], [t3].[HasSoulPatch], [t3].[LeaderNickname], [t3].[LeaderSquadId], [t3].[Rank], [t3].[Discriminator], [c].[Name], [c].[Location], [c].[Nation], ROW_NUMBER() OVER(PARTITION BY [t3].[Rank] ORDER BY [t3].[Nickname], [t3].[SquadId], [c].[Name]) AS [row] + SELECT [t].[SquadId], [t].[LeaderSquadId], 1 AS [c], ROW_NUMBER() OVER(PARTITION BY [t].[SquadId] ORDER BY [t].[Nickname], [t].[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] + SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch], [g].[LeaderSquadId] + FROM [Gears] AS [g] 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 [t3] - INNER JOIN [Cities] AS [c] ON [t3].[CityOfBirthName] = [c].[Name] - WHERE [t3].[HasSoulPatch] = CAST(1 AS bit) - ) AS [t2] - WHERE [t2].[row] <= 1 -) AS [t1] ON [t0].[Rank] = [t1].[Rank] + SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch], [o].[LeaderSquadId] + FROM [Officers] AS [o] + ) AS [t] + WHERE [t].[HasSoulPatch] = CAST(1 AS bit) + ) AS [t0] + WHERE [t0].[row] <= 1 +) AS [t1] ON [s].[Id] = [t1].[SquadId] +WHERE [s].[Name] = N'Kilo' """); } - public override async Task Include_collection_with_Cast_to_base(bool async) + public override async Task Filter_on_subquery_projecting_one_value_type_from_empty_collection(bool async) { - await base.Include_collection_with_Cast_to_base(async); + await base.Filter_on_subquery_projecting_one_value_type_from_empty_collection(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM ( - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` -ORDER BY `u`.`Nickname`, `u`.`SquadId` +SELECT `s`.`Name` +FROM `Squads` AS `s` +WHERE `s`.`Name` = 'Kilo' AND IIF(( + SELECT TOP 1 `u`.`SquadId` + FROM ( + SELECT `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` + ) AS `u` + WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE) IS NULL, 0, ( + SELECT TOP 1 `u`.`SquadId` + FROM ( + SELECT `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` + ) AS `u` + WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE)) <> 0 """); } - public override async Task Include_with_client_method_and_member_access_still_applies_includes(bool async) + public override async Task Select_subquery_projecting_single_constant_int(bool async) { - await base.Include_with_client_method_and_member_access_still_applies_includes(async); + await base.Select_subquery_projecting_single_constant_int(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` +SELECT `s`.`Name`, IIF(( + SELECT TOP 1 42 + FROM ( + SELECT `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` + ) AS `u` + WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE) IS NULL, 0, ( + SELECT TOP 1 42 + FROM ( + SELECT `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` + ) AS `u` + WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE)) AS `Gear` +FROM `Squads` AS `s` """); } - public override async Task Include_with_projection_of_unmapped_property_still_gets_applied(bool async) + public override async Task Select_subquery_projecting_single_constant_string(bool async) { - await base.Include_with_projection_of_unmapped_property_still_gets_applied(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` -ORDER BY `u`.`Nickname`, `u`.`SquadId` -"""); - } + await base.Select_subquery_projecting_single_constant_string(async); - public override async Task Multiple_includes_with_client_method_around_entity_and_also_projecting_included_collection() - { - await base.Multiple_includes_with_client_method_around_entity_and_also_projecting_included_collection(); AssertSql( """ -SELECT `s`.`Name`, `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`AssignedCityName`, `s0`.`CityOfBirthName`, `s0`.`FullName`, `s0`.`HasSoulPatch`, `s0`.`LeaderNickname`, `s0`.`LeaderSquadId`, `s0`.`Rank`, `s0`.`Discriminator`, `s0`.`Id`, `s0`.`AmmunitionType`, `s0`.`IsAutomatic`, `s0`.`Name`, `s0`.`OwnerFullName`, `s0`.`SynergyWithId` -FROM `Squads` AS `s` -LEFT JOIN ( - SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +SELECT `s`.`Name`, ( + SELECT TOP 1 'Foo' FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g`.`SquadId`, `g`.`HasSoulPatch` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`SquadId`, `o`.`HasSoulPatch` FROM `Officers` AS `o` ) AS `u` - LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` -) AS `s0` ON `s`.`Id` = `s0`.`SquadId` -WHERE `s`.`Name` = 'Delta' -ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` + WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE) AS `Gear` +FROM `Squads` AS `s` """); } - public override async Task OrderBy_same_expression_containing_IsNull_correctly_deduplicates_the_ordering(bool async) + public override async Task Select_subquery_projecting_single_constant_bool(bool async) { - await base.OrderBy_same_expression_containing_IsNull_correctly_deduplicates_the_ordering(async); + await base.Select_subquery_projecting_single_constant_bool(async); AssertSql( """ -SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, CBOOL(IIF(LEN(`u`.`Nickname`) IS NULL, NULL, CLNG(LEN(`u`.`Nickname`))) BXOR 5) BXOR TRUE, NULL) -FROM ( - SELECT `g`.`Nickname`, `g`.`LeaderNickname` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`LeaderNickname` - FROM `Officers` AS `o` -) AS `u` -ORDER BY NOT (IIF(IIF(`u`.`LeaderNickname` IS NOT NULL, CBOOL(IIF(LEN(`u`.`Nickname`) IS NULL, NULL, CLNG(LEN(`u`.`Nickname`))) BXOR 5) BXOR TRUE, NULL) IS NOT NULL, TRUE, FALSE)) +SELECT `s`.`Name`, IIF(( + SELECT TOP 1 TRUE + FROM ( + SELECT `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` + ) AS `u` + WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE) IS NULL, FALSE, ( + SELECT TOP 1 TRUE + FROM ( + SELECT `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` + ) AS `u` + WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE)) AS `Gear` +FROM `Squads` AS `s` """); } - public override async Task GetValueOrDefault_in_projection(bool async) + public override async Task Select_subquery_projecting_single_constant_inside_anonymous(bool async) { - await base.GetValueOrDefault_in_projection(async); + await base.Select_subquery_projecting_single_constant_inside_anonymous(async); AssertSql( """ -SELECT IIF(`w`.`SynergyWithId` IS NULL, 0, `w`.`SynergyWithId`) -FROM `Weapons` AS `w` +SELECT [s].[Name], [t1].[One] +FROM [Squads] AS [s] +LEFT JOIN ( + SELECT [t0].[One], [t0].[SquadId] + FROM ( + SELECT 1 AS [One], [t].[SquadId], ROW_NUMBER() OVER(PARTITION BY [t].[SquadId] ORDER BY [t].[Nickname], [t].[SquadId]) AS [row] + FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] + FROM [Officers] AS [o] + ) AS [t] + WHERE [t].[HasSoulPatch] = CAST(1 AS bit) + ) AS [t0] + WHERE [t0].[row] <= 1 +) AS [t1] ON [s].[Id] = [t1].[SquadId] """); } - public override async Task GetValueOrDefault_in_filter(bool async) + public override async Task Select_subquery_projecting_multiple_constants_inside_anonymous(bool async) { - await base.GetValueOrDefault_in_filter(async); + await base.Select_subquery_projecting_multiple_constants_inside_anonymous(async); AssertSql( """ -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -WHERE IIF(`w`.`SynergyWithId` IS NULL, 0, `w`.`SynergyWithId`) = 0 +SELECT [s].[Name], [t1].[True1], [t1].[False1], [t1].[c] +FROM [Squads] AS [s] +LEFT JOIN ( + SELECT [t0].[True1], [t0].[False1], [t0].[c], [t0].[SquadId] + FROM ( + SELECT CAST(1 AS bit) AS [True1], CAST(0 AS bit) AS [False1], 1 AS [c], [t].[SquadId], ROW_NUMBER() OVER(PARTITION BY [t].[SquadId] ORDER BY [t].[Nickname], [t].[SquadId]) AS [row] + FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] + FROM [Officers] AS [o] + ) AS [t] + WHERE [t].[HasSoulPatch] = CAST(1 AS bit) + ) AS [t0] + WHERE [t0].[row] <= 1 +) AS [t1] ON [s].[Id] = [t1].[SquadId] """); } - public override async Task GetValueOrDefault_in_filter_non_nullable_column(bool async) + public override async Task Include_with_order_by_constant(bool async) { - await base.GetValueOrDefault_in_filter_non_nullable_column(async); + await base.Include_with_order_by_constant(async); AssertSql( """ -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -WHERE `w`.`Id` = 0 +SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name`, `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +FROM `Squads` AS `s` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` ON `s`.`Id` = `u`.`SquadId` +ORDER BY `s`.`Id`, `u`.`Nickname` """); } - public override async Task GetValueOrDefault_in_order_by(bool async) + public override async Task Correlated_collection_order_by_constant(bool async) { - await base.GetValueOrDefault_in_order_by(async); + await base.Correlated_collection_order_by_constant(async); AssertSql( -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -ORDER BY IIF(`w`.`SynergyWithId` IS NULL, 0, `w`.`SynergyWithId`), `w`.`Id` + """ +SELECT `u`.`Nickname`, `u`.`SquadId`, `w`.`Name`, `w`.`Id` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` +ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task GetValueOrDefault_with_argument(bool async) + public override async Task Select_subquery_projecting_single_constant_null_of_non_mapped_type(bool async) { - await base.GetValueOrDefault_with_argument(async); + await base.Select_subquery_projecting_single_constant_null_of_non_mapped_type(async); AssertSql( """ -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -WHERE IIF(`w`.`SynergyWithId` IS NULL, `w`.`Id`, `w`.`SynergyWithId`) = 1 +SELECT [s].[Name], [t1].[c] +FROM [Squads] AS [s] +LEFT JOIN ( + SELECT [t0].[c], [t0].[SquadId] + FROM ( + SELECT 1 AS [c], [t].[SquadId], ROW_NUMBER() OVER(PARTITION BY [t].[SquadId] ORDER BY [t].[Nickname], [t].[SquadId]) AS [row] + FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] + FROM [Officers] AS [o] + ) AS [t] + WHERE [t].[HasSoulPatch] = CAST(1 AS bit) + ) AS [t0] + WHERE [t0].[row] <= 1 +) AS [t1] ON [s].[Id] = [t1].[SquadId] """); } - public override async Task GetValueOrDefault_with_argument_complex(bool async) + public override async Task Select_subquery_projecting_single_constant_of_non_mapped_type(bool async) { - await base.GetValueOrDefault_with_argument_complex(async); + await base.Select_subquery_projecting_single_constant_of_non_mapped_type(async); AssertSql( """ -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -WHERE IIF(`w`.`SynergyWithId` IS NULL, IIF(LEN(`w`.`Name`) IS NULL, NULL, CLNG(LEN(`w`.`Name`))) + 42, `w`.`SynergyWithId`) > 10 -"""); - } - - public override async Task Filter_with_complex_predicate_containing_subquery(bool async) - { - await base.Filter_with_complex_predicate_containing_subquery(async); - - AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -WHERE `u`.`FullName` <> 'Dom' AND EXISTS ( - SELECT 1 - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` AND `w`.`IsAutomatic` = TRUE) +SELECT [s].[Name], [t1].[c] +FROM [Squads] AS [s] +LEFT JOIN ( + SELECT [t0].[c], [t0].[SquadId] + FROM ( + SELECT 1 AS [c], [t].[SquadId], ROW_NUMBER() OVER(PARTITION BY [t].[SquadId] ORDER BY [t].[Nickname], [t].[SquadId]) AS [row] + FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] + FROM [Officers] AS [o] + ) AS [t] + WHERE [t].[HasSoulPatch] = CAST(1 AS bit) + ) AS [t0] + WHERE [t0].[row] <= 1 +) AS [t1] ON [s].[Id] = [t1].[SquadId] """); } - public override async Task Query_with_complex_let_containing_ordering_and_filter_projecting_firstOrDefault_element_of_let( - bool async) + public override async Task Include_collection_OrderBy_aggregate(bool async) { - await base.Query_with_complex_let_containing_ordering_and_filter_projecting_firstOrDefault_element_of_let(async); + await base.Include_collection_OrderBy_aggregate(async); AssertSql( """ -SELECT `u`.`Nickname`, ( - SELECT TOP 1 `w`.`Name` - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` AND `w`.`IsAutomatic` = TRUE - ORDER BY `w`.`AmmunitionType` DESC) AS `WeaponName` +SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `s`.`Nickname0`, `s`.`SquadId0`, `s`.`AssignedCityName0`, `s`.`CityOfBirthName0`, `s`.`FullName0`, `s`.`HasSoulPatch0`, `s`.`LeaderNickname0`, `s`.`LeaderSquadId0`, `s`.`Rank0`, `s`.`Discriminator0`, `s`.`c` FROM ( - SELECT `g`.`Nickname`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -WHERE `u`.`Nickname` <> 'Dom' + SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname` AS `Nickname0`, `u0`.`SquadId` AS `SquadId0`, `u0`.`AssignedCityName` AS `AssignedCityName0`, `u0`.`CityOfBirthName` AS `CityOfBirthName0`, `u0`.`FullName` AS `FullName0`, `u0`.`HasSoulPatch` AS `HasSoulPatch0`, `u0`.`LeaderNickname` AS `LeaderNickname0`, `u0`.`LeaderSquadId` AS `LeaderSquadId0`, `u0`.`Rank` AS `Rank0`, `u0`.`Discriminator` AS `Discriminator0`, ( + SELECT COUNT(*) + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName`) AS `c` + FROM ( + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` + ) AS `u` + LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` + ) AS `u0` ON `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId` +) AS `s` +ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } - public override async Task - Null_semantics_is_correctly_applied_for_function_comparisons_that_take_arguments_from_optional_navigation(bool async) + public override async Task Include_collection_with_complex_OrderBy2(bool async) { - await base.Null_semantics_is_correctly_applied_for_function_comparisons_that_take_arguments_from_optional_navigation(async); + await base.Include_collection_with_complex_OrderBy2(async); AssertSql( """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE IIF(`u`.`SquadId` IS NULL, NULL, MID(`t`.`Note`, 0 + 1, `u`.`SquadId`)) = `t`.`GearNickName` OR ((`t`.`Note` IS NULL OR `u`.`SquadId` IS NULL) AND `t`.`GearNickName` IS NULL) +SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `s`.`Nickname0`, `s`.`SquadId0`, `s`.`AssignedCityName0`, `s`.`CityOfBirthName0`, `s`.`FullName0`, `s`.`HasSoulPatch0`, `s`.`LeaderNickname0`, `s`.`LeaderSquadId0`, `s`.`Rank0`, `s`.`Discriminator0`, `s`.`c` +FROM ( + SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname` AS `Nickname0`, `u0`.`SquadId` AS `SquadId0`, `u0`.`AssignedCityName` AS `AssignedCityName0`, `u0`.`CityOfBirthName` AS `CityOfBirthName0`, `u0`.`FullName` AS `FullName0`, `u0`.`HasSoulPatch` AS `HasSoulPatch0`, `u0`.`LeaderNickname` AS `LeaderNickname0`, `u0`.`LeaderSquadId` AS `LeaderSquadId0`, `u0`.`Rank` AS `Rank0`, `u0`.`Discriminator` AS `Discriminator0`, ( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`) AS `c` + FROM ( + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` + ) AS `u` + LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` + ) AS `u0` ON `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId` +) AS `s` +ORDER BY NOT (`s`.`c`), `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } - public override async Task - Null_semantics_is_correctly_applied_for_function_comparisons_that_take_arguments_from_optional_navigation_complex(bool async) + public override async Task Include_collection_with_complex_OrderBy3(bool async) { - await base.Null_semantics_is_correctly_applied_for_function_comparisons_that_take_arguments_from_optional_navigation_complex( - async); + await base.Include_collection_with_complex_OrderBy3(async); AssertSql( """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM (`Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId`) -LEFT JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id` -WHERE IIF(LEN(`s`.`Name`) IS NULL, NULL, MID(`t`.`Note`, 0 + 1, IIF(LEN(`s`.`Name`) IS NULL, NULL, CLNG(LEN(`s`.`Name`))))) = `t`.`GearNickName` OR ((`t`.`Note` IS NULL OR `s`.`Name` IS NULL) AND `t`.`GearNickName` IS NULL) +SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `s`.`Nickname0`, `s`.`SquadId0`, `s`.`AssignedCityName0`, `s`.`CityOfBirthName0`, `s`.`FullName0`, `s`.`HasSoulPatch0`, `s`.`LeaderNickname0`, `s`.`LeaderSquadId0`, `s`.`Rank0`, `s`.`Discriminator0`, `s`.`c` +FROM ( + SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname` AS `Nickname0`, `u0`.`SquadId` AS `SquadId0`, `u0`.`AssignedCityName` AS `AssignedCityName0`, `u0`.`CityOfBirthName` AS `CityOfBirthName0`, `u0`.`FullName` AS `FullName0`, `u0`.`HasSoulPatch` AS `HasSoulPatch0`, `u0`.`LeaderNickname` AS `LeaderNickname0`, `u0`.`LeaderSquadId` AS `LeaderSquadId0`, `u0`.`Rank` AS `Rank0`, `u0`.`Discriminator` AS `Discriminator0`, IIF(( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`) IS NULL, FALSE, ( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`)) AS `c` + FROM ( + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` + ) AS `u` + LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` + ) AS `u0` ON `u`.`Nickname` = `u0`.`LeaderNickname` AND `u`.`SquadId` = `u0`.`LeaderSquadId` +) AS `s` +ORDER BY NOT (`s`.`c`), `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } - public override async Task Filter_with_new_Guid(bool async) + public override async Task Correlated_collection_with_complex_OrderBy(bool async) { - await base.Filter_with_new_Guid(async); + await base.Correlated_collection_with_complex_OrderBy(async); AssertSql( -""" -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -WHERE `t`.`Id` = '{df36f493-463f-4123-83f9-6b135deeb7ba}' + """ +SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `s`.`c` +FROM ( + SELECT `u`.`Nickname`, `u`.`SquadId`, `u1`.`Nickname` AS `Nickname0`, `u1`.`SquadId` AS `SquadId0`, `u1`.`AssignedCityName`, `u1`.`CityOfBirthName`, `u1`.`FullName`, `u1`.`HasSoulPatch`, `u1`.`LeaderNickname`, `u1`.`LeaderSquadId`, `u1`.`Rank`, `u1`.`Discriminator`, ( + SELECT COUNT(*) + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName`) AS `c` + FROM ( + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` + ) AS `u` + LEFT JOIN ( + SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` + FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` + ) AS `u0` + WHERE `u0`.`HasSoulPatch` = FALSE + ) AS `u1` ON `u`.`Nickname` = `u1`.`LeaderNickname` AND `u`.`SquadId` = `u1`.`LeaderSquadId` +) AS `s` +ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } - public override async Task Filter_with_new_Guid_closure(bool async) - { - await base.Filter_with_new_Guid_closure(async); - - AssertSql(); - } - - public override async Task OfTypeNav1(bool async) + public override async Task Correlated_collection_with_very_complex_order_by(bool async) { - await base.OfTypeNav1(async); + await base.Correlated_collection_with_very_complex_order_by(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM (( - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId`) -LEFT JOIN `Tags` AS `t0` ON `u`.`Nickname` = `t0`.`GearNickName` AND `u`.`SquadId` = `t0`.`GearSquadId` -WHERE (`t`.`Note` <> 'Foo' OR `t`.`Note` IS NULL) AND (`t0`.`Note` <> 'Bar' OR `t0`.`Note` IS NULL) +SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0`, `s`.`SquadId0`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `s`.`c` +FROM ( + SELECT `u`.`Nickname`, `u`.`SquadId`, `u2`.`Nickname` AS `Nickname0`, `u2`.`SquadId` AS `SquadId0`, `u2`.`AssignedCityName`, `u2`.`CityOfBirthName`, `u2`.`FullName`, `u2`.`HasSoulPatch`, `u2`.`LeaderNickname`, `u2`.`LeaderSquadId`, `u2`.`Rank`, `u2`.`Discriminator`, ( + SELECT COUNT(*) + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` AND `w`.`IsAutomatic` = IIF(( + SELECT TOP 1 `u0`.`HasSoulPatch` + FROM ( + SELECT `g`.`Nickname`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`HasSoulPatch` + FROM `Officers` AS `o0` + ) AS `u0` + WHERE `u0`.`Nickname` = 'Marcus') IS NULL, FALSE, ( + SELECT TOP 1 `u0`.`HasSoulPatch` + FROM ( + SELECT `g`.`Nickname`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`HasSoulPatch` + FROM `Officers` AS `o0` + ) AS `u0` + WHERE `u0`.`Nickname` = 'Marcus'))) AS `c` + FROM ( + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` + ) AS `u` + LEFT JOIN ( + SELECT `u1`.`Nickname`, `u1`.`SquadId`, `u1`.`AssignedCityName`, `u1`.`CityOfBirthName`, `u1`.`FullName`, `u1`.`HasSoulPatch`, `u1`.`LeaderNickname`, `u1`.`LeaderSquadId`, `u1`.`Rank`, `u1`.`Discriminator` + FROM ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o1`.`Nickname`, `o1`.`SquadId`, `o1`.`AssignedCityName`, `o1`.`CityOfBirthName`, `o1`.`FullName`, `o1`.`HasSoulPatch`, `o1`.`LeaderNickname`, `o1`.`LeaderSquadId`, `o1`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o1` + ) AS `u1` + WHERE `u1`.`HasSoulPatch` = FALSE + ) AS `u2` ON `u`.`Nickname` = `u2`.`LeaderNickname` AND `u`.`SquadId` = `u2`.`LeaderSquadId` +) AS `s` +ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId`, `s`.`Nickname0` """); } - public override async Task OfTypeNav2(bool async) + public override async Task Cast_to_derived_type_after_OfType_works(bool async) { - await base.OfTypeNav2(async); + await base.Cast_to_derived_type_after_OfType_works(async); AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM (( - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId`) -LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name` -WHERE (`t`.`Note` <> 'Foo' OR `t`.`Note` IS NULL) AND (`c`.`Location` <> 'Bar' OR `c`.`Location` IS NULL) +""" +SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` +FROM `Officers` AS `o` """); } - public override async Task OfTypeNav3(bool async) + public override async Task Select_subquery_boolean(bool async) { - await base.OfTypeNav3(async); + await base.Select_subquery_boolean(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ((( - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` +SELECT IIF(( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`) IS NULL, FALSE, ( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`)) +FROM ( + SELECT `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`FullName` FROM `Officers` AS `o` ) AS `u` -LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId`) -INNER JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName`) -LEFT JOIN `Tags` AS `t0` ON `u`.`Nickname` = `t0`.`GearNickName` AND `u`.`SquadId` = `t0`.`GearSquadId` -WHERE (`t`.`Note` <> 'Foo' OR `t`.`Note` IS NULL) AND (`t0`.`Note` <> 'Bar' OR `t0`.`Note` IS NULL) -"""); - } - - public override async Task Nav_rewrite_Distinct_with_convert() - { - await base.Nav_rewrite_Distinct_with_convert(); - - AssertSql(); - } - - public override async Task Nav_rewrite_Distinct_with_convert_anonymous() - { - await base.Nav_rewrite_Distinct_with_convert_anonymous(); - - AssertSql(); - } - - public override async Task Nav_rewrite_with_convert1(bool async) - { - await base.Nav_rewrite_with_convert1(async); - - AssertSql( -""" -SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId` -FROM (`LocustHordes` AS `l` -LEFT JOIN `Cities` AS `c` ON `l`.`CapitalName` = `c`.`Name`) -LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -WHERE `c`.`Name` <> 'Foo' OR `c`.`Name` IS NULL """); } - public override async Task Nav_rewrite_with_convert2(bool async) + public override async Task Select_subquery_boolean_with_pushdown(bool async) { - await base.Nav_rewrite_with_convert2(async); + await base.Select_subquery_boolean_with_pushdown(async); AssertSql( -""" -SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated` -FROM (`LocustHordes` AS `l` -LEFT JOIN `Cities` AS `c` ON `l`.`CapitalName` = `c`.`Name`) -LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -WHERE (`c`.`Name` <> 'Foo' OR `c`.`Name` IS NULL) AND (`l0`.`Name` <> 'Bar' OR `l0`.`Name` IS NULL) + """ +SELECT ( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`) +FROM ( + SELECT `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` """); } - public override async Task Nav_rewrite_with_convert3(bool async) + public override async Task Select_subquery_int_with_inside_cast_and_coalesce(bool async) { - await base.Nav_rewrite_with_convert3(async); + await base.Select_subquery_int_with_inside_cast_and_coalesce(async); AssertSql( -""" -SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated` -FROM (`LocustHordes` AS `l` -LEFT JOIN `Cities` AS `c` ON `l`.`CapitalName` = `c`.`Name`) -LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -WHERE (`c`.`Name` <> 'Foo' OR `c`.`Name` IS NULL) AND (`l0`.`Name` <> 'Bar' OR `l0`.`Name` IS NULL) + """ +SELECT IIF(( + SELECT TOP 1 `w`.`Id` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`) IS NULL, 42, ( + SELECT TOP 1 `w`.`Id` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`)) +FROM ( + SELECT `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` """); } - public override async Task Where_contains_on_navigation_with_composite_keys(bool async) + public override async Task Select_subquery_int_with_outside_cast_and_coalesce(bool async) { - await base.Where_contains_on_navigation_with_composite_keys(async); + await base.Select_subquery_int_with_outside_cast_and_coalesce(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +SELECT IIF(( + SELECT TOP 1 `w`.`Id` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`) IS NULL, 0, ( + SELECT TOP 1 `w`.`Id` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`)) FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`FullName` FROM `Officers` AS `o` ) AS `u` -WHERE EXISTS ( - SELECT 1 - FROM `Cities` AS `c` - WHERE EXISTS ( - SELECT 1 - FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`CityOfBirthName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`CityOfBirthName` - FROM `Officers` AS `o0` - ) AS `u0` - WHERE `c`.`Name` = `u0`.`CityOfBirthName` AND `u0`.`Nickname` = `u`.`Nickname` AND `u0`.`SquadId` = `u`.`SquadId`)) """); } - public override async Task Include_with_complex_order_by(bool async) + public override async Task Select_subquery_int_with_pushdown_and_coalesce(bool async) { - await base.Include_with_complex_order_by(async); + await base.Select_subquery_int_with_pushdown_and_coalesce(async); AssertSql( """ -SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `s`.`Id`, `s`.`AmmunitionType`, `s`.`IsAutomatic`, `s`.`Name`, `s`.`OwnerFullName`, `s`.`SynergyWithId`, `s`.`c` -FROM ( - SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId`, ( - SELECT TOP 1 `w`.`Name` +SELECT IIF(( + SELECT TOP 1 `w`.`Id` FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Gnasher%')) AS `c` - FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` - ) AS `u` - LEFT JOIN `Weapons` AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` -) AS `s` -ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`) IS NULL, 42, ( + SELECT TOP 1 `w`.`Id` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`)) +FROM ( + SELECT `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` """); } - public override async Task Anonymous_projection_take_followed_by_projecting_single_element_from_collection_navigation(bool async) + public override async Task Select_subquery_int_with_pushdown_and_coalesce2(bool async) { - await base.Anonymous_projection_take_followed_by_projecting_single_element_from_collection_navigation(async); + await base.Select_subquery_int_with_pushdown_and_coalesce2(async); AssertSql( -""" -@__p_0='25' - -SELECT [t1].[Id], [t1].[AmmunitionType], [t1].[IsAutomatic], [t1].[Name], [t1].[OwnerFullName], [t1].[SynergyWithId] + """ +SELECT IIF(( + SELECT TOP 1 `w`.`Id` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`) IS NULL, ( + SELECT TOP 1 `w0`.`Id` + FROM `Weapons` AS `w0` + WHERE `u`.`FullName` = `w0`.`OwnerFullName` + ORDER BY `w0`.`Id`), ( + SELECT TOP 1 `w`.`Id` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`)) FROM ( - SELECT TOP(@__p_0) [t].[FullName] - FROM ( - SELECT [g].[FullName] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[FullName] - FROM [Officers] AS [o] - ) AS [t] -) AS [t0] -LEFT JOIN ( - SELECT [t2].[Id], [t2].[AmmunitionType], [t2].[IsAutomatic], [t2].[Name], [t2].[OwnerFullName], [t2].[SynergyWithId] - FROM ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], ROW_NUMBER() OVER(PARTITION BY [w].[OwnerFullName] ORDER BY [w].[Id]) AS [row] - FROM [Weapons] AS [w] - ) AS [t2] - WHERE [t2].[row] <= 1 -) AS [t1] ON [t0].[FullName] = [t1].[OwnerFullName] + SELECT `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` """); } - public override async Task Bool_projection_from_subquery_treated_appropriately_in_where(bool async) + public override async Task Select_subquery_boolean_empty(bool async) { - await base.Bool_projection_from_subquery_treated_appropriately_in_where(async); + await base.Select_subquery_boolean_empty(async); AssertSql( """ -SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` -FROM `Cities` AS `c` -WHERE ( - SELECT TOP 1 `u`.`HasSoulPatch` - FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` - ) AS `u` - ORDER BY `u`.`Nickname`, `u`.`SquadId`) = TRUE +SELECT IIF(( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` AND `w`.`Name` = 'BFG' + ORDER BY `w`.`Id`) IS NULL, FALSE, ( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` AND `w`.`Name` = 'BFG' + ORDER BY `w`.`Id`)) +FROM ( + SELECT `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` """); } - public override async Task DateTimeOffset_Contains_Less_than_Greater_than(bool async) + public override async Task Select_subquery_boolean_empty_with_pushdown(bool async) { - var dto = JetTestHelpers.GetExpectedValue(new DateTimeOffset(599898024001234567, new TimeSpan(1, 30, 0))); - var start = dto.AddDays(-1); - var end = dto.AddDays(1); - var dates = new[] { dto }; - - await AssertQuery( - async, - ss => ss.Set().Where( - m => start <= m.Timeline.Date && m.Timeline < end && dates.Contains(m.Timeline))); + await base.Select_subquery_boolean_empty_with_pushdown(async); AssertSql( """ -@__start_0='1902-01-01T08:30:00.0000000Z' (DbType = DateTime) -@__end_1='1902-01-03T08:30:00.0000000Z' (DbType = DateTime) - -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE @__start_0 <= DATEVALUE(`m`.`Timeline`) AND `m`.`Timeline` < @__end_1 AND `m`.`Timeline` = CDATE('1902-01-02 08:30:00') +SELECT ( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` AND `w`.`Name` = 'BFG' + ORDER BY `w`.`Id`) +FROM ( + SELECT `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` """); } - public override Task DateTimeOffsetNow_minus_timespan(bool async) - => AssertTranslationFailed(() => base.DateTimeOffsetNow_minus_timespan(async)); - - public override async Task Navigation_inside_interpolated_string_expanded(bool async) + public override async Task Select_subquery_distinct_singleordefault_boolean1(bool async) { - await base.Navigation_inside_interpolated_string_expanded(async); + await base.Select_subquery_distinct_singleordefault_boolean1(async); AssertSql( """ -SELECT IIF(`w`.`SynergyWithId` IS NOT NULL, TRUE, FALSE), `w0`.`OwnerFullName` -FROM `Weapons` AS `w` -LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +SELECT COALESCE(( + SELECT TOP(1) [t0].[IsAutomatic] + FROM ( + SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') + ) AS [t0]), CAST(0 AS bit)) +FROM ( + SELECT [g].[FullName], [g].[HasSoulPatch] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[FullName], [o].[HasSoulPatch] + FROM [Officers] AS [o] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) """); } - public override async Task Left_join_projection_using_coalesce_tracking(bool async) + public override async Task Select_subquery_distinct_singleordefault_boolean2(bool async) { - await base.Left_join_projection_using_coalesce_tracking(async); + await base.Select_subquery_distinct_singleordefault_boolean2(async); + AssertSql( """ -SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +SELECT IIF(( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%')) IS NULL, FALSE, ( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%'))) FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g`.`FullName`, `g`.`HasSoulPatch` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`FullName`, `o`.`HasSoulPatch` FROM `Officers` AS `o` ) AS `u` -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` -) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname` +WHERE `u`.`HasSoulPatch` = TRUE """); } - public override async Task Left_join_projection_using_conditional_tracking(bool async) + public override async Task Select_subquery_distinct_singleordefault_boolean_with_pushdown(bool async) { - await base.Left_join_projection_using_conditional_tracking(async); + await base.Select_subquery_distinct_singleordefault_boolean_with_pushdown(async); + AssertSql( - """ -SELECT IIF(`u0`.`Nickname` IS NULL OR `u0`.`SquadId` IS NULL, TRUE, FALSE), `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` +""" +SELECT ( + SELECT TOP(1) [t0].[IsAutomatic] + FROM ( + SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') + ) AS [t0]) FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` + SELECT [g].[FullName], [g].[HasSoulPatch] + FROM [Gears] AS [g] UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` -) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname` + SELECT [o].[FullName], [o].[HasSoulPatch] + FROM [Officers] AS [o] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) """); } - public override async Task Project_collection_navigation_nested_with_take_composite_key(bool async) + public override async Task Select_subquery_distinct_singleordefault_boolean_empty1(bool async) { - await base.Project_collection_navigation_nested_with_take_composite_key(async); + await base.Select_subquery_distinct_singleordefault_boolean_empty1(async); AssertSql( """ -SELECT [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] -FROM [Tags] AS [t] -LEFT JOIN ( - SELECT [g].[Nickname], [g].[SquadId], N'Gear' AS [Discriminator] +SELECT COALESCE(( + SELECT TOP(1) [t0].[IsAutomatic] + FROM ( + SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG' + ) AS [t0]), CAST(0 AS bit)) +FROM ( + SELECT [g].[FullName], [g].[HasSoulPatch] FROM [Gears] AS [g] UNION ALL - SELECT [o].[Nickname], [o].[SquadId], N'Officer' AS [Discriminator] + SELECT [o].[FullName], [o].[HasSoulPatch] FROM [Officers] AS [o] -) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -LEFT JOIN ( - SELECT [t2].[Nickname], [t2].[SquadId], [t2].[AssignedCityName], [t2].[CityOfBirthName], [t2].[FullName], [t2].[HasSoulPatch], [t2].[LeaderNickname], [t2].[LeaderSquadId], [t2].[Rank], [t2].[Discriminator] - FROM ( - SELECT [t3].[Nickname], [t3].[SquadId], [t3].[AssignedCityName], [t3].[CityOfBirthName], [t3].[FullName], [t3].[HasSoulPatch], [t3].[LeaderNickname], [t3].[LeaderSquadId], [t3].[Rank], [t3].[Discriminator], ROW_NUMBER() OVER(PARTITION BY [t3].[LeaderNickname], [t3].[LeaderSquadId] ORDER BY [t3].[Nickname], [t3].[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] - 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 [t3] - ) AS [t2] - WHERE [t2].[row] <= 50 -) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND [t0].[SquadId] = [t1].[LeaderSquadId] -WHERE [t0].[Discriminator] = N'Officer' -ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) """); } - public override async Task Project_collection_navigation_nested_composite_key(bool async) + public override async Task Select_subquery_distinct_singleordefault_boolean_empty2(bool async) { - await base.Project_collection_navigation_nested_composite_key(async); + await base.Select_subquery_distinct_singleordefault_boolean_empty2(async); 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` -FROM (`Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, 'Gear' AS `Discriminator` +SELECT IIF(( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` AND `w`.`Name` = 'BFG') IS NULL, FALSE, ( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` AND `w`.`Name` = 'BFG')) +FROM ( + SELECT `g`.`FullName`, `g`.`HasSoulPatch` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, 'Officer' AS `Discriminator` + SELECT `o`.`FullName`, `o`.`HasSoulPatch` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId`) -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, '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` -WHERE `u`.`Discriminator` = 'Officer' -ORDER BY `t`.`Id`, `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname` +) AS `u` +WHERE `u`.`HasSoulPatch` = TRUE """); } - public override async Task Null_checks_in_correlated_predicate_are_correctly_translated(bool async) + public override async Task Select_subquery_distinct_singleordefault_boolean_empty_with_pushdown(bool async) { - await base.Null_checks_in_correlated_predicate_are_correctly_translated(async); + await base.Select_subquery_distinct_singleordefault_boolean_empty_with_pushdown(async); AssertSql( """ -SELECT [t].[Id], [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] -FROM [Tags] AS [t] -LEFT JOIN ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] +SELECT ( + SELECT TOP(1) [t0].[IsAutomatic] + FROM ( + SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [t].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG' + ) AS [t0]) +FROM ( + SELECT [g].[FullName], [g].[HasSoulPatch] FROM [Gears] AS [g] UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + SELECT [o].[FullName], [o].[HasSoulPatch] FROM [Officers] AS [o] -) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] AND ([t].[Note] IS NOT NULL) -ORDER BY [t].[Id], [t0].[Nickname] +) AS [t] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) """); } - public override async Task SelectMany_Where_DefaultIfEmpty_with_navigation_in_the_collection_selector(bool async) + public override async Task Cast_subquery_to_base_type_using_typed_ToList(bool async) { - await base.SelectMany_Where_DefaultIfEmpty_with_navigation_in_the_collection_selector(async); + await base.Cast_subquery_to_base_type_using_typed_ToList(async); AssertSql( """ -@__isAutomatic_0='True' - -SELECT `u`.`Nickname`, `u`.`FullName`, IIF(`w0`.`Id` IS NOT NULL, TRUE, FALSE) AS `Collection` -FROM ( - SELECT `g`.`Nickname`, `g`.`FullName` +SELECT `c`.`Name`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Nickname`, `u`.`Rank`, `u`.`SquadId` +FROM `Cities` AS `c` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`FullName` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank` FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `w`.`Id`, `w`.`OwnerFullName` - FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` = @__isAutomatic_0 -) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` +) AS `u` ON `c`.`Name` = `u`.`AssignedCityName` +WHERE `c`.`Name` = 'Ephyra' +ORDER BY `c`.`Name`, `u`.`Nickname` """); } - public override async Task Join_with_inner_being_a_subquery_projecting_single_property(bool async) + public override async Task Cast_ordered_subquery_to_base_type_using_typed_ToArray(bool async) { - await base.Join_with_inner_being_a_subquery_projecting_single_property(async); + await base.Cast_ordered_subquery_to_base_type_using_typed_ToArray(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT `c`.`Name`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Nickname`, `u`.`Rank`, `u`.`SquadId` +FROM `Cities` AS `c` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank` FROM `Officers` AS `o` -) AS `u` -INNER JOIN ( - SELECT `g0`.`Nickname` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname` - FROM `Officers` AS `o0` -) AS `u0` ON `u`.`Nickname` = `u0`.`Nickname` +) AS `u` ON `c`.`Name` = `u`.`AssignedCityName` +WHERE `c`.`Name` = 'Ephyra' +ORDER BY `c`.`Name`, `u`.`Nickname` DESC """); } - public override async Task Join_with_inner_being_a_subquery_projecting_anonymous_type_with_single_property(bool async) + public override async Task Correlated_collection_with_complex_order_by_funcletized_to_constant_bool(bool async) { - await base.Join_with_inner_being_a_subquery_projecting_anonymous_type_with_single_property(async); + await base.Correlated_collection_with_complex_order_by_funcletized_to_constant_bool(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +SELECT `u`.`Nickname`, `u`.`SquadId`, `w`.`Name`, `w`.`Id` FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` ) AS `u` -INNER JOIN ( - SELECT `g0`.`Nickname` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname` - FROM `Officers` AS `o0` -) AS `u0` ON `u`.`Nickname` = `u0`.`Nickname` +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` +ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Navigation_based_on_complex_expression1(bool async) + public override async Task Double_order_by_on_nullable_bool_coming_from_optional_navigation(bool async) { - await base.Navigation_based_on_complex_expression1(async); + await base.Double_order_by_on_nullable_bool_coming_from_optional_navigation(async); AssertSql( """ -SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated` -FROM `LocustHordes` AS `l` -LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -WHERE `l0`.`Name` IS NOT NULL +SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` +FROM `Weapons` AS `w` +LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`), `w0`.`Id` """); } - public override async Task Navigation_based_on_complex_expression2(bool async) + public override async Task Double_order_by_on_Like(bool async) { - await base.Navigation_based_on_complex_expression2(async); + await base.Double_order_by_on_Like(async); + + AssertSql( + """ +SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` +FROM `Weapons` AS `w` +LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +ORDER BY NOT (IIF((`w0`.`Name` LIKE '%Lancer') AND `w0`.`Name` IS NOT NULL, TRUE, FALSE)) +"""); + } + + public override async Task Double_order_by_on_is_null(bool async) + { + await base.Double_order_by_on_is_null(async); AssertSql( """ -SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated` -FROM `LocustHordes` AS `l` -LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` -WHERE `l0`.`Name` IS NOT NULL +SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` +FROM `Weapons` AS `w` +LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +ORDER BY NOT (IIF(`w0`.`Name` IS NULL, TRUE, FALSE)) """); } - public override async Task Navigation_based_on_complex_expression3(bool async) + public override async Task Double_order_by_on_string_compare(bool async) { - await base.Navigation_based_on_complex_expression3(async); + await base.Double_order_by_on_string_compare(async); AssertSql( """ -SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId` -FROM `LocustHordes` AS `l` -LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM `Weapons` AS `w` +ORDER BY NOT (IIF(`w`.`Name` = 'Marcus'' Lancer' AND `w`.`Name` IS NOT NULL, TRUE, FALSE)), `w`.`Id` """); } - public override async Task Navigation_based_on_complex_expression4(bool async) + public override async Task Double_order_by_binary_expression(bool async) { - await base.Navigation_based_on_complex_expression4(async); + await base.Double_order_by_binary_expression(async); AssertSql( """ -SELECT TRUE, `l1`.`Name`, `l1`.`LocustHordeId`, `l1`.`ThreatLevel`, `l1`.`ThreatLevelByte`, `l1`.`ThreatLevelNullableByte`, `l1`.`DefeatedByNickname`, `l1`.`DefeatedBySquadId`, `l1`.`HighCommandId`, `s`.`Name0`, `s`.`LocustHordeId`, `s`.`ThreatLevel`, `s`.`ThreatLevelByte`, `s`.`ThreatLevelNullableByte`, `s`.`DefeatedByNickname`, `s`.`DefeatedBySquadId`, `s`.`HighCommandId`, `s`.`Discriminator` +SELECT `w0`.`Binary` FROM ( - SELECT `l`.`CommanderName`, `u`.`Name` AS `Name0`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` - FROM `LocustHordes` AS `l`, - ( - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l0` - ) AS `u` -) AS `s` -LEFT JOIN `LocustCommanders` AS `l1` ON `s`.`CommanderName` = `l1`.`Name` + SELECT `w`.`Id` + 2 AS `Binary` + FROM `Weapons` AS `w` +) AS `w0` +ORDER BY `w0`.`Binary` """); } - public override async Task Navigation_based_on_complex_expression5(bool async) + public override async Task String_compare_with_null_conditional_argument(bool async) { - await base.Navigation_based_on_complex_expression5(async); + await base.String_compare_with_null_conditional_argument(async); AssertSql( """ -SELECT [l0].[Name], [l0].[LocustHordeId], [l0].[ThreatLevel], [l0].[ThreatLevelByte], [l0].[ThreatLevelNullableByte], [l0].[DefeatedByNickname], [l0].[DefeatedBySquadId], [l0].[HighCommandId], [t].[Name], [t].[LocustHordeId], [t].[ThreatLevel], [t].[ThreatLevelByte], [t].[ThreatLevelNullableByte], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId], [t].[Discriminator] -FROM [LocustHordes] AS [l] -CROSS JOIN ( - SELECT [l1].[Name], [l1].[LocustHordeId], [l1].[ThreatLevel], [l1].[ThreatLevelByte], [l1].[ThreatLevelNullableByte], [l1].[DefeatedByNickname], [l1].[DefeatedBySquadId], [l1].[HighCommandId], N'LocustCommander' AS [Discriminator] - FROM [LocustCommanders] AS [l1] -) AS [t] -LEFT JOIN [LocustCommanders] AS [l0] ON [l].[CommanderName] = [l0].[Name] +SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` +FROM `Weapons` AS `w` +LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +ORDER BY NOT (IIF(`w0`.`Name` = 'Marcus'' Lancer' AND `w0`.`Name` IS NOT NULL, TRUE, FALSE)) """); } - public override async Task Navigation_based_on_complex_expression6(bool async) + public override async Task String_compare_with_null_conditional_argument2(bool async) { - await base.Navigation_based_on_complex_expression6(async); + await base.String_compare_with_null_conditional_argument2(async); AssertSql( """ -SELECT CASE - WHEN [l0].[Name] = N'Queen Myrrah' AND ([l0].[Name] IS NOT NULL) THEN CAST(1 AS bit) - ELSE CAST(0 AS bit) -END, [l0].[Name], [l0].[LocustHordeId], [l0].[ThreatLevel], [l0].[ThreatLevelByte], [l0].[ThreatLevelNullableByte], [l0].[DefeatedByNickname], [l0].[DefeatedBySquadId], [l0].[HighCommandId], [t].[Name], [t].[LocustHordeId], [t].[ThreatLevel], [t].[ThreatLevelByte], [t].[ThreatLevelNullableByte], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId], [t].[Discriminator] -FROM [LocustHordes] AS [l] -CROSS JOIN ( - SELECT [l1].[Name], [l1].[LocustHordeId], [l1].[ThreatLevel], [l1].[ThreatLevelByte], [l1].[ThreatLevelNullableByte], [l1].[DefeatedByNickname], [l1].[DefeatedBySquadId], [l1].[HighCommandId], N'LocustCommander' AS [Discriminator] - FROM [LocustCommanders] AS [l1] -) AS [t] -LEFT JOIN [LocustCommanders] AS [l0] ON [l].[CommanderName] = [l0].[Name] +SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` +FROM `Weapons` AS `w` +LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +ORDER BY NOT (IIF('Marcus'' Lancer' = `w0`.`Name` AND `w0`.`Name` IS NOT NULL, TRUE, FALSE)) """); } - public override async Task Select_as_operator(bool async) + public override async Task String_concat_with_null_conditional_argument(bool async) { - await base.Select_as_operator(async); + await base.String_concat_with_null_conditional_argument(async); AssertSql( - """ -SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` -FROM `LocustLeaders` AS `l` -UNION ALL -SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` -FROM `LocustCommanders` AS `l0` +""" +SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` +FROM `Weapons` AS `w` +LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & (5 & '') """); } - public override async Task Select_datetimeoffset_comparison_in_projection(bool async) + public override async Task String_concat_with_null_conditional_argument2(bool async) { - await base.Select_datetimeoffset_comparison_in_projection(async); + await base.String_concat_with_null_conditional_argument2(async); AssertSql( """ -SELECT IIF(`m`.`Timeline` > NOW(), TRUE, FALSE) -FROM `Missions` AS `m` +SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` +FROM `Weapons` AS `w` +LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +ORDER BY IIF(`w0`.`Name` IS NULL, '', `w0`.`Name`) & 'Marcus'' Lancer' """); } - public override async Task OfType_in_subquery_works(bool async) + public override async Task String_concat_on_various_types(bool async) { - await base.OfType_in_subquery_works(async); + await base.String_concat_on_various_types(async); AssertSql( """ -SELECT `s`.`Name`, `s`.`Location`, `s`.`Nation` -FROM `Officers` AS `o` -INNER JOIN ( - SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation`, `u`.`LeaderNickname`, `u`.`LeaderSquadId` - FROM ( - SELECT `o0`.`AssignedCityName`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` - FROM `Officers` AS `o0` - ) AS `u` - LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name` -) AS `s` ON `o`.`Nickname` = `s`.`LeaderNickname` AND `o`.`SquadId` = `s`.`LeaderSquadId` +SELECT ('HasSoulPatch ' & (`u`.`HasSoulPatch` & '')) & ' HasSoulPatch' AS `HasSoulPatch`, ('Rank ' & (`u`.`Rank` & '')) & ' Rank' AS `Rank`, ('SquadId ' & (`u`.`SquadId` & '')) & ' SquadId' AS `SquadId`, ('Rating ' & IIF((`m`.`Rating` & '') IS NULL, '', (`m`.`Rating` & ''))) & ' Rating' AS `Rating`, ('Timeline ' & (`m`.`Timeline` & '')) & ' Timeline' AS `Timeline` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch`, `g`.`Rank` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch`, `o`.`Rank` + FROM `Officers` AS `o` +) AS `u`, +`Missions` AS `m` +ORDER BY `u`.`Nickname`, `m`.`Id` """); } - public override async Task Nullable_bool_comparison_is_translated_to_server(bool async) + public override async Task GroupBy_Property_Include_Select_Average(bool async) { - await base.Nullable_bool_comparison_is_translated_to_server(async); + await base.GroupBy_Property_Include_Select_Average(async); AssertSql( -""" -SELECT IIF(`l`.`Eradicated` = TRUE AND `l`.`Eradicated` IS NOT NULL, TRUE, FALSE) AS `IsEradicated` -FROM `LocustHordes` AS `l` + """ +SELECT AVG(CDBL(`u`.`SquadId`)) +FROM ( + SELECT `g`.`SquadId`, `g`.`Rank` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`SquadId`, `o`.`Rank` + FROM `Officers` AS `o` +) AS `u` +GROUP BY `u`.`Rank` """); } - public override async Task Accessing_reference_navigation_collection_composition_generates_single_query(bool async) + public override async Task GroupBy_Property_Include_Select_Sum(bool async) { - await base.Accessing_reference_navigation_collection_composition_generates_single_query(async); + await base.GroupBy_Property_Include_Select_Sum(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `s`.`Id`, `s`.`IsAutomatic`, `s`.`Name`, `s`.`Id0` +SELECT IIF(SUM(`u`.`SquadId`) IS NULL, 0, SUM(`u`.`SquadId`)) FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + SELECT `g`.`SquadId`, `g`.`Rank` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + SELECT `o`.`SquadId`, `o`.`Rank` FROM `Officers` AS `o` ) AS `u` -LEFT JOIN ( - SELECT `w`.`Id`, `w`.`IsAutomatic`, `w0`.`Name`, `w0`.`Id` AS `Id0`, `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` +GROUP BY `u`.`Rank` """); } - public override async Task Reference_include_chain_loads_correctly_when_middle_is_null(bool async) + public override async Task GroupBy_Property_Include_Select_Count(bool async) { - await base.Reference_include_chain_loads_correctly_when_middle_is_null(async); + await base.GroupBy_Property_Include_Select_Count(async); AssertSql( """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note`, `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM (`Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT COUNT(*) +FROM ( + SELECT `g`.`Rank` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Rank` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId`) -LEFT JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id` -ORDER BY `t`.`Note` +) AS `u` +GROUP BY `u`.`Rank` """); } - public override async Task Accessing_property_of_optional_navigation_in_child_projection_works(bool async) + public override async Task GroupBy_Property_Include_Select_LongCount(bool async) { - await base.Accessing_property_of_optional_navigation_in_child_projection_works(async); + await base.GroupBy_Property_Include_Select_LongCount(async); AssertSql( """ -SELECT IIF(`u`.`Nickname` IS NOT NULL AND `u`.`SquadId` IS NOT NULL, TRUE, FALSE), `t`.`Id`, `u`.`Nickname`, `u`.`SquadId`, `s`.`Nickname`, `s`.`Id`, `s`.`SquadId` -FROM (`Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` +SELECT COUNT(*) +FROM ( + SELECT `g`.`Rank` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + SELECT `o`.`Rank` 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` - FROM `Weapons` AS `w` - LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `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` +) AS `u` +GROUP BY `u`.`Rank` """); } - public override async Task Collection_navigation_ofType_filter_works(bool async) + public override async Task GroupBy_Property_Include_Select_Min(bool async) { - await base.Collection_navigation_ofType_filter_works(async); + await base.GroupBy_Property_Include_Select_Min(async); AssertSql( """ -SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` -FROM `Cities` AS `c` -WHERE EXISTS ( - SELECT 1 - FROM ( - SELECT `o`.`Nickname`, `o`.`CityOfBirthName` - FROM `Officers` AS `o` - ) AS `u` - WHERE `c`.`Name` = `u`.`CityOfBirthName` AND `u`.`Nickname` = 'Marcus') +SELECT MIN(`u`.`SquadId`) +FROM ( + SELECT `g`.`SquadId`, `g`.`Rank` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`SquadId`, `o`.`Rank` + FROM `Officers` AS `o` +) AS `u` +GROUP BY `u`.`Rank` """); } - public override async Task Query_reusing_parameter_doesnt_declare_duplicate_parameter(bool async) + public override async Task GroupBy_Property_Include_Aggregate_with_anonymous_selector(bool async) { - await base.Query_reusing_parameter_doesnt_declare_duplicate_parameter(async); + await base.GroupBy_Property_Include_Aggregate_with_anonymous_selector(async); AssertSql( """ -@__prm_Inner_Nickname_0='Marcus' (Size = 255) - -SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` +SELECT `u`.`Nickname` AS `Key`, COUNT(*) AS `c` FROM ( - SELECT DISTINCT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` - FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` - ) AS `u` - WHERE `u`.`Nickname` <> @__prm_Inner_Nickname_0 -) AS `u0` -ORDER BY `u0`.`FullName` + SELECT `g`.`Nickname` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname` + FROM `Officers` AS `o` +) AS `u` +GROUP BY `u`.`Nickname` +ORDER BY `u`.`Nickname` """); } - public override async Task Query_reusing_parameter_with_inner_query_doesnt_declare_duplicate_parameter(bool async) + public override async Task Group_by_with_include_with_entity_in_result_selector(bool async) { - await base.Query_reusing_parameter_with_inner_query_doesnt_declare_duplicate_parameter(async); + await base.Group_by_with_include_with_entity_in_result_selector(async); AssertSql( - """ -@__squadId_0='1' -@__squadId_0='1' - -SELECT `u1`.`Nickname`, `u1`.`SquadId`, `u1`.`AssignedCityName`, `u1`.`CityOfBirthName`, `u1`.`FullName`, `u1`.`HasSoulPatch`, `u1`.`LeaderNickname`, `u1`.`LeaderSquadId`, `u1`.`Rank`, `u1`.`Discriminator` +""" +SELECT [t0].[Rank], [t0].[c], [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator], [t1].[Name], [t1].[Location], [t1].[Nation] FROM ( - SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` + SELECT [t].[Rank], COUNT(*) AS [c] FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` + SELECT [g].[Rank] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` - ) AS `u` - INNER JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id` - WHERE `s`.`Id` IN ( - SELECT `s0`.`Id` - FROM `Squads` AS `s0` - WHERE `s0`.`Id` = @__squadId_0 - ) - UNION ALL - SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` + SELECT [o].[Rank] + FROM [Officers] AS [o] + ) AS [t] + GROUP BY [t].[Rank] +) AS [t0] +LEFT JOIN ( + SELECT [t2].[Nickname], [t2].[SquadId], [t2].[AssignedCityName], [t2].[CityOfBirthName], [t2].[FullName], [t2].[HasSoulPatch], [t2].[LeaderNickname], [t2].[LeaderSquadId], [t2].[Rank], [t2].[Discriminator], [t2].[Name], [t2].[Location], [t2].[Nation] FROM ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` - ) AS `u0` - INNER JOIN `Squads` AS `s1` ON `u0`.`SquadId` = `s1`.`Id` - WHERE `s1`.`Id` IN ( - SELECT `s2`.`Id` - FROM `Squads` AS `s2` - WHERE `s2`.`Id` = @__squadId_0 - ) -) AS `u1` -ORDER BY `u1`.`FullName` + SELECT [t3].[Nickname], [t3].[SquadId], [t3].[AssignedCityName], [t3].[CityOfBirthName], [t3].[FullName], [t3].[HasSoulPatch], [t3].[LeaderNickname], [t3].[LeaderSquadId], [t3].[Rank], [t3].[Discriminator], [c].[Name], [c].[Location], [c].[Nation], ROW_NUMBER() OVER(PARTITION BY [t3].[Rank] ORDER BY [t3].[Nickname]) 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] + 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 [t3] + INNER JOIN [Cities] AS [c] ON [t3].[CityOfBirthName] = [c].[Name] + ) AS [t2] + WHERE [t2].[row] <= 1 +) AS [t1] ON [t0].[Rank] = [t1].[Rank] +ORDER BY [t0].[Rank] """); } - public override async Task Query_reusing_parameter_with_inner_query_expression_doesnt_declare_duplicate_parameter(bool async) + public override async Task GroupBy_Property_Include_Select_Max(bool async) { - await base.Query_reusing_parameter_with_inner_query_expression_doesnt_declare_duplicate_parameter(async); + await base.GroupBy_Property_Include_Select_Max(async); AssertSql( """ -@__gearId_0='1' -@__gearId_0='1' - -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE EXISTS ( - SELECT 1 - FROM ( - SELECT `g`.`SquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`SquadId` - FROM `Officers` AS `o` - ) AS `u` - WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`SquadId` = @__gearId_0 AND `u`.`SquadId` = @__gearId_0) +SELECT MAX(`u`.`SquadId`) +FROM ( + SELECT `g`.`SquadId`, `g`.`Rank` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`SquadId`, `o`.`Rank` + FROM `Officers` AS `o` +) AS `u` +GROUP BY `u`.`Rank` """); } - public override async Task Query_reusing_parameter_doesnt_declare_duplicate_parameter_complex(bool async) + public override async Task Include_with_group_by_and_FirstOrDefault_gets_properly_applied(bool async) { - await base.Query_reusing_parameter_doesnt_declare_duplicate_parameter_complex(async); + await base.Include_with_group_by_and_FirstOrDefault_gets_properly_applied(async); AssertSql( - """ -@__entity_equality_prm_Inner_Squad_0_Id='1' (Nullable = true) -@__entity_equality_prm_Inner_Squad_0_Id='1' (Nullable = true) - -SELECT `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`AssignedCityName`, `s1`.`CityOfBirthName`, `s1`.`FullName`, `s1`.`HasSoulPatch`, `s1`.`LeaderNickname`, `s1`.`LeaderSquadId`, `s1`.`Rank`, `s1`.`Discriminator` +""" +SELECT [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator], [t1].[Name], [t1].[Location], [t1].[Nation] FROM ( - SELECT DISTINCT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` + SELECT [t].[Rank] FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` + SELECT [g].[Rank] + FROM [Gears] AS [g] UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` - ) AS `u` - INNER JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id` - WHERE `s`.`Id` = @__entity_equality_prm_Inner_Squad_0_Id -) AS `s1` -INNER JOIN `Squads` AS `s0` ON `s1`.`SquadId` = `s0`.`Id` -WHERE `s0`.`Id` = @__entity_equality_prm_Inner_Squad_0_Id -ORDER BY `s1`.`FullName` + SELECT [o].[Rank] + FROM [Officers] AS [o] + ) AS [t] + GROUP BY [t].[Rank] +) AS [t0] +LEFT JOIN ( + SELECT [t2].[Nickname], [t2].[SquadId], [t2].[AssignedCityName], [t2].[CityOfBirthName], [t2].[FullName], [t2].[HasSoulPatch], [t2].[LeaderNickname], [t2].[LeaderSquadId], [t2].[Rank], [t2].[Discriminator], [t2].[Name], [t2].[Location], [t2].[Nation] + FROM ( + SELECT [t3].[Nickname], [t3].[SquadId], [t3].[AssignedCityName], [t3].[CityOfBirthName], [t3].[FullName], [t3].[HasSoulPatch], [t3].[LeaderNickname], [t3].[LeaderSquadId], [t3].[Rank], [t3].[Discriminator], [c].[Name], [c].[Location], [c].[Nation], ROW_NUMBER() OVER(PARTITION BY [t3].[Rank] ORDER BY [t3].[Nickname], [t3].[SquadId], [c].[Name]) 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] + 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 [t3] + INNER JOIN [Cities] AS [c] ON [t3].[CityOfBirthName] = [c].[Name] + WHERE [t3].[HasSoulPatch] = CAST(1 AS bit) + ) AS [t2] + WHERE [t2].[row] <= 1 +) AS [t1] ON [t0].[Rank] = [t1].[Rank] """); } - public override async Task Complex_GroupBy_after_set_operator(bool async) + public override async Task Include_collection_with_Cast_to_base(bool async) { - await base.Complex_GroupBy_after_set_operator(async); + await base.Include_collection_with_Cast_to_base(async); AssertSql( """ -SELECT `u1`.`Name`, `u1`.`Count`, IIF(SUM(`u1`.`Count`) IS NULL, 0, SUM(`u1`.`Count`)) AS `Sum` +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM ( - SELECT `c`.`Name`, ( - SELECT COUNT(*) - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName`) AS `Count` - FROM ( - SELECT `g`.`AssignedCityName`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`AssignedCityName`, `o`.`FullName` - FROM `Officers` AS `o` - ) AS `u` - LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name` - UNION ALL - SELECT `c0`.`Name`, ( - SELECT COUNT(*) - FROM `Weapons` AS `w0` - WHERE `u0`.`FullName` = `w0`.`OwnerFullName`) AS `Count` - FROM ( - SELECT `g0`.`CityOfBirthName`, `g0`.`FullName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`CityOfBirthName`, `o0`.`FullName` - FROM `Officers` AS `o0` - ) AS `u0` - INNER JOIN `Cities` AS `c0` ON `u0`.`CityOfBirthName` = `c0`.`Name` -) AS `u1` -GROUP BY `u1`.`Name`, `u1`.`Count` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` +ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Complex_GroupBy_after_set_operator_using_result_selector(bool async) + public override async Task Include_with_client_method_and_member_access_still_applies_includes(bool async) { - await base.Complex_GroupBy_after_set_operator_using_result_selector(async); + await base.Include_with_client_method_and_member_access_still_applies_includes(async); AssertSql( """ -SELECT `u1`.`Name`, `u1`.`Count`, IIF(SUM(`u1`.`Count`) IS NULL, 0, SUM(`u1`.`Count`)) AS `Sum` +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` FROM ( - SELECT `c`.`Name`, ( - SELECT COUNT(*) - FROM `Weapons` AS `w` - WHERE `u`.`FullName` = `w`.`OwnerFullName`) AS `Count` - FROM ( - SELECT `g`.`AssignedCityName`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`AssignedCityName`, `o`.`FullName` - FROM `Officers` AS `o` - ) AS `u` - LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` UNION ALL - SELECT `c0`.`Name`, ( - SELECT COUNT(*) - FROM `Weapons` AS `w0` - WHERE `u0`.`FullName` = `w0`.`OwnerFullName`) AS `Count` - FROM ( - SELECT `g0`.`CityOfBirthName`, `g0`.`FullName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`CityOfBirthName`, `o0`.`FullName` - FROM `Officers` AS `o0` - ) AS `u0` - INNER JOIN `Cities` AS `c0` ON `u0`.`CityOfBirthName` = `c0`.`Name` -) AS `u1` -GROUP BY `u1`.`Name`, `u1`.`Count` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` """); } - public override async Task Left_join_with_GroupBy_with_composite_group_key(bool async) + public override async Task Include_with_projection_of_unmapped_property_still_gets_applied(bool async) { - await base.Left_join_with_GroupBy_with_composite_group_key(async); + await base.Include_with_projection_of_unmapped_property_still_gets_applied(async); AssertSql( """ -SELECT `u`.`CityOfBirthName`, `u`.`HasSoulPatch` -FROM (( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`CityOfBirthName`, `g`.`HasSoulPatch` +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`CityOfBirthName`, `o`.`HasSoulPatch` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` 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` +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` +ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task GroupBy_with_boolean_grouping_key(bool async) + public override async Task Multiple_includes_with_client_method_around_entity_and_also_projecting_included_collection() { - await base.GroupBy_with_boolean_grouping_key(async); - + await base.Multiple_includes_with_client_method_around_entity_and_also_projecting_included_collection(); AssertSql( """ -SELECT `u0`.`CityOfBirthName`, `u0`.`HasSoulPatch`, `u0`.`IsMarcus`, COUNT(*) AS `Count` -FROM ( - SELECT `u`.`CityOfBirthName`, `u`.`HasSoulPatch`, IIF(`u`.`Nickname` = 'Marcus', TRUE, FALSE) AS `IsMarcus` +SELECT `s`.`Name`, `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`AssignedCityName`, `s0`.`CityOfBirthName`, `s0`.`FullName`, `s0`.`HasSoulPatch`, `s0`.`LeaderNickname`, `s0`.`LeaderSquadId`, `s0`.`Rank`, `s0`.`Discriminator`, `s0`.`Id`, `s0`.`AmmunitionType`, `s0`.`IsAutomatic`, `s0`.`Name`, `s0`.`OwnerFullName`, `s0`.`SynergyWithId` +FROM `Squads` AS `s` +LEFT JOIN ( + SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM ( - SELECT `g`.`Nickname`, `g`.`CityOfBirthName`, `g`.`HasSoulPatch` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`CityOfBirthName`, `o`.`HasSoulPatch` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -) AS `u0` -GROUP BY `u0`.`CityOfBirthName`, `u0`.`HasSoulPatch`, `u0`.`IsMarcus` + LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` +) AS `s0` ON `s`.`Id` = `s0`.`SquadId` +WHERE `s`.`Name` = 'Delta' +ORDER BY `s`.`Id`, `s0`.`Nickname`, `s0`.`SquadId` """); } - public override async Task GroupBy_with_boolean_groupin_key_thru_navigation_access(bool async) + public override async Task OrderBy_same_expression_containing_IsNull_correctly_deduplicates_the_ordering(bool async) { - await base.GroupBy_with_boolean_groupin_key_thru_navigation_access(async); + await base.OrderBy_same_expression_containing_IsNull_correctly_deduplicates_the_ordering(async); AssertSql( """ -SELECT `u`.`HasSoulPatch`, LCASE(`s`.`Name`) AS `Name` -FROM (`Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` +SELECT IIF(`u`.`LeaderNickname` IS NOT NULL, CBOOL(IIF(LEN(`u`.`Nickname`) IS NULL, NULL, CLNG(LEN(`u`.`Nickname`))) BXOR 5) BXOR TRUE, NULL) +FROM ( + SELECT `g`.`Nickname`, `g`.`LeaderNickname` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + SELECT `o`.`Nickname`, `o`.`LeaderNickname` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId`) -LEFT JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id` -GROUP BY `u`.`HasSoulPatch`, `s`.`Name` +) AS `u` +ORDER BY NOT (IIF(`u`.`LeaderNickname` IS NOT NULL, TRUE, FALSE)) """); } - public override async Task Group_by_over_projection_with_multiple_properties_accessed_thru_navigation(bool async) + public override async Task GetValueOrDefault_in_projection(bool async) { - await base.Group_by_over_projection_with_multiple_properties_accessed_thru_navigation(async); + await base.GetValueOrDefault_in_projection(async); AssertSql( - """ -SELECT `c`.`Name` -FROM ( - SELECT `g`.`CityOfBirthName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`CityOfBirthName` - FROM `Officers` AS `o` -) AS `u` -INNER JOIN `Cities` AS `c` ON `u`.`CityOfBirthName` = `c`.`Name` -GROUP BY `c`.`Name` +""" +SELECT IIF(`w`.`SynergyWithId` IS NULL, 0, `w`.`SynergyWithId`) +FROM `Weapons` AS `w` """); } - public override async Task Group_by_on_StartsWith_with_null_parameter_as_argument(bool async) + public override async Task GetValueOrDefault_in_filter(bool async) { - await base.Group_by_on_StartsWith_with_null_parameter_as_argument(async); + await base.GetValueOrDefault_in_filter(async); + + AssertSql( +""" +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM `Weapons` AS `w` +WHERE IIF(`w`.`SynergyWithId` IS NULL, 0, `w`.`SynergyWithId`) = 0 +"""); + } + + public override async Task GetValueOrDefault_in_filter_non_nullable_column(bool async) + { + await base.GetValueOrDefault_in_filter_non_nullable_column(async); AssertSql( """ -SELECT `u0`.`Key` -FROM ( - SELECT FALSE AS `Key` - FROM ( - SELECT `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`FullName` - FROM `Officers` AS `o` - ) AS `u` -) AS `u0` -GROUP BY `u0`.`Key` +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM `Weapons` AS `w` +WHERE `w`.`Id` = 0 +"""); + } + + public override async Task GetValueOrDefault_in_order_by(bool async) + { + await base.GetValueOrDefault_in_order_by(async); + + AssertSql( +""" +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM `Weapons` AS `w` +ORDER BY IIF(`w`.`SynergyWithId` IS NULL, 0, `w`.`SynergyWithId`), `w`.`Id` """); } - public override async Task Group_by_with_having_StartsWith_with_null_parameter_as_argument(bool async) + public override async Task GetValueOrDefault_with_argument(bool async) { - await base.Group_by_with_having_StartsWith_with_null_parameter_as_argument(async); + await base.GetValueOrDefault_with_argument(async); + AssertSql( - """ -SELECT `u`.`FullName` -FROM ( - SELECT `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -GROUP BY `u`.`FullName` -HAVING 0 = 1 +""" +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM `Weapons` AS `w` +WHERE IIF(`w`.`SynergyWithId` IS NULL, `w`.`Id`, `w`.`SynergyWithId`) = 1 """); } - public override async Task Select_StartsWith_with_null_parameter_as_argument(bool async) + public override async Task GetValueOrDefault_with_argument_complex(bool async) { - await base.Select_StartsWith_with_null_parameter_as_argument(async); + await base.GetValueOrDefault_with_argument_complex(async); AssertSql( - """ -SELECT FALSE -FROM ( - SELECT `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` +""" +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM `Weapons` AS `w` +WHERE IIF(`w`.`SynergyWithId` IS NULL, IIF(LEN(`w`.`Name`) IS NULL, NULL, CLNG(LEN(`w`.`Name`))) + 42, `w`.`SynergyWithId`) > 10 """); } - public override async Task Select_null_parameter_is_not_null(bool async) + public override async Task Filter_with_complex_predicate_containing_subquery(bool async) { - await base.Select_null_parameter_is_not_null(async); + await base.Filter_with_complex_predicate_containing_subquery(async); AssertSql( """ -@__p_0='False' - -SELECT CBOOL(@__p_0) +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( - SELECT 1 + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT 1 + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` +WHERE `u`.`FullName` <> 'Dom' AND EXISTS ( + SELECT 1 + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` AND `w`.`IsAutomatic` = TRUE) """); } - public override async Task Where_null_parameter_is_not_null(bool async) + public override async Task Query_with_complex_let_containing_ordering_and_filter_projecting_firstOrDefault_element_of_let( + bool async) { - await base.Where_null_parameter_is_not_null(async); + await base.Query_with_complex_let_containing_ordering_and_filter_projecting_firstOrDefault_element_of_let(async); AssertSql( """ -@__p_0='False' - -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +SELECT `u`.`Nickname`, ( + SELECT TOP 1 `w`.`Name` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` AND `w`.`IsAutomatic` = TRUE + ORDER BY `w`.`AmmunitionType` DESC) AS `WeaponName` FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + SELECT `g`.`Nickname`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`FullName` FROM `Officers` AS `o` ) AS `u` -WHERE @__p_0 = TRUE +WHERE `u`.`Nickname` <> 'Dom' """); } - public override async Task OrderBy_StartsWith_with_null_parameter_as_argument(bool async) + public override async Task + Null_semantics_is_correctly_applied_for_function_comparisons_that_take_arguments_from_optional_navigation(bool async) { - await base.OrderBy_StartsWith_with_null_parameter_as_argument(async); + await base.Null_semantics_is_correctly_applied_for_function_comparisons_that_take_arguments_from_optional_navigation(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` -ORDER BY `u`.`Nickname` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE IIF(`u`.`SquadId` IS NULL, NULL, MID(`t`.`Note`, 0 + 1, `u`.`SquadId`)) = `t`.`GearNickName` OR ((`t`.`Note` IS NULL OR `u`.`SquadId` IS NULL) AND `t`.`GearNickName` IS NULL) """); } - public override async Task OrderBy_Contains_empty_list(bool async) + public override async Task + Null_semantics_is_correctly_applied_for_function_comparisons_that_take_arguments_from_optional_navigation_complex(bool async) { - await base.OrderBy_Contains_empty_list(async); + await base.Null_semantics_is_correctly_applied_for_function_comparisons_that_take_arguments_from_optional_navigation_complex( + async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM (`Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + SELECT `o`.`Nickname`, `o`.`SquadId` FROM `Officers` AS `o` -) AS `u` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId`) +LEFT JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id` +WHERE IIF(LEN(`s`.`Name`) IS NULL, NULL, MID(`t`.`Note`, 0 + 1, IIF(LEN(`s`.`Name`) IS NULL, NULL, CLNG(LEN(`s`.`Name`))))) = `t`.`GearNickName` OR ((`t`.`Note` IS NULL OR `s`.`Name` IS NULL) AND `t`.`GearNickName` IS NULL) """); } - public override async Task Where_with_enum_flags_parameter(bool async) + public override async Task OfTypeNav1(bool async) { - await base.Where_with_enum_flags_parameter(async); + await base.OfTypeNav1(async); AssertSql( """ -@__rank_0='1' (Nullable = true) -@__rank_0='1' (Nullable = true) - -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -WHERE (`u`.`Rank` BAND @__rank_0) = @__rank_0 -""", - // - """ SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL +FROM (( SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -""", - // - """ -@__rank_0='2' (Nullable = true) -@__rank_0='2' (Nullable = true) +LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId`) +LEFT JOIN `Tags` AS `t0` ON `u`.`Nickname` = `t0`.`GearNickName` AND `u`.`SquadId` = `t0`.`GearSquadId` +WHERE (`t`.`Note` <> 'Foo' OR `t`.`Note` IS NULL) AND (`t0`.`Note` <> 'Bar' OR `t0`.`Note` IS NULL) +"""); + } -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -WHERE (`u`.`Rank` BOR @__rank_0) <> @__rank_0 -""", - // + public override async Task OfTypeNav2(bool async) + { + await base.OfTypeNav2(async); + + AssertSql( """ SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL +FROM (( SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -WHERE 0 = 1 +LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId`) +LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name` +WHERE (`t`.`Note` <> 'Foo' OR `t`.`Note` IS NULL) AND (`c`.`Location` <> 'Bar' OR `c`.`Location` IS NULL) """); } - public override async Task FirstOrDefault_navigation_access_entity_equality_in_where_predicate_apply_peneding_selector(bool async) + public override async Task OfTypeNav3(bool async) { - await base.FirstOrDefault_navigation_access_entity_equality_in_where_predicate_apply_peneding_selector(async); + await base.OfTypeNav3(async); AssertSql( """ SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL +FROM ((( SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name` -WHERE `c`.`Name` = ( - SELECT TOP 1 `c0`.`Name` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`CityOfBirthName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`CityOfBirthName` - FROM `Officers` AS `o0` - ) AS `u0` - INNER JOIN `Cities` AS `c0` ON `u0`.`CityOfBirthName` = `c0`.`Name` - ORDER BY `u0`.`Nickname`) OR (`c`.`Name` IS NULL AND ( - SELECT TOP 1 `c0`.`Name` - FROM ( - SELECT `g0`.`Nickname`, `g0`.`CityOfBirthName` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`CityOfBirthName` - FROM `Officers` AS `o0` - ) AS `u0` - INNER JOIN `Cities` AS `c0` ON `u0`.`CityOfBirthName` = `c0`.`Name` - ORDER BY `u0`.`Nickname`) IS NULL) +LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId`) +INNER JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName`) +LEFT JOIN `Tags` AS `t0` ON `u`.`Nickname` = `t0`.`GearNickName` AND `u`.`SquadId` = `t0`.`GearSquadId` +WHERE (`t`.`Note` <> 'Foo' OR `t`.`Note` IS NULL) AND (`t0`.`Note` <> 'Bar' OR `t0`.`Note` IS NULL) """); } - public override async Task Bitwise_operation_with_non_null_parameter_optimizes_null_checks(bool async) + public override async Task Nav_rewrite_Distinct_with_convert() { - await base.Bitwise_operation_with_non_null_parameter_optimizes_null_checks(async); + await base.Nav_rewrite_Distinct_with_convert(); + + AssertSql(); + } + + public override async Task Nav_rewrite_Distinct_with_convert_anonymous() + { + await base.Nav_rewrite_Distinct_with_convert_anonymous(); + + AssertSql(); + } + + public override async Task Nav_rewrite_with_convert1(bool async) + { + await base.Nav_rewrite_with_convert1(async); AssertSql( - """ -@__ranks_0='134' +""" +SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId` +FROM (`LocustHordes` AS `l` +LEFT JOIN `Cities` AS `c` ON `l`.`CapitalName` = `c`.`Name`) +LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` +WHERE `c`.`Name` <> 'Foo' OR `c`.`Name` IS NULL +"""); + } -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -WHERE (`u`.`Rank` BAND @__ranks_0) <> 0 -""", - // - """ -@__ranks_0='134' -@__ranks_0='134' + public override async Task Nav_rewrite_with_convert2(bool async) + { + await base.Nav_rewrite_with_convert2(async); -SELECT CBOOL((`u`.`Rank` BOR @__ranks_0) BXOR @__ranks_0) BXOR TRUE -FROM ( - SELECT `g`.`Rank` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Rank` - FROM `Officers` AS `o` -) AS `u` -""", - // + AssertSql( """ -@__ranks_0='134' -@__ranks_0='134' -@__ranks_0='134' - -SELECT CBOOL((`u`.`Rank` BOR (`u`.`Rank` BOR (@__ranks_0 BOR (`u`.`Rank` BOR @__ranks_0)))) BXOR @__ranks_0) BXOR TRUE -FROM ( - SELECT `g`.`Rank` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Rank` - FROM `Officers` AS `o` -) AS `u` +SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated` +FROM (`LocustHordes` AS `l` +LEFT JOIN `Cities` AS `c` ON `l`.`CapitalName` = `c`.`Name`) +LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` +WHERE (`c`.`Name` <> 'Foo' OR `c`.`Name` IS NULL) AND (`l0`.`Name` <> 'Bar' OR `l0`.`Name` IS NULL) """); } - public override async Task Bitwise_operation_with_null_arguments(bool async) + public override async Task Nav_rewrite_with_convert3(bool async) { - await base.Bitwise_operation_with_null_arguments(async); + await base.Nav_rewrite_with_convert3(async); AssertSql( -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` IS NULL -""", -// -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` IS NULL -""", -// -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` IS NULL -""", -// -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -""", -// -""" -@__prm_0='2' (Nullable = true) - -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND @__prm_0) <> 0 OR `w`.`AmmunitionType` IS NULL -""", -// -""" -@__prm_0='1' (Nullable = true) -@__prm_0='1' (Nullable = true) - -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND @__prm_0) = @__prm_0 + """ +SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated` +FROM (`LocustHordes` AS `l` +LEFT JOIN `Cities` AS `c` ON `l`.`CapitalName` = `c`.`Name`) +LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` +WHERE (`c`.`Name` <> 'Foo' OR `c`.`Name` IS NULL) AND (`l0`.`Name` <> 'Bar' OR `l0`.`Name` IS NULL) """); } - public override async Task Logical_operation_with_non_null_parameter_optimizes_null_checks(bool async) + public override async Task Where_contains_on_navigation_with_composite_keys(bool async) { - await base.Logical_operation_with_non_null_parameter_optimizes_null_checks(async); + await base.Where_contains_on_navigation_with_composite_keys(async); AssertSql( """ -@__prm_0='True' - -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -WHERE `u`.`HasSoulPatch` <> @__prm_0 -""", - // - """ -@__prm_0='False' - SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` @@ -10081,175 +8107,292 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -WHERE `u`.`HasSoulPatch` <> @__prm_0 +WHERE EXISTS ( + SELECT 1 + FROM `Cities` AS `c` + WHERE EXISTS ( + SELECT 1 + FROM ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`CityOfBirthName` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`CityOfBirthName` + FROM `Officers` AS `o0` + ) AS `u0` + WHERE `c`.`Name` = `u0`.`CityOfBirthName` AND `u0`.`Nickname` = `u`.`Nickname` AND `u0`.`SquadId` = `u`.`SquadId`)) """); } - public override async Task Cast_OfType_works_correctly(bool async) + public override async Task Include_with_complex_order_by(bool async) { - await base.Cast_OfType_works_correctly(async); + await base.Include_with_complex_order_by(async); AssertSql( -""" -SELECT `o`.`FullName` -FROM `Officers` AS `o` + """ +SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `s`.`Id`, `s`.`AmmunitionType`, `s`.`IsAutomatic`, `s`.`Name`, `s`.`OwnerFullName`, `s`.`SynergyWithId`, `s`.`c` +FROM ( + SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId`, ( + SELECT TOP 1 `w`.`Name` + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Gnasher%')) AS `c` + FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` + ) AS `u` + LEFT JOIN `Weapons` AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` +) AS `s` +ORDER BY `s`.`c`, `s`.`Nickname`, `s`.`SquadId` """); } - public override async Task Join_inner_source_custom_projection_followed_by_filter(bool async) + public override async Task Anonymous_projection_take_followed_by_projecting_single_element_from_collection_navigation(bool async) { - await base.Join_inner_source_custom_projection_followed_by_filter(async); + await base.Anonymous_projection_take_followed_by_projecting_single_element_from_collection_navigation(async); AssertSql( - """ -SELECT IIF(`l1`.`Name` = 'Locust', TRUE, NULL) AS `IsEradicated`, `l1`.`CommanderName`, `l1`.`Name` +""" +@__p_0='25' + +SELECT [t1].[Id], [t1].[AmmunitionType], [t1].[IsAutomatic], [t1].[Name], [t1].[OwnerFullName], [t1].[SynergyWithId] FROM ( - SELECT `l`.`Name` - FROM `LocustLeaders` AS `l` - UNION ALL - SELECT `l0`.`Name` - FROM `LocustCommanders` AS `l0` -) AS `u` -INNER JOIN `LocustHordes` AS `l1` ON `u`.`Name` = `l1`.`CommanderName` -WHERE IIF(`l1`.`Name` = 'Locust', TRUE, NULL) <> TRUE OR IIF(`l1`.`Name` = 'Locust', TRUE, NULL) IS NULL + SELECT TOP(@__p_0) [t].[FullName] + FROM ( + SELECT [g].[FullName] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[FullName] + FROM [Officers] AS [o] + ) AS [t] +) AS [t0] +LEFT JOIN ( + SELECT [t2].[Id], [t2].[AmmunitionType], [t2].[IsAutomatic], [t2].[Name], [t2].[OwnerFullName], [t2].[SynergyWithId] + FROM ( + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], ROW_NUMBER() OVER(PARTITION BY [w].[OwnerFullName] ORDER BY [w].[Id]) AS [row] + FROM [Weapons] AS [w] + ) AS [t2] + WHERE [t2].[row] <= 1 +) AS [t1] ON [t0].[FullName] = [t1].[OwnerFullName] """); } - public override async Task Byte_array_contains_literal(bool async) + public override async Task Bool_projection_from_subquery_treated_appropriately_in_where(bool async) { - await base.Byte_array_contains_literal(async); + await base.Bool_projection_from_subquery_treated_appropriately_in_where(async); AssertSql( """ -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE INSTR(1, STRCONV(`s`.`Banner`, 64), 0x01, 0) > 0 +SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` +FROM `Cities` AS `c` +WHERE ( + SELECT TOP 1 `u`.`HasSoulPatch` + FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` + ) AS `u` + ORDER BY `u`.`Nickname`, `u`.`SquadId`) = TRUE """); } - public override async Task Byte_array_filter_by_length_literal(bool async) + public override async Task DateTimeOffset_Contains_Less_than_Greater_than(bool async) { - var exception = await Assert.ThrowsAsync(() => base.Byte_array_filter_by_length_literal(async)); - } + var dto = JetTestHelpers.GetExpectedValue(new DateTimeOffset(599898024001234567, new TimeSpan(1, 30, 0))); + var start = dto.AddDays(-1); + var end = dto.AddDays(1); + var dates = new[] { dto }; - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public async Task Byte_array_filter_by_length_literal2(bool async) - { await AssertQuery( async, - ss => ss.Set().Where(w => EF.Functions.ByteArrayLength(w.Banner) == 2), - ss => ss.Set().Where(w => w.Banner != null && w.Banner.Length == 2)); + ss => ss.Set().Where( + m => start <= m.Timeline.Date && m.Timeline < end && dates.Contains(m.Timeline))); AssertSql( """ -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE IIF(ASCB(RIGHTB(`s`.`Banner`, 1)) = 0, LENB(`s`.`Banner`) - 1, LENB(`s`.`Banner`)) = 2 +@start='1902-01-01T08:30:00.0000000Z' (DbType = DateTime) +@end='1902-01-03T08:30:00.0000000Z' (DbType = DateTime) + +SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` +FROM `Missions` AS `m` +WHERE @start <= DATEVALUE(`m`.`Timeline`) AND `m`.`Timeline` < @end AND `m`.`Timeline` = CDATE('1902-01-02 08:30:00') """); } - public override async Task Byte_array_filter_by_length_parameter(bool async) + public override Task DateTimeOffsetNow_minus_timespan(bool async) + => AssertTranslationFailed(() => base.DateTimeOffsetNow_minus_timespan(async)); + + public override async Task Navigation_inside_interpolated_string_expanded(bool async) { - var exception = await Assert.ThrowsAsync(() => base.Byte_array_filter_by_length_parameter(async)); + await base.Navigation_inside_interpolated_string_expanded(async); + + AssertSql( +""" +SELECT IIF(`w`.`SynergyWithId` IS NOT NULL, TRUE, FALSE), `w0`.`OwnerFullName` +FROM `Weapons` AS `w` +LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +"""); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public async Task Byte_array_filter_by_length_parameter2(bool async) + public override async Task Left_join_projection_using_coalesce_tracking(bool async) { - var someByteArr = new[] { (byte)42, (byte)24 }; - await AssertQuery( - async, - ss => ss.Set().Where(w => EF.Functions.ByteArrayLength(w.Banner) == someByteArr.Length), - ss => ss.Set().Where(w => w.Banner != null && w.Banner.Length == someByteArr.Length)); - + await base.Left_join_projection_using_coalesce_tracking(async); AssertSql( """ -@__p_1='2' - -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE IIF(ASCB(RIGHTB(`s`.`Banner`, 1)) = 0, LENB(`s`.`Banner`) - 1, LENB(`s`.`Banner`)) = @__p_1 +SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator`, `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` +) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname` """); } - public override void Byte_array_filter_by_length_parameter_compiled() + public override async Task Left_join_projection_using_conditional_tracking(bool async) { - var exception = Assert.Throws(() => base.Byte_array_filter_by_length_parameter_compiled()); + await base.Left_join_projection_using_conditional_tracking(async); + AssertSql( + """ +SELECT IIF(`u0`.`Nickname` IS NULL OR `u0`.`SquadId` IS NULL, TRUE, FALSE), `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` +) AS `u0` ON `u`.`LeaderNickname` = `u0`.`Nickname` +"""); } - [ConditionalFact] - public virtual void Byte_array_filter_by_length_parameter_compiled2() + public override async Task Project_collection_navigation_nested_with_take_composite_key(bool async) { - var query = EF.CompileQuery( - (GearsOfWarContext context, byte[] byteArrayParam) - => context.Squads.Where(w => EF.Functions.ByteArrayLength(w.Banner) == EF.Functions.ByteArrayLength(byteArrayParam)).Count()); - - using var context = CreateContext(); - var byteQueryParam = new[] { (byte)42, (byte)128 }; - - Assert.Equal(2, query(context, byteQueryParam)); + await base.Project_collection_navigation_nested_with_take_composite_key(async); AssertSql( - """ -@__byteArrayParam='0x2A80' (Size = 510) -@__byteArrayParam='0x2A80' (Size = 510) -@__byteArrayParam='0x2A80' (Size = 510) -@__byteArrayParam='0x2A80' (Size = 510) -@__byteArrayParam='0x2A80' (Size = 510) -@__byteArrayParam='0x2A80' (Size = 510) - -SELECT COUNT(*) -FROM `Squads` AS `s` -WHERE IIF(ASCB(RIGHTB(`s`.`Banner`, 1)) = 0, LENB(`s`.`Banner`) - 1, LENB(`s`.`Banner`)) = IIF(IIF(ASCB(RIGHTB(@__byteArrayParam, 1)) = 0, LENB(@__byteArrayParam) - 1, LENB(@__byteArrayParam)) IS NULL, NULL, CLNG(IIF(ASCB(RIGHTB(@__byteArrayParam, 1)) = 0, LENB(@__byteArrayParam) - 1, LENB(@__byteArrayParam)))) +""" +SELECT [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] +FROM [Tags] AS [t] +LEFT JOIN ( + SELECT [g].[Nickname], [g].[SquadId], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] +LEFT JOIN ( + SELECT [t2].[Nickname], [t2].[SquadId], [t2].[AssignedCityName], [t2].[CityOfBirthName], [t2].[FullName], [t2].[HasSoulPatch], [t2].[LeaderNickname], [t2].[LeaderSquadId], [t2].[Rank], [t2].[Discriminator] + FROM ( + SELECT [t3].[Nickname], [t3].[SquadId], [t3].[AssignedCityName], [t3].[CityOfBirthName], [t3].[FullName], [t3].[HasSoulPatch], [t3].[LeaderNickname], [t3].[LeaderSquadId], [t3].[Rank], [t3].[Discriminator], ROW_NUMBER() OVER(PARTITION BY [t3].[LeaderNickname], [t3].[LeaderSquadId] ORDER BY [t3].[Nickname], [t3].[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] + 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 [t3] + ) AS [t2] + WHERE [t2].[row] <= 50 +) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND [t0].[SquadId] = [t1].[LeaderSquadId] +WHERE [t0].[Discriminator] = N'Officer' +ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname] """); } - public override async Task Byte_array_contains_parameter(bool async) + public override async Task Project_collection_navigation_nested_composite_key(bool async) { - await base.Byte_array_contains_parameter(async); + await base.Project_collection_navigation_nested_composite_key(async); AssertSql( """ -@__someByte_0='1' (Size = 1) - -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE INSTR(1, STRCONV(`s`.`Banner`, 64), CHR(@__someByte_0), 0) > 0 +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` +FROM (`Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId`) +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, '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` +WHERE `u`.`Discriminator` = 'Officer' +ORDER BY `t`.`Id`, `u`.`Nickname`, `u`.`SquadId`, `u0`.`Nickname` """); } - public override async Task Byte_array_filter_by_length_literal_does_not_cast_on_varbinary_n(bool async) + public override async Task Null_checks_in_correlated_predicate_are_correctly_translated(bool async) { - var exception = await Assert.ThrowsAsync(() => base.Byte_array_filter_by_length_literal_does_not_cast_on_varbinary_n(async)); + await base.Null_checks_in_correlated_predicate_are_correctly_translated(async); + + AssertSql( +""" +SELECT [t].[Id], [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] +FROM [Tags] AS [t] +LEFT JOIN ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] AND ([t].[Note] IS NOT NULL) +ORDER BY [t].[Id], [t0].[Nickname] +"""); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public async Task Byte_array_filter_by_length_literal_does_not_cast_on_varbinary_n2(bool async) + public override async Task SelectMany_Where_DefaultIfEmpty_with_navigation_in_the_collection_selector(bool async) { - await AssertQuery( - async, - ss => ss.Set().Where(w => EF.Functions.ByteArrayLength(w.Banner5) == 5), - ss => ss.Set().Where(w => w.Banner5 != null && w.Banner5.Length == 5)); + await base.SelectMany_Where_DefaultIfEmpty_with_navigation_in_the_collection_selector(async); AssertSql( """ -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE IIF(ASCB(RIGHTB(`s`.`Banner5`, 1)) = 0, LENB(`s`.`Banner5`) - 1, LENB(`s`.`Banner5`)) = 5 +@isAutomatic='True' + +SELECT `u`.`Nickname`, `u`.`FullName`, IIF(`w0`.`Id` IS NOT NULL, TRUE, FALSE) AS `Collection` +FROM ( + SELECT `g`.`Nickname`, `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN ( + SELECT `w`.`Id`, `w`.`OwnerFullName` + FROM `Weapons` AS `w` + WHERE `w`.`IsAutomatic` = @isAutomatic +) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` """); } - public override async Task Conditional_expression_with_test_being_simplified_to_constant_simple(bool isAsync) + public override async Task Join_with_inner_being_a_subquery_projecting_single_property(bool async) { - await base.Conditional_expression_with_test_being_simplified_to_constant_simple(isAsync); + await base.Join_with_inner_being_a_subquery_projecting_single_property(async); AssertSql( """ -@__prm_0='True' - SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` @@ -10258,19 +8401,22 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -WHERE IIF(`u`.`HasSoulPatch` = @__prm_0, TRUE, FALSE) = TRUE +INNER JOIN ( + SELECT `g0`.`Nickname` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname` + FROM `Officers` AS `o0` +) AS `u0` ON `u`.`Nickname` = `u0`.`Nickname` """); } - public override async Task Conditional_expression_with_test_being_simplified_to_constant_complex(bool isAsync) + public override async Task Join_with_inner_being_a_subquery_projecting_anonymous_type_with_single_property(bool async) { - await base.Conditional_expression_with_test_being_simplified_to_constant_complex(isAsync); + await base.Join_with_inner_being_a_subquery_projecting_anonymous_type_with_single_property(async); AssertSql( -""" -@__prm_0='True' -@__prm2_1='Marcus' Lancer' (Size = 255) - + """ SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` @@ -10279,562 +8425,695 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -WHERE IIF(`u`.`HasSoulPatch` = @__prm_0 AND ( - SELECT TOP 1 `w`.`Name` - FROM `Weapons` AS `w` - WHERE `w`.`Id` = `u`.`SquadId`) = @__prm2_1, TRUE, FALSE) = TRUE +INNER JOIN ( + SELECT `g0`.`Nickname` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname` + FROM `Officers` AS `o0` +) AS `u0` ON `u`.`Nickname` = `u0`.`Nickname` """); } - public override async Task OrderBy_bool_coming_from_optional_navigation(bool async) + public override async Task Navigation_based_on_complex_expression1(bool async) { - await base.OrderBy_bool_coming_from_optional_navigation(async); + await base.Navigation_based_on_complex_expression1(async); AssertSql( -""" -SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` -FROM `Weapons` AS `w` -LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY NOT (`w0`.`IsAutomatic`) + """ +SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated` +FROM `LocustHordes` AS `l` +LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` +WHERE `l0`.`Name` IS NOT NULL """); } - public override async Task DateTimeOffset_Date_returns_datetime(bool async) + public override async Task Navigation_based_on_complex_expression2(bool async) { - var dateTimeOffset = new DateTimeOffset(102, 3, 1, 8, 0, 0, new TimeSpan(-5, 0, 0)); - - await AssertQuery( - async, - ss => ss.Set().Where(m => m.Timeline.Date >= dateTimeOffset.Date)); + await base.Navigation_based_on_complex_expression2(async); AssertSql( """ -@__dateTimeOffset_Date_0='0102-03-01T00:00:00.0000000' (DbType = DateTime) +SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated` +FROM `LocustHordes` AS `l` +LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` +WHERE `l0`.`Name` IS NOT NULL +"""); + } -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEVALUE(`m`.`Timeline`) >= CDATE(@__dateTimeOffset_Date_0) + public override async Task Navigation_based_on_complex_expression3(bool async) + { + await base.Navigation_based_on_complex_expression3(async); + + AssertSql( +""" +SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId` +FROM `LocustHordes` AS `l` +LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`CommanderName` = `l0`.`Name` """); } - public override async Task Conditional_with_conditions_evaluating_to_false_gets_optimized(bool async) + public override async Task Navigation_based_on_complex_expression4(bool async) { - await base.Conditional_with_conditions_evaluating_to_false_gets_optimized(async); + await base.Navigation_based_on_complex_expression4(async); AssertSql( """ -SELECT `u`.`FullName` +SELECT TRUE, `l1`.`Name`, `l1`.`LocustHordeId`, `l1`.`ThreatLevel`, `l1`.`ThreatLevelByte`, `l1`.`ThreatLevelNullableByte`, `l1`.`DefeatedByNickname`, `l1`.`DefeatedBySquadId`, `l1`.`HighCommandId`, `s`.`Name0`, `s`.`LocustHordeId`, `s`.`ThreatLevel`, `s`.`ThreatLevelByte`, `s`.`ThreatLevelNullableByte`, `s`.`DefeatedByNickname`, `s`.`DefeatedBySquadId`, `s`.`HighCommandId`, `s`.`Discriminator` FROM ( - SELECT `g`.`Nickname`, `g`.`CityOfBirthName`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`CityOfBirthName`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` + SELECT `l`.`CommanderName`, `u`.`Name` AS `Name0`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` + FROM `LocustHordes` AS `l`, + ( + SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l0` + ) AS `u` +) AS `s` +LEFT JOIN `LocustCommanders` AS `l1` ON `s`.`CommanderName` = `l1`.`Name` """); } - public override async Task Conditional_with_conditions_evaluating_to_true_gets_optimized(bool async) + public override async Task Navigation_based_on_complex_expression5(bool async) { - await base.Conditional_with_conditions_evaluating_to_true_gets_optimized(async); + await base.Navigation_based_on_complex_expression5(async); AssertSql( - """ -SELECT `u`.`CityOfBirthName` -FROM ( - SELECT `g`.`Nickname`, `g`.`CityOfBirthName`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`CityOfBirthName`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` +""" +SELECT [l0].[Name], [l0].[LocustHordeId], [l0].[ThreatLevel], [l0].[ThreatLevelByte], [l0].[ThreatLevelNullableByte], [l0].[DefeatedByNickname], [l0].[DefeatedBySquadId], [l0].[HighCommandId], [t].[Name], [t].[LocustHordeId], [t].[ThreatLevel], [t].[ThreatLevelByte], [t].[ThreatLevelNullableByte], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId], [t].[Discriminator] +FROM [LocustHordes] AS [l] +CROSS JOIN ( + SELECT [l1].[Name], [l1].[LocustHordeId], [l1].[ThreatLevel], [l1].[ThreatLevelByte], [l1].[ThreatLevelNullableByte], [l1].[DefeatedByNickname], [l1].[DefeatedBySquadId], [l1].[HighCommandId], N'LocustCommander' AS [Discriminator] + FROM [LocustCommanders] AS [l1] +) AS [t] +LEFT JOIN [LocustCommanders] AS [l0] ON [l].[CommanderName] = [l0].[Name] """); } - public override async Task Projecting_required_string_column_compared_to_null_parameter(bool async) + public override async Task Navigation_based_on_complex_expression6(bool async) { - await base.Projecting_required_string_column_compared_to_null_parameter(async); + await base.Navigation_based_on_complex_expression6(async); + + AssertSql( +""" +SELECT CASE + WHEN [l0].[Name] = N'Queen Myrrah' AND ([l0].[Name] IS NOT NULL) THEN CAST(1 AS bit) + ELSE CAST(0 AS bit) +END, [l0].[Name], [l0].[LocustHordeId], [l0].[ThreatLevel], [l0].[ThreatLevelByte], [l0].[ThreatLevelNullableByte], [l0].[DefeatedByNickname], [l0].[DefeatedBySquadId], [l0].[HighCommandId], [t].[Name], [t].[LocustHordeId], [t].[ThreatLevel], [t].[ThreatLevelByte], [t].[ThreatLevelNullableByte], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId], [t].[Discriminator] +FROM [LocustHordes] AS [l] +CROSS JOIN ( + SELECT [l1].[Name], [l1].[LocustHordeId], [l1].[ThreatLevel], [l1].[ThreatLevelByte], [l1].[ThreatLevelNullableByte], [l1].[DefeatedByNickname], [l1].[DefeatedBySquadId], [l1].[HighCommandId], N'LocustCommander' AS [Discriminator] + FROM [LocustCommanders] AS [l1] +) AS [t] +LEFT JOIN [LocustCommanders] AS [l0] ON [l].[CommanderName] = [l0].[Name] +"""); + } + + public override async Task Select_as_operator(bool async) + { + await base.Select_as_operator(async); AssertSql( """ -SELECT FALSE -FROM ( - SELECT `g`.`Nickname` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname` - FROM `Officers` AS `o` -) AS `u` +SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` +FROM `LocustLeaders` AS `l` +UNION ALL +SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` +FROM `LocustCommanders` AS `l0` """); } - public override async Task Byte_array_filter_by_SequenceEqual(bool isAsync) + public override async Task Select_datetimeoffset_comparison_in_projection(bool async) { - await base.Byte_array_filter_by_SequenceEqual(isAsync); + await base.Select_datetimeoffset_comparison_in_projection(async); AssertSql( """ -@__byteArrayParam_0='0x0405060708' (Size = 5) - -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE `s`.`Banner5` = @__byteArrayParam_0 +SELECT IIF(`m`.`Timeline` > NOW(), TRUE, FALSE) +FROM `Missions` AS `m` """); } - public override async Task Group_by_nullable_property_HasValue_and_project_the_grouping_key(bool async) + public override async Task OfType_in_subquery_works(bool async) { - await base.Group_by_nullable_property_HasValue_and_project_the_grouping_key(async); + await base.OfType_in_subquery_works(async); AssertSql( """ -SELECT `w0`.`Key` -FROM ( - SELECT IIF(`w`.`SynergyWithId` IS NOT NULL, TRUE, FALSE) AS `Key` - FROM `Weapons` AS `w` -) AS `w0` -GROUP BY `w0`.`Key` +SELECT `s`.`Name`, `s`.`Location`, `s`.`Nation` +FROM `Officers` AS `o` +INNER JOIN ( + SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation`, `u`.`LeaderNickname`, `u`.`LeaderSquadId` + FROM ( + SELECT `o0`.`AssignedCityName`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId` + FROM `Officers` AS `o0` + ) AS `u` + LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name` +) AS `s` ON `o`.`Nickname` = `s`.`LeaderNickname` AND `o`.`SquadId` = `s`.`LeaderSquadId` +"""); + } + + public override async Task Nullable_bool_comparison_is_translated_to_server(bool async) + { + await base.Nullable_bool_comparison_is_translated_to_server(async); + + AssertSql( +""" +SELECT IIF(`l`.`Eradicated` = TRUE AND `l`.`Eradicated` IS NOT NULL, TRUE, FALSE) AS `IsEradicated` +FROM `LocustHordes` AS `l` """); } - public override async Task Group_by_nullable_property_and_project_the_grouping_key_HasValue(bool async) + public override async Task Accessing_reference_navigation_collection_composition_generates_single_query(bool async) { - await base.Group_by_nullable_property_and_project_the_grouping_key_HasValue(async); + await base.Accessing_reference_navigation_collection_composition_generates_single_query(async); AssertSql( -""" -SELECT IIF(`w`.`SynergyWithId` IS NOT NULL, TRUE, FALSE) -FROM `Weapons` AS `w` -GROUP BY `w`.`SynergyWithId` + """ +SELECT `u`.`Nickname`, `u`.`SquadId`, `s`.`Id`, `s`.`IsAutomatic`, `s`.`Name`, `s`.`Id0` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN ( + SELECT `w`.`Id`, `w`.`IsAutomatic`, `w0`.`Name`, `w0`.`Id` AS `Id0`, `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` """); } - public override async Task Checked_context_with_cast_does_not_fail(bool isAsync) + public override async Task Reference_include_chain_loads_correctly_when_middle_is_null(bool async) { - await base.Checked_context_with_cast_does_not_fail(isAsync); + await base.Reference_include_chain_loads_correctly_when_middle_is_null(async); AssertSql( """ -SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` -FROM ( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l` +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note`, `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` +FROM (`Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` UNION ALL - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l0` -) AS `u` -WHERE CBYTE(`u`.`ThreatLevel`) >= CBYTE(5) + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId`) +LEFT JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id` +ORDER BY `t`.`Note` """); } - public override async Task Checked_context_with_addition_does_not_fail(bool isAsync) + public override async Task Accessing_property_of_optional_navigation_in_child_projection_works(bool async) { - await base.Checked_context_with_addition_does_not_fail(isAsync); + await base.Accessing_property_of_optional_navigation_in_child_projection_works(async); AssertSql( """ -SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` -FROM ( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l` +SELECT IIF(`u`.`Nickname` IS NOT NULL AND `u`.`SquadId` IS NOT NULL, TRUE, FALSE), `t`.`Id`, `u`.`Nickname`, `u`.`SquadId`, `s`.`Nickname`, `s`.`Id`, `s`.`SquadId` +FROM (`Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + FROM `Gears` AS `g` UNION ALL - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l0` -) AS `u` -WHERE CLNG(`u`.`ThreatLevel`) <= (5 + CLNG(`u`.`ThreatLevel`)) + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + 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` + FROM `Weapons` AS `w` + LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`FullName` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `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` """); } - public override async Task TimeSpan_Hours(bool async) + public override async Task Collection_navigation_ofType_filter_works(bool async) { - await base.TimeSpan_Hours(async); + await base.Collection_navigation_ofType_filter_works(async); AssertSql( -""" -SELECT DATEPART('h', `m`.`Duration`) -FROM `Missions` AS `m` + """ +SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` +FROM `Cities` AS `c` +WHERE EXISTS ( + SELECT 1 + FROM ( + SELECT `o`.`Nickname`, `o`.`CityOfBirthName` + FROM `Officers` AS `o` + ) AS `u` + WHERE `c`.`Name` = `u`.`CityOfBirthName` AND `u`.`Nickname` = 'Marcus') """); } - public override async Task TimeSpan_Minutes(bool async) + public override async Task Query_reusing_parameter_doesnt_declare_duplicate_parameter(bool async) { - await base.TimeSpan_Minutes(async); + await base.Query_reusing_parameter_doesnt_declare_duplicate_parameter(async); AssertSql( -""" -SELECT DATEPART('n', `m`.`Duration`) -FROM `Missions` AS `m` + """ +@prm_Inner_Nickname='Marcus' (Size = 255) + +SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` +FROM ( + SELECT DISTINCT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` + FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` + ) AS `u` + WHERE `u`.`Nickname` <> @prm_Inner_Nickname +) AS `u0` +ORDER BY `u0`.`FullName` """); } - public override async Task TimeSpan_Seconds(bool async) + public override async Task Query_reusing_parameter_with_inner_query_doesnt_declare_duplicate_parameter(bool async) { - await base.TimeSpan_Seconds(async); + await base.Query_reusing_parameter_with_inner_query_doesnt_declare_duplicate_parameter(async); AssertSql( -""" -SELECT DATEPART('s', `m`.`Duration`) -FROM `Missions` AS `m` + """ +@squadId='1' +@squadId='1' + +SELECT `u1`.`Nickname`, `u1`.`SquadId`, `u1`.`AssignedCityName`, `u1`.`CityOfBirthName`, `u1`.`FullName`, `u1`.`HasSoulPatch`, `u1`.`LeaderNickname`, `u1`.`LeaderSquadId`, `u1`.`Rank`, `u1`.`Discriminator` +FROM ( + SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` + FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` + ) AS `u` + INNER JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id` + WHERE `s`.`Id` IN ( + SELECT `s0`.`Id` + FROM `Squads` AS `s0` + WHERE `s0`.`Id` = @squadId + ) + UNION ALL + SELECT `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` + FROM ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` + ) AS `u0` + INNER JOIN `Squads` AS `s1` ON `u0`.`SquadId` = `s1`.`Id` + WHERE `s1`.`Id` IN ( + SELECT `s2`.`Id` + FROM `Squads` AS `s2` + WHERE `s2`.`Id` = @squadId + ) +) AS `u1` +ORDER BY `u1`.`FullName` """); } - public override async Task TimeSpan_Milliseconds(bool async) + public override async Task Query_reusing_parameter_with_inner_query_expression_doesnt_declare_duplicate_parameter(bool async) { - await base.TimeSpan_Milliseconds(async); + await base.Query_reusing_parameter_with_inner_query_expression_doesnt_declare_duplicate_parameter(async); AssertSql( -""" -SELECT DATEPART(millisecond, [m].[Duration]) -FROM [Missions] AS [m] + """ +@gearId='1' +@gearId='1' + +SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` +FROM `Squads` AS `s` +WHERE EXISTS ( + SELECT 1 + FROM ( + SELECT `g`.`SquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`SquadId` + FROM `Officers` AS `o` + ) AS `u` + WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`SquadId` = @gearId AND `u`.`SquadId` = @gearId) """); } - public override async Task Where_TimeSpan_Hours(bool async) + public override async Task Query_reusing_parameter_doesnt_declare_duplicate_parameter_complex(bool async) { - await base.Where_TimeSpan_Hours(async); + await base.Query_reusing_parameter_doesnt_declare_duplicate_parameter_complex(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('h', `m`.`Duration`) = 1 +@entity_equality_prm_Inner_Squad_Id='1' (Nullable = true) +@entity_equality_prm_Inner_Squad_Id='1' (Nullable = true) + +SELECT `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`AssignedCityName`, `s1`.`CityOfBirthName`, `s1`.`FullName`, `s1`.`HasSoulPatch`, `s1`.`LeaderNickname`, `s1`.`LeaderSquadId`, `s1`.`Rank`, `s1`.`Discriminator` +FROM ( + SELECT DISTINCT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` + FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` + ) AS `u` + INNER JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id` + WHERE `s`.`Id` = @entity_equality_prm_Inner_Squad_Id +) AS `s1` +INNER JOIN `Squads` AS `s0` ON `s1`.`SquadId` = `s0`.`Id` +WHERE `s0`.`Id` = @entity_equality_prm_Inner_Squad_Id +ORDER BY `s1`.`FullName` """); } - public override async Task Where_TimeSpan_Minutes(bool async) + public override async Task Complex_GroupBy_after_set_operator(bool async) { - await base.Where_TimeSpan_Minutes(async); + await base.Complex_GroupBy_after_set_operator(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('n', `m`.`Duration`) = 2 +SELECT `u1`.`Name`, `u1`.`Count`, IIF(SUM(`u1`.`Count`) IS NULL, 0, SUM(`u1`.`Count`)) AS `Sum` +FROM ( + SELECT `c`.`Name`, ( + SELECT COUNT(*) + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName`) AS `Count` + FROM ( + SELECT `g`.`AssignedCityName`, `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`AssignedCityName`, `o`.`FullName` + FROM `Officers` AS `o` + ) AS `u` + LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name` + UNION ALL + SELECT `c0`.`Name`, ( + SELECT COUNT(*) + FROM `Weapons` AS `w0` + WHERE `u0`.`FullName` = `w0`.`OwnerFullName`) AS `Count` + FROM ( + SELECT `g0`.`CityOfBirthName`, `g0`.`FullName` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`CityOfBirthName`, `o0`.`FullName` + FROM `Officers` AS `o0` + ) AS `u0` + INNER JOIN `Cities` AS `c0` ON `u0`.`CityOfBirthName` = `c0`.`Name` +) AS `u1` +GROUP BY `u1`.`Name`, `u1`.`Count` """); } - public override async Task Where_TimeSpan_Seconds(bool async) + public override async Task Complex_GroupBy_after_set_operator_using_result_selector(bool async) { - await base.Where_TimeSpan_Seconds(async); + await base.Complex_GroupBy_after_set_operator_using_result_selector(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('s', `m`.`Duration`) = 3 +SELECT `u1`.`Name`, `u1`.`Count`, IIF(SUM(`u1`.`Count`) IS NULL, 0, SUM(`u1`.`Count`)) AS `Sum` +FROM ( + SELECT `c`.`Name`, ( + SELECT COUNT(*) + FROM `Weapons` AS `w` + WHERE `u`.`FullName` = `w`.`OwnerFullName`) AS `Count` + FROM ( + SELECT `g`.`AssignedCityName`, `g`.`FullName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`AssignedCityName`, `o`.`FullName` + FROM `Officers` AS `o` + ) AS `u` + LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name` + UNION ALL + SELECT `c0`.`Name`, ( + SELECT COUNT(*) + FROM `Weapons` AS `w0` + WHERE `u0`.`FullName` = `w0`.`OwnerFullName`) AS `Count` + FROM ( + SELECT `g0`.`CityOfBirthName`, `g0`.`FullName` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`CityOfBirthName`, `o0`.`FullName` + FROM `Officers` AS `o0` + ) AS `u0` + INNER JOIN `Cities` AS `c0` ON `u0`.`CityOfBirthName` = `c0`.`Name` +) AS `u1` +GROUP BY `u1`.`Name`, `u1`.`Count` """); } - public override async Task Where_TimeSpan_Milliseconds(bool async) + public override async Task Left_join_with_GroupBy_with_composite_group_key(bool async) { - await base.Where_TimeSpan_Milliseconds(async); + await base.Left_join_with_GroupBy_with_composite_group_key(async); AssertSql( -""" -SELECT [m].[Id], [m].[CodeName], [m].[Duration], [m].[Rating], [m].[Timeline] -FROM [Missions] AS [m] -WHERE DATEPART(millisecond, [m].[Duration]) = 1 + """ +SELECT `u`.`CityOfBirthName`, `u`.`HasSoulPatch` +FROM (( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`CityOfBirthName`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `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` """); } - public override async Task Contains_on_collection_of_byte_subquery(bool async) + public override async Task GroupBy_with_boolean_grouping_key(bool async) { - await base.Contains_on_collection_of_byte_subquery(async); + await base.GroupBy_with_boolean_grouping_key(async); AssertSql( """ -SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` +SELECT `u0`.`CityOfBirthName`, `u0`.`HasSoulPatch`, `u0`.`IsMarcus`, COUNT(*) AS `Count` FROM ( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l` - UNION ALL - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l0` -) AS `u` -WHERE `u`.`ThreatLevelByte` IN ( - SELECT `u0`.`ThreatLevelByte` + SELECT `u`.`CityOfBirthName`, `u`.`HasSoulPatch`, IIF(`u`.`Nickname` = 'Marcus', TRUE, FALSE) AS `IsMarcus` FROM ( - SELECT `l1`.`ThreatLevelByte` - FROM `LocustLeaders` AS `l1` + SELECT `g`.`Nickname`, `g`.`CityOfBirthName`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` UNION ALL - SELECT `l2`.`ThreatLevelByte` - FROM `LocustCommanders` AS `l2` - ) AS `u0` -) + SELECT `o`.`Nickname`, `o`.`CityOfBirthName`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` + ) AS `u` +) AS `u0` +GROUP BY `u0`.`CityOfBirthName`, `u0`.`HasSoulPatch`, `u0`.`IsMarcus` """); } - public override async Task Contains_on_collection_of_nullable_byte_subquery(bool async) + public override async Task GroupBy_with_boolean_groupin_key_thru_navigation_access(bool async) { - await base.Contains_on_collection_of_nullable_byte_subquery(async); + await base.GroupBy_with_boolean_groupin_key_thru_navigation_access(async); AssertSql( """ -SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` -FROM ( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l` +SELECT `u`.`HasSoulPatch`, LCASE(`s`.`Name`) AS `Name` +FROM (`Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` UNION ALL - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l0` -) AS `u` -WHERE EXISTS ( - SELECT 1 - FROM ( - SELECT `l1`.`ThreatLevelNullableByte` - FROM `LocustLeaders` AS `l1` - UNION ALL - SELECT `l2`.`ThreatLevelNullableByte` - FROM `LocustCommanders` AS `l2` - ) AS `u0` - WHERE `u0`.`ThreatLevelNullableByte` = `u`.`ThreatLevelNullableByte` OR (`u0`.`ThreatLevelNullableByte` IS NULL AND `u`.`ThreatLevelNullableByte` IS NULL)) + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId`) +LEFT JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id` +GROUP BY `u`.`HasSoulPatch`, `s`.`Name` """); } - public override async Task Contains_on_collection_of_nullable_byte_subquery_null_constant(bool async) + public override async Task Group_by_over_projection_with_multiple_properties_accessed_thru_navigation(bool async) { - await base.Contains_on_collection_of_nullable_byte_subquery_null_constant(async); + await base.Group_by_over_projection_with_multiple_properties_accessed_thru_navigation(async); AssertSql( """ -SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` +SELECT `c`.`Name` FROM ( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l` + SELECT `g`.`CityOfBirthName` + FROM `Gears` AS `g` UNION ALL - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l0` + SELECT `o`.`CityOfBirthName` + FROM `Officers` AS `o` ) AS `u` -WHERE EXISTS ( - SELECT 1 - FROM ( - SELECT `l1`.`ThreatLevelNullableByte` - FROM `LocustLeaders` AS `l1` - UNION ALL - SELECT `l2`.`ThreatLevelNullableByte` - FROM `LocustCommanders` AS `l2` - ) AS `u0` - WHERE `u0`.`ThreatLevelNullableByte` IS NULL) +INNER JOIN `Cities` AS `c` ON `u`.`CityOfBirthName` = `c`.`Name` +GROUP BY `c`.`Name` """); } - public override async Task Contains_on_collection_of_nullable_byte_subquery_null_parameter(bool async) + public override async Task Group_by_on_StartsWith_with_null_parameter_as_argument(bool async) { - await base.Contains_on_collection_of_nullable_byte_subquery_null_parameter(async); + await base.Group_by_on_StartsWith_with_null_parameter_as_argument(async); AssertSql( """ -SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` +SELECT `u0`.`Key` FROM ( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l` - UNION ALL - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l0` -) AS `u` -WHERE EXISTS ( - SELECT 1 + SELECT FALSE AS `Key` FROM ( - SELECT `l1`.`ThreatLevelNullableByte` - FROM `LocustLeaders` AS `l1` + SELECT `g`.`FullName` + FROM `Gears` AS `g` UNION ALL - SELECT `l2`.`ThreatLevelNullableByte` - FROM `LocustCommanders` AS `l2` - ) AS `u0` - WHERE `u0`.`ThreatLevelNullableByte` IS NULL) + SELECT `o`.`FullName` + FROM `Officers` AS `o` + ) AS `u` +) AS `u0` +GROUP BY `u0`.`Key` """); } - public override async Task Contains_on_byte_array_property_using_byte_column(bool async) + public override async Task Group_by_with_having_StartsWith_with_null_parameter_as_argument(bool async) { - await base.Contains_on_byte_array_property_using_byte_column(async); - + await base.Group_by_with_having_StartsWith_with_null_parameter_as_argument(async); AssertSql( """ -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name`, `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` -FROM `Squads` AS `s`, -( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` - FROM `LocustLeaders` AS `l` +SELECT `u`.`FullName` +FROM ( + SELECT `g`.`FullName` + FROM `Gears` AS `g` UNION ALL - SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l0` + SELECT `o`.`FullName` + FROM `Officers` AS `o` ) AS `u` -WHERE INSTR(1, STRCONV(`s`.`Banner`, 64), CHR(`u`.`ThreatLevelByte`), 0) > 0 +GROUP BY `u`.`FullName` +HAVING 0 = 1 """); } - public override async Task Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion( - bool async) + public override async Task Select_StartsWith_with_null_parameter_as_argument(bool async) { - await base.Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion(async); + await base.Select_StartsWith_with_null_parameter_as_argument(async); AssertSql( -""" -SELECT [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] + """ +SELECT FALSE FROM ( - SELECT [l].[ThreatLevelByte] - FROM [LocustLeaders] AS [l] + SELECT `g`.`FullName` + FROM `Gears` AS `g` UNION ALL - SELECT [l0].[ThreatLevelByte] - FROM [LocustCommanders] AS [l0] -) AS [t] -CROSS APPLY ( - SELECT [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] - ) AS [t0] - WHERE EXISTS ( - SELECT 1 - FROM ( - SELECT [l1].[Name], [l1].[LocustHordeId], [l1].[ThreatLevel], [l1].[ThreatLevelByte], [l1].[ThreatLevelNullableByte], NULL AS [DefeatedByNickname], NULL AS [DefeatedBySquadId], NULL AS [HighCommandId], N'LocustLeader' AS [Discriminator] - FROM [LocustLeaders] AS [l1] - UNION ALL - SELECT [l2].[Name], [l2].[LocustHordeId], [l2].[ThreatLevel], [l2].[ThreatLevelByte], [l2].[ThreatLevelNullableByte], [l2].[DefeatedByNickname], [l2].[DefeatedBySquadId], [l2].[HighCommandId], N'LocustCommander' AS [Discriminator] - FROM [LocustCommanders] AS [l2] - ) AS [t2] - WHERE [t2].[ThreatLevelByte] = [t].[ThreatLevelByte]) -) AS [t1] + SELECT `o`.`FullName` + FROM `Officers` AS `o` +) AS `u` """); } - public override async Task Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion_negated( - bool async) + public override async Task Select_null_parameter_is_not_null(bool async) { - await base.Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion_negated(async); + await base.Select_null_parameter_is_not_null(async); AssertSql( -""" -SELECT [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] + """ +@p='False' + +SELECT CBOOL(@p) FROM ( - SELECT [l].[ThreatLevelByte] - FROM [LocustLeaders] AS [l] + SELECT 1 + FROM `Gears` AS `g` UNION ALL - SELECT [l0].[ThreatLevelByte] - FROM [LocustCommanders] AS [l0] -) AS [t] -CROSS APPLY ( - SELECT [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] - ) AS [t0] - WHERE NOT (EXISTS ( - SELECT 1 - FROM ( - SELECT [l1].[Name], [l1].[LocustHordeId], [l1].[ThreatLevel], [l1].[ThreatLevelByte], [l1].[ThreatLevelNullableByte], NULL AS [DefeatedByNickname], NULL AS [DefeatedBySquadId], NULL AS [HighCommandId], N'LocustLeader' AS [Discriminator] - FROM [LocustLeaders] AS [l1] - UNION ALL - SELECT [l2].[Name], [l2].[LocustHordeId], [l2].[ThreatLevel], [l2].[ThreatLevelByte], [l2].[ThreatLevelNullableByte], [l2].[DefeatedByNickname], [l2].[DefeatedBySquadId], [l2].[HighCommandId], N'LocustCommander' AS [Discriminator] - FROM [LocustCommanders] AS [l2] - ) AS [t2] - WHERE [t2].[ThreatLevelByte] = [t].[ThreatLevelByte])) -) AS [t1] + SELECT 1 + FROM `Officers` AS `o` +) AS `u` """); } - public override async Task Subquery_projecting_nullable_scalar_contains_nullable_value_needs_null_expansion(bool async) + public override async Task Where_null_parameter_is_not_null(bool async) { - await base.Subquery_projecting_nullable_scalar_contains_nullable_value_needs_null_expansion(async); + await base.Where_null_parameter_is_not_null(async); AssertSql( -""" -SELECT [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] + """ +@p='False' + +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( - SELECT [l].[ThreatLevelNullableByte] - FROM [LocustLeaders] AS [l] + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` UNION ALL - SELECT [l0].[ThreatLevelNullableByte] - FROM [LocustCommanders] AS [l0] -) AS [t] -CROSS APPLY ( - SELECT [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] - ) AS [t0] - WHERE EXISTS ( - SELECT 1 - FROM ( - SELECT [l1].[Name], [l1].[LocustHordeId], [l1].[ThreatLevel], [l1].[ThreatLevelByte], [l1].[ThreatLevelNullableByte], NULL AS [DefeatedByNickname], NULL AS [DefeatedBySquadId], NULL AS [HighCommandId], N'LocustLeader' AS [Discriminator] - FROM [LocustLeaders] AS [l1] - UNION ALL - SELECT [l2].[Name], [l2].[LocustHordeId], [l2].[ThreatLevel], [l2].[ThreatLevelByte], [l2].[ThreatLevelNullableByte], [l2].[DefeatedByNickname], [l2].[DefeatedBySquadId], [l2].[HighCommandId], N'LocustCommander' AS [Discriminator] - FROM [LocustCommanders] AS [l2] - ) AS [t2] - WHERE [t2].[ThreatLevelNullableByte] = [t].[ThreatLevelNullableByte] OR (([t2].[ThreatLevelNullableByte] IS NULL) AND ([t].[ThreatLevelNullableByte] IS NULL))) -) AS [t1] + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +WHERE @p = TRUE """); } - public override async Task Subquery_projecting_nullable_scalar_contains_nullable_value_needs_null_expansion_negated(bool async) + public override async Task OrderBy_StartsWith_with_null_parameter_as_argument(bool async) { - await base.Subquery_projecting_nullable_scalar_contains_nullable_value_needs_null_expansion_negated(async); + await base.OrderBy_StartsWith_with_null_parameter_as_argument(async); AssertSql( -""" -SELECT [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] + """ +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( - SELECT [l].[ThreatLevelNullableByte] - FROM [LocustLeaders] AS [l] + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` UNION ALL - SELECT [l0].[ThreatLevelNullableByte] - FROM [LocustCommanders] AS [l0] -) AS [t] -CROSS APPLY ( - SELECT [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] - ) AS [t0] - WHERE NOT (EXISTS ( - SELECT 1 - FROM ( - SELECT [l1].[Name], [l1].[LocustHordeId], [l1].[ThreatLevel], [l1].[ThreatLevelByte], [l1].[ThreatLevelNullableByte], NULL AS [DefeatedByNickname], NULL AS [DefeatedBySquadId], NULL AS [HighCommandId], N'LocustLeader' AS [Discriminator] - FROM [LocustLeaders] AS [l1] - UNION ALL - SELECT [l2].[Name], [l2].[LocustHordeId], [l2].[ThreatLevel], [l2].[ThreatLevelByte], [l2].[ThreatLevelNullableByte], [l2].[DefeatedByNickname], [l2].[DefeatedBySquadId], [l2].[HighCommandId], N'LocustCommander' AS [Discriminator] - FROM [LocustCommanders] AS [l2] - ) AS [t2] - WHERE [t2].[ThreatLevelNullableByte] = [t].[ThreatLevelNullableByte] OR (([t2].[ThreatLevelNullableByte] IS NULL) AND ([t].[ThreatLevelNullableByte] IS NULL)))) -) AS [t1] + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +ORDER BY `u`.`Nickname` """); } - public override async Task Enum_closure_typed_as_underlying_type_generates_correct_parameter_type(bool async) + public override async Task OrderBy_Contains_empty_list(bool async) { - await base.Enum_closure_typed_as_underlying_type_generates_correct_parameter_type(async); + await base.OrderBy_Contains_empty_list(async); AssertSql( -""" -@__prm_0='1' (Nullable = true) - -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -WHERE @__prm_0 = `w`.`AmmunitionType` + """ +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` """); } - public override async Task Enum_flags_closure_typed_as_underlying_type_generates_correct_parameter_type(bool async) + public override async Task Where_with_enum_flags_parameter(bool async) { - await base.Enum_flags_closure_typed_as_underlying_type_generates_correct_parameter_type(async); + await base.Where_with_enum_flags_parameter(async); AssertSql( """ -@__prm_0='133' +@rank='1' (Nullable = true) +@rank='1' (Nullable = true) + +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +WHERE (`u`.`Rank` BAND @rank) = @rank +""", + // + """ +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +""", + // + """ +@rank='2' (Nullable = true) +@rank='2' (Nullable = true) SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( @@ -10844,18 +9123,28 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -WHERE (@__prm_0 BAND `u`.`Rank`) = `u`.`Rank` +WHERE (`u`.`Rank` BOR @rank) <> @rank +""", + // + """ +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +WHERE 0 = 1 """); } - public override async Task Enum_flags_closure_typed_as_different_type_generates_correct_parameter_type(bool async) + public override async Task FirstOrDefault_navigation_access_entity_equality_in_where_predicate_apply_peneding_selector(bool async) { - await base.Enum_flags_closure_typed_as_different_type_generates_correct_parameter_type(async); + await base.FirstOrDefault_navigation_access_entity_equality_in_where_predicate_apply_peneding_selector(async); AssertSql( """ -@__prm_0='5' - SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` @@ -10864,48 +9153,147 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -WHERE (@__prm_0 BAND CLNG(`u`.`Rank`)) = CLNG(`u`.`Rank`) +LEFT JOIN `Cities` AS `c` ON `u`.`AssignedCityName` = `c`.`Name` +WHERE `c`.`Name` = ( + SELECT TOP 1 `c0`.`Name` + FROM ( + SELECT `g0`.`Nickname`, `g0`.`CityOfBirthName` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`CityOfBirthName` + FROM `Officers` AS `o0` + ) AS `u0` + INNER JOIN `Cities` AS `c0` ON `u0`.`CityOfBirthName` = `c0`.`Name` + ORDER BY `u0`.`Nickname`) OR (`c`.`Name` IS NULL AND ( + SELECT TOP 1 `c0`.`Name` + FROM ( + SELECT `g0`.`Nickname`, `g0`.`CityOfBirthName` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`CityOfBirthName` + FROM `Officers` AS `o0` + ) AS `u0` + INNER JOIN `Cities` AS `c0` ON `u0`.`CityOfBirthName` = `c0`.`Name` + ORDER BY `u0`.`Nickname`) IS NULL) """); } - public override async Task Constant_enum_with_same_underlying_value_as_previously_parameterized_int(bool async) + public override async Task Bitwise_operation_with_non_null_parameter_optimizes_null_checks(bool async) { - await base.Constant_enum_with_same_underlying_value_as_previously_parameterized_int(async); + await base.Bitwise_operation_with_non_null_parameter_optimizes_null_checks(async); AssertSql( """ -SELECT TOP 1 `u`.`Rank` BAND 1 +@ranks='134' + +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( - SELECT `g`.`Nickname`, `g`.`Rank` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`Rank` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +WHERE (`u`.`Rank` BAND @ranks) <> 0 +""", + // + """ +@ranks='134' +@ranks='134' + +SELECT CBOOL((`u`.`Rank` BOR @ranks) BXOR @ranks) BXOR TRUE +FROM ( + SELECT `g`.`Rank` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Rank` + FROM `Officers` AS `o` +) AS `u` +""", + // + """ +@ranks='134' +@ranks='134' +@ranks='134' + +SELECT CBOOL((`u`.`Rank` BOR (`u`.`Rank` BOR (@ranks BOR (`u`.`Rank` BOR @ranks)))) BXOR @ranks) BXOR TRUE +FROM ( + SELECT `g`.`Rank` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Rank` FROM `Officers` AS `o` ) AS `u` -ORDER BY `u`.`Nickname` """); } - public override async Task Enum_array_contains(bool async) + public override async Task Bitwise_operation_with_null_arguments(bool async) { - await base.Enum_array_contains(async); + await base.Bitwise_operation_with_null_arguments(async); AssertSql( -""" + """ SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` -LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -WHERE `w0`.`Id` IS NOT NULL AND (`w0`.`AmmunitionType` IS NULL OR `w0`.`AmmunitionType` = 1) +WHERE `w`.`AmmunitionType` IS NULL +""", + // + """ +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM `Weapons` AS `w` +WHERE `w`.`AmmunitionType` IS NULL +""", + // + """ +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM `Weapons` AS `w` +WHERE `w`.`AmmunitionType` IS NULL +""", + // + """ +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM `Weapons` AS `w` +""", + // + """ +@prm='2' (Nullable = true) + +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM `Weapons` AS `w` +WHERE (`w`.`AmmunitionType` BAND @prm) <> 0 OR `w`.`AmmunitionType` IS NULL +""", + // + """ +@prm='1' (Nullable = true) +@prm='1' (Nullable = true) + +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM `Weapons` AS `w` +WHERE (`w`.`AmmunitionType` BAND @prm) = @prm """); } - public override async Task Coalesce_with_non_root_evaluatable_Convert(bool async) + public override async Task Logical_operation_with_non_null_parameter_optimizes_null_checks(bool async) { - await base.Coalesce_with_non_root_evaluatable_Convert(async); + await base.Logical_operation_with_non_null_parameter_optimizes_null_checks(async); AssertSql( - $""" -@__rank_0='1' (Nullable = true) + """ +@prm='True' + +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u` +WHERE `u`.`HasSoulPatch` <> @prm +""", + // + """ +@prm='False' SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( @@ -10915,77 +9303,135 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -WHERE {AssertSqlHelper.Parameter("@__rank_0")} = `u`.`Rank` +WHERE `u`.`HasSoulPatch` <> @prm """); } - /*[ConditionalTheory] + public override async Task Cast_OfType_works_correctly(bool async) + { + await base.Cast_OfType_works_correctly(async); + + AssertSql( +""" +SELECT `o`.`FullName` +FROM `Officers` AS `o` +"""); + } + + public override async Task Join_inner_source_custom_projection_followed_by_filter(bool async) + { + await base.Join_inner_source_custom_projection_followed_by_filter(async); + + AssertSql( + """ +SELECT IIF(`l1`.`Name` = 'Locust', TRUE, NULL) AS `IsEradicated`, `l1`.`CommanderName`, `l1`.`Name` +FROM ( + SELECT `l`.`Name` + FROM `LocustLeaders` AS `l` + UNION ALL + SELECT `l0`.`Name` + FROM `LocustCommanders` AS `l0` +) AS `u` +INNER JOIN `LocustHordes` AS `l1` ON `u`.`Name` = `l1`.`CommanderName` +WHERE IIF(`l1`.`Name` = 'Locust', TRUE, NULL) <> TRUE OR IIF(`l1`.`Name` = 'Locust', TRUE, NULL) IS NULL +"""); + } + + [ConditionalTheory] [MemberData(nameof(IsAsyncData))] - public async Task DataLength_function_for_string_parameter(bool async) + public async Task Byte_array_filter_by_length_literal2(bool async) { - await AssertQueryScalar( + await AssertQuery( async, - ss => ss.Set().Select(m => EF.Functions.DataLength(m.CodeName)), - ss => ss.Set().Select(m => (int?)(m.CodeName.Length * 2))); + ss => ss.Set().Where(w => EF.Functions.ByteArrayLength(w.Banner) == 2), + ss => ss.Set().Where(w => w.Banner != null && w.Banner.Length == 2)); AssertSql( -""" -SELECT CAST(DATALENGTH([m].[CodeName]) AS int) -FROM [Missions] AS [m] + """ +SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` +FROM `Squads` AS `s` +WHERE IIF(ASCB(RIGHTB(`s`.`Banner`, 1)) = 0, LENB(`s`.`Banner`) - 1, LENB(`s`.`Banner`)) = 2 """); - }*/ + } - public override async Task CompareTo_used_with_non_unicode_string_column_and_constant(bool async) + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public async Task Byte_array_filter_by_length_parameter2(bool async) { - await base.CompareTo_used_with_non_unicode_string_column_and_constant(async); + var someByteArr = new[] { (byte)42, (byte)24 }; + await AssertQuery( + async, + ss => ss.Set().Where(w => EF.Functions.ByteArrayLength(w.Banner) == someByteArr.Length), + ss => ss.Set().Where(w => w.Banner != null && w.Banner.Length == someByteArr.Length)); AssertSql( -""" -SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` -FROM `Cities` AS `c` -WHERE `c`.`Location` = 'Unknown' + """ +@p='2' + +SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` +FROM `Squads` AS `s` +WHERE IIF(ASCB(RIGHTB(`s`.`Banner`, 1)) = 0, LENB(`s`.`Banner`) - 1, LENB(`s`.`Banner`)) = @p """); } - public override async Task Coalesce_used_with_non_unicode_string_column_and_constant(bool async) + [ConditionalFact] + public virtual void Byte_array_filter_by_length_parameter_compiled2() { - await base.Coalesce_used_with_non_unicode_string_column_and_constant(async); + var query = EF.CompileQuery( + (GearsOfWarContext context, byte[] byteArrayParam) + => context.Squads.Where(w => EF.Functions.ByteArrayLength(w.Banner) == EF.Functions.ByteArrayLength(byteArrayParam)).Count()); + + using var context = CreateContext(); + var byteQueryParam = new[] { (byte)42, (byte)128 }; + + Assert.Equal(2, query(context, byteQueryParam)); AssertSql( """ -SELECT IIF(`c`.`Location` IS NULL, 'Unknown', `c`.`Location`) -FROM `Cities` AS `c` +@byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) + +SELECT COUNT(*) +FROM `Squads` AS `s` +WHERE IIF(ASCB(RIGHTB(`s`.`Banner`, 1)) = 0, LENB(`s`.`Banner`) - 1, LENB(`s`.`Banner`)) = IIF(IIF(ASCB(RIGHTB(@byteArrayParam, 1)) = 0, LENB(@byteArrayParam) - 1, LENB(@byteArrayParam)) IS NULL, NULL, CLNG(IIF(ASCB(RIGHTB(@byteArrayParam, 1)) = 0, LENB(@byteArrayParam) - 1, LENB(@byteArrayParam)))) """); } - public override async Task Groupby_anonymous_type_with_navigations_followed_up_by_anonymous_projection_and_orderby(bool async) + public override async Task Byte_array_filter_by_length_literal_does_not_cast_on_varbinary_n(bool async) { - await base.Groupby_anonymous_type_with_navigations_followed_up_by_anonymous_projection_and_orderby(async); + var exception = await Assert.ThrowsAsync(() => base.Byte_array_filter_by_length_literal_does_not_cast_on_varbinary_n(async)); + } + + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public async Task Byte_array_filter_by_length_literal_does_not_cast_on_varbinary_n2(bool async) + { + await AssertQuery( + async, + ss => ss.Set().Where(w => EF.Functions.ByteArrayLength(w.Banner5) == 5), + ss => ss.Set().Where(w => w.Banner5 != null && w.Banner5.Length == 5)); AssertSql( """ -SELECT `c`.`Name`, `c`.`Location`, COUNT(*) AS `Count` -FROM (`Weapons` AS `w` -LEFT JOIN ( - SELECT `g`.`CityOfBirthName`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`CityOfBirthName`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` ON `w`.`OwnerFullName` = `u`.`FullName`) -LEFT JOIN `Cities` AS `c` ON `u`.`CityOfBirthName` = `c`.`Name` -GROUP BY `c`.`Name`, `c`.`Location` -ORDER BY `c`.`Location` +SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` +FROM `Squads` AS `s` +WHERE IIF(ASCB(RIGHTB(`s`.`Banner5`, 1)) = 0, LENB(`s`.`Banner5`) - 1, LENB(`s`.`Banner5`)) = 5 """); } - public override async Task SelectMany_predicate_with_non_equality_comparison_converted_to_inner_join(bool async) + public override async Task Conditional_expression_with_test_being_simplified_to_constant_simple(bool isAsync) { - await base.SelectMany_predicate_with_non_equality_comparison_converted_to_inner_join(async); + await base.Conditional_expression_with_test_being_simplified_to_constant_simple(isAsync); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +@prm='True' + +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` @@ -10993,18 +9439,20 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -INNER JOIN `Weapons` AS `w` ON `u`.`FullName` <> `w`.`OwnerFullName` OR `w`.`OwnerFullName` IS NULL -ORDER BY `u`.`Nickname`, `w`.`Id` +WHERE IIF(`u`.`HasSoulPatch` = @prm, TRUE, FALSE) = TRUE """); } - public override async Task SelectMany_predicate_with_non_equality_comparison_DefaultIfEmpty_converted_to_left_join(bool async) + public override async Task Conditional_expression_with_test_being_simplified_to_constant_complex(bool isAsync) { - await base.SelectMany_predicate_with_non_equality_comparison_DefaultIfEmpty_converted_to_left_join(async); + await base.Conditional_expression_with_test_being_simplified_to_constant_complex(isAsync); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +@prm='True' +@prm2='Marcus' Lancer' (Size = 255) + +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` @@ -11012,195 +9460,161 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` <> `w`.`OwnerFullName` OR `w`.`OwnerFullName` IS NULL -ORDER BY `u`.`Nickname`, `w`.`Id` +WHERE IIF(`u`.`HasSoulPatch` = @prm AND ( + SELECT TOP 1 `w`.`Name` + FROM `Weapons` AS `w` + WHERE `w`.`Id` = `u`.`SquadId`) = @prm2, TRUE, FALSE) = TRUE """); } - public override async Task SelectMany_predicate_after_navigation_with_non_equality_comparison_DefaultIfEmpty_converted_to_left_join( - bool async) + public override async Task OrderBy_bool_coming_from_optional_navigation(bool async) { - await base.SelectMany_predicate_after_navigation_with_non_equality_comparison_DefaultIfEmpty_converted_to_left_join(async); + await base.OrderBy_bool_coming_from_optional_navigation(async); + + AssertSql( +""" +SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` +FROM `Weapons` AS `w` +LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +ORDER BY NOT (`w0`.`IsAutomatic`) +"""); + } + + public override async Task DateTimeOffset_Date_returns_datetime(bool async) + { + var dateTimeOffset = new DateTimeOffset(102, 3, 1, 8, 0, 0, new TimeSpan(-5, 0, 0)); + + await AssertQuery( + async, + ss => ss.Set().Where(m => m.Timeline.Date >= dateTimeOffset.Date)); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `s`.`Id`, `s`.`AmmunitionType`, `s`.`IsAutomatic`, `s`.`Name`, `s`.`OwnerFullName`, `s`.`SynergyWithId` -FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN ( - SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` - FROM `Weapons` AS `w` - LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -) AS `s` ON `u`.`FullName` <> `s`.`OwnerFullName` OR `s`.`OwnerFullName` IS NULL -ORDER BY `u`.`Nickname`, `s`.`Id` +@dateTimeOffset_Date='0102-03-01T00:00:00.0000000' (DbType = DateTime) + +SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` +FROM `Missions` AS `m` +WHERE DATEVALUE(`m`.`Timeline`) >= CDATE(@dateTimeOffset_Date) """); } - public override async Task SelectMany_without_result_selector_and_non_equality_comparison_converted_to_join(bool async) + public override async Task Conditional_with_conditions_evaluating_to_false_gets_optimized(bool async) { - await base.SelectMany_without_result_selector_and_non_equality_comparison_converted_to_join(async); + await base.Conditional_with_conditions_evaluating_to_false_gets_optimized(async); AssertSql( """ -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +SELECT `u`.`FullName` FROM ( - SELECT `g`.`FullName` + SELECT `g`.`Nickname`, `g`.`CityOfBirthName`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`FullName` + SELECT `o`.`Nickname`, `o`.`CityOfBirthName`, `o`.`FullName` FROM `Officers` AS `o` ) AS `u` -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` <> `w`.`OwnerFullName` OR `w`.`OwnerFullName` IS NULL """); } - public override async Task Filtered_collection_projection_with_order_comparison_predicate_converted_to_join(bool async) + public override async Task Conditional_with_conditions_evaluating_to_true_gets_optimized(bool async) { - await base.Filtered_collection_projection_with_order_comparison_predicate_converted_to_join(async); + await base.Conditional_with_conditions_evaluating_to_true_gets_optimized(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +SELECT `u`.`CityOfBirthName` FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + SELECT `g`.`Nickname`, `g`.`CityOfBirthName`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + SELECT `o`.`Nickname`, `o`.`CityOfBirthName`, `o`.`FullName` FROM `Officers` AS `o` ) AS `u` -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` AND `u`.`SquadId` < `w`.`Id` -ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Filtered_collection_projection_with_order_comparison_predicate_converted_to_join2(bool async) + public override async Task Projecting_required_string_column_compared_to_null_parameter(bool async) { - await base.Filtered_collection_projection_with_order_comparison_predicate_converted_to_join2(async); + await base.Projecting_required_string_column_compared_to_null_parameter(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +SELECT FALSE FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` + SELECT `g`.`Nickname` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` + SELECT `o`.`Nickname` FROM `Officers` AS `o` ) AS `u` -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` AND `u`.`SquadId` <= `w`.`Id` -ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Filtered_collection_projection_with_order_comparison_predicate_converted_to_join3(bool async) + public override async Task Group_by_nullable_property_HasValue_and_project_the_grouping_key(bool async) { - await base.Filtered_collection_projection_with_order_comparison_predicate_converted_to_join3(async); + await base.Group_by_nullable_property_HasValue_and_project_the_grouping_key(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +SELECT `w0`.`Key` FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` - FROM `Officers` AS `o` -) AS `u` -LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` AND `u`.`SquadId` >= `w`.`Id` -ORDER BY `u`.`Nickname`, `u`.`SquadId` + SELECT IIF(`w`.`SynergyWithId` IS NOT NULL, TRUE, FALSE) AS `Key` + FROM `Weapons` AS `w` +) AS `w0` +GROUP BY `w0`.`Key` """); } - public override async Task SelectMany_predicate_with_non_equality_comparison_with_Take_doesnt_convert_to_join(bool async) + public override async Task Group_by_nullable_property_and_project_the_grouping_key_HasValue(bool async) { - await base.SelectMany_predicate_with_non_equality_comparison_with_Take_doesnt_convert_to_join(async); + await base.Group_by_nullable_property_and_project_the_grouping_key_HasValue(async); AssertSql( """ -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], [t0].[Id], [t0].[AmmunitionType], [t0].[IsAutomatic], [t0].[Name], [t0].[OwnerFullName], [t0].[SynergyWithId] -FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -CROSS APPLY ( - SELECT TOP(3) [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] - FROM [Weapons] AS [w] - WHERE [w].[OwnerFullName] <> [t].[FullName] OR ([w].[OwnerFullName] IS NULL) - ORDER BY [w].[Id] -) AS [t0] -ORDER BY [t].[Nickname], [t0].[Id] +SELECT IIF(`w`.`SynergyWithId` IS NOT NULL, TRUE, FALSE) +FROM `Weapons` AS `w` +GROUP BY `w`.`SynergyWithId` """); } - public override async Task FirstOrDefault_over_int_compared_to_zero(bool async) + public override async Task Checked_context_with_cast_does_not_fail(bool isAsync) { - await base.FirstOrDefault_over_int_compared_to_zero(async); + await base.Checked_context_with_cast_does_not_fail(isAsync); AssertSql( """ -SELECT `s`.`Name` -FROM `Squads` AS `s` -WHERE `s`.`Name` = 'Delta' AND IIF(( - SELECT TOP 1 `u`.`SquadId` - FROM ( - SELECT `g`.`SquadId`, `g`.`FullName`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` - ) AS `u` - WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE - ORDER BY `u`.`FullName`) IS NULL, 0, ( - SELECT TOP 1 `u`.`SquadId` - FROM ( - SELECT `g`.`SquadId`, `g`.`FullName`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` - ) AS `u` - WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE - ORDER BY `u`.`FullName`)) <> 0 +SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` +FROM ( + SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l` + UNION ALL + SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l0` +) AS `u` +WHERE CBYTE(`u`.`ThreatLevel`) >= CBYTE(5) """); } - public override async Task Correlated_collection_with_inner_collection_references_element_two_levels_up(bool async) + public override async Task Checked_context_with_addition_does_not_fail(bool isAsync) { - await base.Correlated_collection_with_inner_collection_references_element_two_levels_up(async); + await base.Checked_context_with_addition_does_not_fail(isAsync); AssertSql( -""" -SELECT [t].[FullName], [t].[Nickname], [t].[SquadId], [t0].[ReportName], [t0].[OfficerName], [t0].[Nickname], [t0].[SquadId] -FROM ( - SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] - FROM [Officers] AS [o] -) AS [t] -OUTER APPLY ( - SELECT [t1].[FullName] AS [ReportName], [t].[FullName] AS [OfficerName], [t1].[Nickname], [t1].[SquadId] - FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[FullName], [g].[LeaderNickname], [g].[LeaderSquadId] - FROM [Gears] AS [g] - UNION ALL - SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName], [o0].[LeaderNickname], [o0].[LeaderSquadId] - FROM [Officers] AS [o0] - ) AS [t1] - WHERE [t].[Nickname] = [t1].[LeaderNickname] AND [t].[SquadId] = [t1].[LeaderSquadId] -) AS [t0] -ORDER BY [t].[Nickname], [t].[SquadId], [t0].[Nickname] + """ +SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` +FROM ( + SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l` + UNION ALL + SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l0` +) AS `u` +WHERE CLNG(`u`.`ThreatLevel`) <= (5 + CLNG(`u`.`ThreatLevel`)) """); } - public override async Task Accessing_derived_property_using_hard_and_soft_cast(bool async) + public override async Task Contains_on_collection_of_byte_subquery(bool async) { - await base.Accessing_derived_property_using_hard_and_soft_cast(async); + await base.Contains_on_collection_of_byte_subquery(async); AssertSql( """ @@ -11212,9 +9626,24 @@ UNION ALL SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` FROM `LocustCommanders` AS `l0` ) AS `u` -WHERE `u`.`Discriminator` = 'LocustCommander' AND (IIF(`u`.`HighCommandId` IS NULL, NULL, CLNG(`u`.`HighCommandId`)) <> 0 OR IIF(`u`.`HighCommandId` IS NULL, NULL, CLNG(`u`.`HighCommandId`)) IS NULL) -""", - // +WHERE `u`.`ThreatLevelByte` IN ( + SELECT `u0`.`ThreatLevelByte` + FROM ( + SELECT `l1`.`ThreatLevelByte` + FROM `LocustLeaders` AS `l1` + UNION ALL + SELECT `l2`.`ThreatLevelByte` + FROM `LocustCommanders` AS `l2` + ) AS `u0` +) +"""); + } + + public override async Task Contains_on_collection_of_nullable_byte_subquery(bool async) + { + await base.Contains_on_collection_of_nullable_byte_subquery(async); + + AssertSql( """ SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` FROM ( @@ -11224,17 +9653,26 @@ UNION ALL SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` FROM `LocustCommanders` AS `l0` ) AS `u` -WHERE `u`.`Discriminator` = 'LocustCommander' AND (IIF(`u`.`HighCommandId` IS NULL, NULL, CLNG(`u`.`HighCommandId`)) <> 0 OR IIF(`u`.`HighCommandId` IS NULL, NULL, CLNG(`u`.`HighCommandId`)) IS NULL) +WHERE EXISTS ( + SELECT 1 + FROM ( + SELECT `l1`.`ThreatLevelNullableByte` + FROM `LocustLeaders` AS `l1` + UNION ALL + SELECT `l2`.`ThreatLevelNullableByte` + FROM `LocustCommanders` AS `l2` + ) AS `u0` + WHERE `u0`.`ThreatLevelNullableByte` = `u`.`ThreatLevelNullableByte` OR (`u0`.`ThreatLevelNullableByte` IS NULL AND `u`.`ThreatLevelNullableByte` IS NULL)) """); } - public override async Task Cast_to_derived_followed_by_include_and_FirstOrDefault(bool async) + public override async Task Contains_on_collection_of_nullable_byte_subquery_null_constant(bool async) { - await base.Cast_to_derived_followed_by_include_and_FirstOrDefault(async); + await base.Contains_on_collection_of_nullable_byte_subquery_null_constant(async); AssertSql( """ -SELECT TOP 1 `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` +SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` FROM ( SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` FROM `LocustLeaders` AS `l` @@ -11242,711 +9680,986 @@ UNION ALL SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` FROM `LocustCommanders` AS `l0` ) AS `u` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId` -WHERE `u`.`Name` LIKE '%Queen%' +WHERE EXISTS ( + SELECT 1 + FROM ( + SELECT `l1`.`ThreatLevelNullableByte` + FROM `LocustLeaders` AS `l1` + UNION ALL + SELECT `l2`.`ThreatLevelNullableByte` + FROM `LocustCommanders` AS `l2` + ) AS `u0` + WHERE `u0`.`ThreatLevelNullableByte` IS NULL) """); } - public override async Task Correlated_collection_take(bool async) + public override async Task Contains_on_collection_of_nullable_byte_subquery_null_parameter(bool async) { - await base.Correlated_collection_take(async); + await base.Contains_on_collection_of_nullable_byte_subquery_null_parameter(async); AssertSql( -""" -SELECT [t].[Nickname], [t].[SquadId], [c].[Name], [t0].[Id], [t0].[AmmunitionType], [t0].[IsAutomatic], [t0].[Name], [t0].[OwnerFullName], [t0].[SynergyWithId], [c].[Location], [c].[Nation] + """ +SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[CityOfBirthName], [g].[FullName] - FROM [Gears] AS [g] + SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l` UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[CityOfBirthName], [o].[FullName] - FROM [Officers] AS [o] -) AS [t] -INNER JOIN [Cities] AS [c] ON [t].[CityOfBirthName] = [c].[Name] -LEFT JOIN ( - SELECT [t1].[Id], [t1].[AmmunitionType], [t1].[IsAutomatic], [t1].[Name], [t1].[OwnerFullName], [t1].[SynergyWithId] + SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l0` +) AS `u` +WHERE EXISTS ( + SELECT 1 FROM ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], ROW_NUMBER() OVER(PARTITION BY [w].[OwnerFullName] ORDER BY [w].[Id]) AS [row] - FROM [Weapons] AS [w] - ) AS [t1] - WHERE [t1].[row] <= 10 -) AS [t0] ON [t].[FullName] = [t0].[OwnerFullName] -ORDER BY [t].[Nickname], [t].[SquadId], [c].[Name] + SELECT `l1`.`ThreatLevelNullableByte` + FROM `LocustLeaders` AS `l1` + UNION ALL + SELECT `l2`.`ThreatLevelNullableByte` + FROM `LocustCommanders` AS `l2` + ) AS `u0` + WHERE `u0`.`ThreatLevelNullableByte` IS NULL) """); } - public override async Task First_on_byte_array(bool async) + public override async Task Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion( + bool async) { - await base.First_on_byte_array(async); + await base.Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion(async); AssertSql( - """ -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE ASCB(MIDB(`s`.`Banner`, 1, 1)) = 2 +""" +SELECT [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] +FROM ( + SELECT [l].[ThreatLevelByte] + FROM [LocustLeaders] AS [l] + UNION ALL + SELECT [l0].[ThreatLevelByte] + FROM [LocustCommanders] AS [l0] +) AS [t] +CROSS APPLY ( + SELECT [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] + FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] + ) AS [t0] + WHERE EXISTS ( + SELECT 1 + FROM ( + SELECT [l1].[Name], [l1].[LocustHordeId], [l1].[ThreatLevel], [l1].[ThreatLevelByte], [l1].[ThreatLevelNullableByte], NULL AS [DefeatedByNickname], NULL AS [DefeatedBySquadId], NULL AS [HighCommandId], N'LocustLeader' AS [Discriminator] + FROM [LocustLeaders] AS [l1] + UNION ALL + SELECT [l2].[Name], [l2].[LocustHordeId], [l2].[ThreatLevel], [l2].[ThreatLevelByte], [l2].[ThreatLevelNullableByte], [l2].[DefeatedByNickname], [l2].[DefeatedBySquadId], [l2].[HighCommandId], N'LocustCommander' AS [Discriminator] + FROM [LocustCommanders] AS [l2] + ) AS [t2] + WHERE [t2].[ThreatLevelByte] = [t].[ThreatLevelByte]) +) AS [t1] """); } - public override async Task Array_access_on_byte_array(bool async) + public override async Task Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion_negated( + bool async) { - await base.Array_access_on_byte_array(async); + await base.Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion_negated(async); AssertSql( - """ -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE ASCB(MIDB(`s`.`Banner5`, 2 + 1, 1)) = 6 +""" +SELECT [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] +FROM ( + SELECT [l].[ThreatLevelByte] + FROM [LocustLeaders] AS [l] + UNION ALL + SELECT [l0].[ThreatLevelByte] + FROM [LocustCommanders] AS [l0] +) AS [t] +CROSS APPLY ( + SELECT [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] + FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] + ) AS [t0] + WHERE NOT (EXISTS ( + SELECT 1 + FROM ( + SELECT [l1].[Name], [l1].[LocustHordeId], [l1].[ThreatLevel], [l1].[ThreatLevelByte], [l1].[ThreatLevelNullableByte], NULL AS [DefeatedByNickname], NULL AS [DefeatedBySquadId], NULL AS [HighCommandId], N'LocustLeader' AS [Discriminator] + FROM [LocustLeaders] AS [l1] + UNION ALL + SELECT [l2].[Name], [l2].[LocustHordeId], [l2].[ThreatLevel], [l2].[ThreatLevelByte], [l2].[ThreatLevelNullableByte], [l2].[DefeatedByNickname], [l2].[DefeatedBySquadId], [l2].[HighCommandId], N'LocustCommander' AS [Discriminator] + FROM [LocustCommanders] AS [l2] + ) AS [t2] + WHERE [t2].[ThreatLevelByte] = [t].[ThreatLevelByte])) +) AS [t1] """); } - public override async Task Project_shadow_properties(bool async) + public override async Task Subquery_projecting_nullable_scalar_contains_nullable_value_needs_null_expansion(bool async) { - await base.Project_shadow_properties(async); + await base.Subquery_projecting_nullable_scalar_contains_nullable_value_needs_null_expansion(async); AssertSql( """ -SELECT `g`.`Nickname`, `g`.`AssignedCityName` -FROM `Gears` AS `g` -UNION ALL -SELECT `o`.`Nickname`, `o`.`AssignedCityName` -FROM `Officers` AS `o` +SELECT [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] +FROM ( + SELECT [l].[ThreatLevelNullableByte] + FROM [LocustLeaders] AS [l] + UNION ALL + SELECT [l0].[ThreatLevelNullableByte] + FROM [LocustCommanders] AS [l0] +) AS [t] +CROSS APPLY ( + SELECT [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] + FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] + ) AS [t0] + WHERE EXISTS ( + SELECT 1 + FROM ( + SELECT [l1].[Name], [l1].[LocustHordeId], [l1].[ThreatLevel], [l1].[ThreatLevelByte], [l1].[ThreatLevelNullableByte], NULL AS [DefeatedByNickname], NULL AS [DefeatedBySquadId], NULL AS [HighCommandId], N'LocustLeader' AS [Discriminator] + FROM [LocustLeaders] AS [l1] + UNION ALL + SELECT [l2].[Name], [l2].[LocustHordeId], [l2].[ThreatLevel], [l2].[ThreatLevelByte], [l2].[ThreatLevelNullableByte], [l2].[DefeatedByNickname], [l2].[DefeatedBySquadId], [l2].[HighCommandId], N'LocustCommander' AS [Discriminator] + FROM [LocustCommanders] AS [l2] + ) AS [t2] + WHERE [t2].[ThreatLevelNullableByte] = [t].[ThreatLevelNullableByte] OR (([t2].[ThreatLevelNullableByte] IS NULL) AND ([t].[ThreatLevelNullableByte] IS NULL))) +) AS [t1] """); } - public override async Task Composite_key_entity_equal(bool async) + public override async Task Subquery_projecting_nullable_scalar_contains_nullable_value_needs_null_expansion_negated(bool async) { - await base.Composite_key_entity_equal(async); + await base.Subquery_projecting_nullable_scalar_contains_nullable_value_needs_null_expansion_negated(async); AssertSql( - """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` +""" +SELECT [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank], [t1].[Discriminator] FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u`, -( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` + SELECT [l].[ThreatLevelNullableByte] + FROM [LocustLeaders] AS [l] UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` -) AS `u0` -WHERE `u`.`Nickname` = `u0`.`Nickname` AND `u`.`SquadId` = `u0`.`SquadId` + SELECT [l0].[ThreatLevelNullableByte] + FROM [LocustCommanders] AS [l0] +) AS [t] +CROSS APPLY ( + SELECT [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] + FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] + ) AS [t0] + WHERE NOT (EXISTS ( + SELECT 1 + FROM ( + SELECT [l1].[Name], [l1].[LocustHordeId], [l1].[ThreatLevel], [l1].[ThreatLevelByte], [l1].[ThreatLevelNullableByte], NULL AS [DefeatedByNickname], NULL AS [DefeatedBySquadId], NULL AS [HighCommandId], N'LocustLeader' AS [Discriminator] + FROM [LocustLeaders] AS [l1] + UNION ALL + SELECT [l2].[Name], [l2].[LocustHordeId], [l2].[ThreatLevel], [l2].[ThreatLevelByte], [l2].[ThreatLevelNullableByte], [l2].[DefeatedByNickname], [l2].[DefeatedBySquadId], [l2].[HighCommandId], N'LocustCommander' AS [Discriminator] + FROM [LocustCommanders] AS [l2] + ) AS [t2] + WHERE [t2].[ThreatLevelNullableByte] = [t].[ThreatLevelNullableByte] OR (([t2].[ThreatLevelNullableByte] IS NULL) AND ([t].[ThreatLevelNullableByte] IS NULL)))) +) AS [t1] """); } - public override async Task Composite_key_entity_not_equal(bool async) + public override async Task Enum_closure_typed_as_underlying_type_generates_correct_parameter_type(bool async) { - await base.Composite_key_entity_not_equal(async); + await base.Enum_closure_typed_as_underlying_type_generates_correct_parameter_type(async); AssertSql( """ -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` +@prm='1' (Nullable = true) + +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM `Weapons` AS `w` +WHERE @prm = `w`.`AmmunitionType` +"""); + } + + public override async Task Enum_flags_closure_typed_as_underlying_type_generates_correct_parameter_type(bool async) + { + await base.Enum_flags_closure_typed_as_underlying_type_generates_correct_parameter_type(async); + + AssertSql( + """ +@prm='133' + +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u`, -( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g0` - UNION ALL - SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o0` -) AS `u0` -WHERE `u`.`Nickname` <> `u0`.`Nickname` OR `u`.`SquadId` <> `u0`.`SquadId` +) AS `u` +WHERE (@prm BAND `u`.`Rank`) = `u`.`Rank` """); } - public override async Task Composite_key_entity_equal_null(bool async) + public override async Task Enum_flags_closure_typed_as_different_type_generates_correct_parameter_type(bool async) { - await base.Composite_key_entity_equal_null(async); + await base.Enum_flags_closure_typed_as_different_type_generates_correct_parameter_type(async); AssertSql( """ -SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` +@prm='5' + +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, `l`.`DefeatedByNickname`, `l`.`DefeatedBySquadId`, `l`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l` -) AS `u` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND `u`.`DefeatedBySquadId` = `u0`.`SquadId` -WHERE `u0`.`Nickname` IS NULL OR `u0`.`SquadId` IS NULL +) AS `u` +WHERE (@prm BAND CLNG(`u`.`Rank`)) = CLNG(`u`.`Rank`) """); } - public override async Task Composite_key_entity_not_equal_null(bool async) + public override async Task Constant_enum_with_same_underlying_value_as_previously_parameterized_int(bool async) { - await base.Composite_key_entity_not_equal_null(async); + await base.Constant_enum_with_same_underlying_value_as_previously_parameterized_int(async); AssertSql( """ -SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` +SELECT TOP @p `u`.`Rank` BAND 1 FROM ( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, `l`.`DefeatedByNickname`, `l`.`DefeatedBySquadId`, `l`.`HighCommandId`, 'LocustCommander' AS `Discriminator` - FROM `LocustCommanders` AS `l` -) AS `u` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` + SELECT `g`.`Nickname`, `g`.`Rank` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` + SELECT `o`.`Nickname`, `o`.`Rank` FROM `Officers` AS `o` -) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND `u`.`DefeatedBySquadId` = `u0`.`SquadId` -WHERE `u0`.`Nickname` IS NOT NULL AND `u0`.`SquadId` IS NOT NULL +) AS `u` +ORDER BY `u`.`Nickname` """); } - public override async Task Projecting_property_converted_to_nullable_with_comparison(bool async) + public override async Task Coalesce_with_non_root_evaluatable_Convert(bool async) { - await base.Projecting_property_converted_to_nullable_with_comparison(async); + await base.Coalesce_with_non_root_evaluatable_Convert(async); AssertSql( """ -SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, TRUE, FALSE), `u`.`Nickname`, `u`.`SquadId`, `u`.`HasSoulPatch` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` +@rank='1' (Nullable = true) + +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL) = 1 +) AS `u` +WHERE @rank = `u`.`Rank` """); } - public override async Task Projecting_property_converted_to_nullable_with_addition(bool async) + /*[ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public async Task DataLength_function_for_string_parameter(bool async) { - await base.Projecting_property_converted_to_nullable_with_addition(async); + await AssertQueryScalar( + async, + ss => ss.Set().Select(m => EF.Functions.DataLength(m.CodeName)), + ss => ss.Set().Select(m => (int?)(m.CodeName.Length * 2))); AssertSql( - """ -SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, TRUE, FALSE), `u`.`Nickname`, `u`.`SquadId`, `u`.`HasSoulPatch` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE (IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL) + 1) = 2 +""" +SELECT CAST(DATALENGTH([m].[CodeName]) AS int) +FROM [Missions] AS [m] """); - } + }*/ - public override async Task Projecting_property_converted_to_nullable_with_addition_and_final_projection(bool async) + public override async Task CompareTo_used_with_non_unicode_string_column_and_constant(bool async) { - await base.Projecting_property_converted_to_nullable_with_addition_and_final_projection(async); + await base.CompareTo_used_with_non_unicode_string_column_and_constant(async); AssertSql( - """ -SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL) + 1 AS `Value` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL) IS NOT NULL +""" +SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` +FROM `Cities` AS `c` +WHERE `c`.`Location` = 'Unknown' """); } - public override async Task Projecting_property_converted_to_nullable_with_conditional(bool async) + public override async Task Coalesce_used_with_non_unicode_string_column_and_constant(bool async) { - await base.Projecting_property_converted_to_nullable_with_conditional(async); + await base.Coalesce_used_with_non_unicode_string_column_and_constant(async); AssertSql( """ -SELECT IIF(`t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL, IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL), -1) -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` - FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +SELECT IIF(`c`.`Location` IS NULL, 'Unknown', `c`.`Location`) +FROM `Cities` AS `c` """); } - public override async Task Projecting_property_converted_to_nullable_with_function_call(bool async) + public override async Task Groupby_anonymous_type_with_navigations_followed_up_by_anonymous_projection_and_orderby(bool async) { - await base.Projecting_property_converted_to_nullable_with_function_call(async); + await base.Groupby_anonymous_type_with_navigations_followed_up_by_anonymous_projection_and_orderby(async); AssertSql( """ -SELECT MID(IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL), 0 + 1, 3) -FROM `Tags` AS `t` +SELECT `c`.`Name`, `c`.`Location`, COUNT(*) AS `Count` +FROM (`Weapons` AS `w` LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` + SELECT `g`.`CityOfBirthName`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` + SELECT `o`.`CityOfBirthName`, `o`.`FullName` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +) AS `u` ON `w`.`OwnerFullName` = `u`.`FullName`) +LEFT JOIN `Cities` AS `c` ON `u`.`CityOfBirthName` = `c`.`Name` +GROUP BY `c`.`Name`, `c`.`Location` +ORDER BY `c`.`Location` """); } - public override async Task Projecting_property_converted_to_nullable_with_function_call2(bool async) + public override async Task SelectMany_predicate_with_non_equality_comparison_converted_to_inner_join(bool async) { - await base.Projecting_property_converted_to_nullable_with_function_call2(async); + await base.SelectMany_predicate_with_non_equality_comparison_converted_to_inner_join(async); AssertSql( """ -SELECT `t`.`Note`, MID(`t`.`Note`, 0 + 1, IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL)) AS `Function` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL) IS NOT NULL +) AS `u` +INNER JOIN `Weapons` AS `w` ON `u`.`FullName` <> `w`.`OwnerFullName` OR `w`.`OwnerFullName` IS NULL +ORDER BY `u`.`Nickname`, `w`.`Id` """); } - public override async Task Projecting_property_converted_to_nullable_into_element_init(bool async) + public override async Task SelectMany_predicate_with_non_equality_comparison_DefaultIfEmpty_converted_to_left_join(bool async) { - await base.Projecting_property_converted_to_nullable_into_element_init(async); + await base.SelectMany_predicate_with_non_equality_comparison_DefaultIfEmpty_converted_to_left_join(async); AssertSql( """ -SELECT IIF(`t`.`GearNickName` IS NOT NULL, IIF(LEN(`u`.`Nickname`) IS NULL, NULL, CLNG(LEN(`u`.`Nickname`))), NULL), IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL), IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL) + 1 -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL) IS NOT NULL -ORDER BY `t`.`Note` +) AS `u` +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` <> `w`.`OwnerFullName` OR `w`.`OwnerFullName` IS NULL +ORDER BY `u`.`Nickname`, `w`.`Id` """); } - public override async Task Projecting_property_converted_to_nullable_into_member_assignment(bool async) + public override async Task SelectMany_predicate_after_navigation_with_non_equality_comparison_DefaultIfEmpty_converted_to_left_join( + bool async) { - await base.Projecting_property_converted_to_nullable_into_member_assignment(async); + await base.SelectMany_predicate_after_navigation_with_non_equality_comparison_DefaultIfEmpty_converted_to_left_join(async); AssertSql( """ -SELECT IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL) AS `Id` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `s`.`Id`, `s`.`AmmunitionType`, `s`.`IsAutomatic`, `s`.`Name`, `s`.`OwnerFullName`, `s`.`SynergyWithId` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL) IS NOT NULL -ORDER BY `t`.`Note` +) AS `u` +LEFT JOIN ( + SELECT `w0`.`Id`, `w0`.`AmmunitionType`, `w0`.`IsAutomatic`, `w0`.`Name`, `w0`.`OwnerFullName`, `w0`.`SynergyWithId` + FROM `Weapons` AS `w` + LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +) AS `s` ON `u`.`FullName` <> `s`.`OwnerFullName` OR `s`.`OwnerFullName` IS NULL +ORDER BY `u`.`Nickname`, `s`.`Id` """); } - public override async Task Projecting_property_converted_to_nullable_into_new_array(bool async) + public override async Task SelectMany_without_result_selector_and_non_equality_comparison_converted_to_join(bool async) { - await base.Projecting_property_converted_to_nullable_into_new_array(async); + await base.SelectMany_without_result_selector_and_non_equality_comparison_converted_to_join(async); AssertSql( """ -SELECT IIF(`t`.`GearNickName` IS NOT NULL, IIF(LEN(`u`.`Nickname`) IS NULL, NULL, CLNG(LEN(`u`.`Nickname`))), NULL), IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL), IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL) + 1 -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM ( + SELECT `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId` + SELECT `o`.`FullName` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL) IS NOT NULL -ORDER BY `t`.`Note` +) AS `u` +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` <> `w`.`OwnerFullName` OR `w`.`OwnerFullName` IS NULL """); } - public override async Task Projecting_property_converted_to_nullable_into_unary(bool async) + public override async Task Filtered_collection_projection_with_order_comparison_predicate_converted_to_join(bool async) { - await base.Projecting_property_converted_to_nullable_into_unary(async); + await base.Filtered_collection_projection_with_order_comparison_predicate_converted_to_join(async); AssertSql( """ -SELECT `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` +SELECT `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL) IS NOT NULL AND IIF(`t`.`GearNickName` IS NOT NULL, `u`.`HasSoulPatch`, NULL) = FALSE -ORDER BY `t`.`Note` +) AS `u` +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` AND `u`.`SquadId` < `w`.`Id` +ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Projecting_property_converted_to_nullable_into_member_access(bool async) + public override async Task Filtered_collection_projection_with_order_comparison_predicate_converted_to_join2(bool async) { - await base.Projecting_property_converted_to_nullable_into_member_access(async); + await base.Filtered_collection_projection_with_order_comparison_predicate_converted_to_join2(async); AssertSql( """ -SELECT `u`.`Nickname` +SELECT `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`CityOfBirthName` + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`CityOfBirthName` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` ) AS `u` -LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` -WHERE DATEPART('m', `t`.`IssueDate`) <> 5 -ORDER BY `u`.`Nickname` +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` AND `u`.`SquadId` <= `w`.`Id` +ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Projecting_property_converted_to_nullable_and_use_it_in_order_by(bool async) + public override async Task Filtered_collection_projection_with_order_comparison_predicate_converted_to_join3(bool async) { - await base.Projecting_property_converted_to_nullable_and_use_it_in_order_by(async); + await base.Filtered_collection_projection_with_order_comparison_predicate_converted_to_join3(async); AssertSql( """ -SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, TRUE, FALSE), `u`.`Nickname`, `u`.`SquadId`, `u`.`HasSoulPatch` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` +SELECT `u`.`Nickname`, `u`.`SquadId`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName` FROM `Gears` AS `g` UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName` FROM `Officers` AS `o` -) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL) IS NOT NULL -ORDER BY IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL), `t`.`Note` +) AS `u` +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` AND `u`.`SquadId` >= `w`.`Id` +ORDER BY `u`.`Nickname`, `u`.`SquadId` """); } - public override async Task Where_DateOnly_Year(bool async) + public override async Task SelectMany_predicate_with_non_equality_comparison_with_Take_doesnt_convert_to_join(bool async) { - await base.Where_DateOnly_Year(async); + await base.SelectMany_predicate_with_non_equality_comparison_with_Take_doesnt_convert_to_join(async); AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('yyyy', `m`.`Date`) = 1990 +""" +SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], [t0].[Id], [t0].[AmmunitionType], [t0].[IsAutomatic], [t0].[Name], [t0].[OwnerFullName], [t0].[SynergyWithId] +FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] + FROM [Officers] AS [o] +) AS [t] +CROSS APPLY ( + SELECT TOP(3) [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] + FROM [Weapons] AS [w] + WHERE [w].[OwnerFullName] <> [t].[FullName] OR ([w].[OwnerFullName] IS NULL) + ORDER BY [w].[Id] +) AS [t0] +ORDER BY [t].[Nickname], [t0].[Id] """); } - public override async Task Where_DateOnly_Month(bool async) + public override async Task FirstOrDefault_over_int_compared_to_zero(bool async) { - await base.Where_DateOnly_Month(async); + await base.FirstOrDefault_over_int_compared_to_zero(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('m', `m`.`Date`) = 11 +SELECT `s`.`Name` +FROM `Squads` AS `s` +WHERE `s`.`Name` = 'Delta' AND IIF(( + SELECT TOP 1 `u`.`SquadId` + FROM ( + SELECT `g`.`SquadId`, `g`.`FullName`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` + ) AS `u` + WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE + ORDER BY `u`.`FullName`) IS NULL, 0, ( + SELECT TOP 1 `u`.`SquadId` + FROM ( + SELECT `g`.`SquadId`, `g`.`FullName`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` + ) AS `u` + WHERE `s`.`Id` = `u`.`SquadId` AND `u`.`HasSoulPatch` = TRUE + ORDER BY `u`.`FullName`)) <> 0 """); } - public override async Task Where_DateOnly_Day(bool async) + public override async Task Correlated_collection_with_inner_collection_references_element_two_levels_up(bool async) { - await base.Where_DateOnly_Day(async); + await base.Correlated_collection_with_inner_collection_references_element_two_levels_up(async); AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('d', `m`.`Date`) = 10 +""" +SELECT [t].[FullName], [t].[Nickname], [t].[SquadId], [t0].[ReportName], [t0].[OfficerName], [t0].[Nickname], [t0].[SquadId] +FROM ( + SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] + FROM [Officers] AS [o] +) AS [t] +OUTER APPLY ( + SELECT [t1].[FullName] AS [ReportName], [t].[FullName] AS [OfficerName], [t1].[Nickname], [t1].[SquadId] + FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[FullName], [g].[LeaderNickname], [g].[LeaderSquadId] + FROM [Gears] AS [g] + UNION ALL + SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName], [o0].[LeaderNickname], [o0].[LeaderSquadId] + FROM [Officers] AS [o0] + ) AS [t1] + WHERE [t].[Nickname] = [t1].[LeaderNickname] AND [t].[SquadId] = [t1].[LeaderSquadId] +) AS [t0] +ORDER BY [t].[Nickname], [t].[SquadId], [t0].[Nickname] """); } - public override async Task Where_DateOnly_DayOfYear(bool async) + public override async Task Accessing_derived_property_using_hard_and_soft_cast(bool async) { - await base.Where_DateOnly_DayOfYear(async); + await base.Accessing_derived_property_using_hard_and_soft_cast(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('y', `m`.`Date`) = 314 +SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` +FROM ( + SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l` + UNION ALL + SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l0` +) AS `u` +WHERE `u`.`Discriminator` = 'LocustCommander' AND (IIF(`u`.`HighCommandId` IS NULL, NULL, CLNG(`u`.`HighCommandId`)) <> 0 OR IIF(`u`.`HighCommandId` IS NULL, NULL, CLNG(`u`.`HighCommandId`)) IS NULL) +""", + // + """ +SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` +FROM ( + SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l` + UNION ALL + SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l0` +) AS `u` +WHERE `u`.`Discriminator` = 'LocustCommander' AND (IIF(`u`.`HighCommandId` IS NULL, NULL, CLNG(`u`.`HighCommandId`)) <> 0 OR IIF(`u`.`HighCommandId` IS NULL, NULL, CLNG(`u`.`HighCommandId`)) IS NULL) """); } - public override async Task Where_DateOnly_DayOfWeek(bool async) + public override async Task Cast_to_derived_followed_by_include_and_FirstOrDefault(bool async) { - await AssertTranslationFailed(() => base.Where_DateOnly_DayOfWeek(async)); + await base.Cast_to_derived_followed_by_include_and_FirstOrDefault(async); - AssertSql(); + AssertSql( + """ +SELECT TOP 1 `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` +FROM ( + SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, NULL AS `DefeatedByNickname`, CVar(NULL) AS `DefeatedBySquadId`, CVar(NULL) AS `HighCommandId`, 'LocustLeader' AS `Discriminator` + FROM `LocustLeaders` AS `l` + UNION ALL + SELECT `l0`.`Name`, `l0`.`LocustHordeId`, `l0`.`ThreatLevel`, `l0`.`ThreatLevelByte`, `l0`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l0` +) AS `u` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND IIF(`u`.`DefeatedBySquadId` IS NULL, NULL, CLNG(`u`.`DefeatedBySquadId`)) = `u0`.`SquadId` +WHERE `u`.`Name` LIKE '%Queen%' +"""); } - public override async Task Where_DateOnly_AddYears(bool async) + public override async Task Correlated_collection_take(bool async) { - await base.Where_DateOnly_AddYears(async); + await base.Correlated_collection_take(async); AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEADD('yyyy', CLNG(3), `m`.`Date`) = #1993-11-10# +""" +SELECT [t].[Nickname], [t].[SquadId], [c].[Name], [t0].[Id], [t0].[AmmunitionType], [t0].[IsAutomatic], [t0].[Name], [t0].[OwnerFullName], [t0].[SynergyWithId], [c].[Location], [c].[Nation] +FROM ( + SELECT [g].[Nickname], [g].[SquadId], [g].[CityOfBirthName], [g].[FullName] + FROM [Gears] AS [g] + UNION ALL + SELECT [o].[Nickname], [o].[SquadId], [o].[CityOfBirthName], [o].[FullName] + FROM [Officers] AS [o] +) AS [t] +INNER JOIN [Cities] AS [c] ON [t].[CityOfBirthName] = [c].[Name] +LEFT JOIN ( + SELECT [t1].[Id], [t1].[AmmunitionType], [t1].[IsAutomatic], [t1].[Name], [t1].[OwnerFullName], [t1].[SynergyWithId] + FROM ( + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], ROW_NUMBER() OVER(PARTITION BY [w].[OwnerFullName] ORDER BY [w].[Id]) AS [row] + FROM [Weapons] AS [w] + ) AS [t1] + WHERE [t1].[row] <= 10 +) AS [t0] ON [t].[FullName] = [t0].[OwnerFullName] +ORDER BY [t].[Nickname], [t].[SquadId], [c].[Name] """); } - public override async Task Where_DateOnly_AddMonths(bool async) + public override async Task Project_shadow_properties(bool async) { - await base.Where_DateOnly_AddMonths(async); + await base.Project_shadow_properties(async); AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEADD('m', CLNG(3), `m`.`Date`) = #1991-02-10# +""" +SELECT `g`.`Nickname`, `g`.`AssignedCityName` +FROM `Gears` AS `g` +UNION ALL +SELECT `o`.`Nickname`, `o`.`AssignedCityName` +FROM `Officers` AS `o` """); } - public override async Task Where_DateOnly_AddDays(bool async) + public override async Task Composite_key_entity_equal(bool async) { - await base.Where_DateOnly_AddDays(async); + await base.Composite_key_entity_equal(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEADD('d', CLNG(3), `m`.`Date`) = #1990-11-13# +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u`, +( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` +) AS `u0` +WHERE `u`.`Nickname` = `u0`.`Nickname` AND `u`.`SquadId` = `u0`.`SquadId` """); } - public override async Task Where_TimeOnly_Hour(bool async) + public override async Task Composite_key_entity_not_equal(bool async) { - await base.Where_TimeOnly_Hour(async); + await base.Composite_key_entity_not_equal(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('h', `m`.`Time`) = 10 +SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o` +) AS `u`, +( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, 'Gear' AS `Discriminator` + FROM `Gears` AS `g0` + UNION ALL + SELECT `o0`.`Nickname`, `o0`.`SquadId`, `o0`.`AssignedCityName`, `o0`.`CityOfBirthName`, `o0`.`FullName`, `o0`.`HasSoulPatch`, `o0`.`LeaderNickname`, `o0`.`LeaderSquadId`, `o0`.`Rank`, 'Officer' AS `Discriminator` + FROM `Officers` AS `o0` +) AS `u0` +WHERE `u`.`Nickname` <> `u0`.`Nickname` OR `u`.`SquadId` <> `u0`.`SquadId` """); } - public override async Task Where_TimeOnly_Minute(bool async) + public override async Task Composite_key_entity_equal_null(bool async) { - await base.Where_TimeOnly_Minute(async); + await base.Composite_key_entity_equal_null(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('n', `m`.`Time`) = 15 +SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` +FROM ( + SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, `l`.`DefeatedByNickname`, `l`.`DefeatedBySquadId`, `l`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l` +) AS `u` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` +) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND `u`.`DefeatedBySquadId` = `u0`.`SquadId` +WHERE `u0`.`Nickname` IS NULL OR `u0`.`SquadId` IS NULL """); } - public override async Task Where_TimeOnly_Second(bool async) + public override async Task Composite_key_entity_not_equal_null(bool async) { - await base.Where_TimeOnly_Second(async); + await base.Composite_key_entity_not_equal_null(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('s', `m`.`Time`) = 50 +SELECT `u`.`Name`, `u`.`LocustHordeId`, `u`.`ThreatLevel`, `u`.`ThreatLevelByte`, `u`.`ThreatLevelNullableByte`, `u`.`DefeatedByNickname`, `u`.`DefeatedBySquadId`, `u`.`HighCommandId`, `u`.`Discriminator` +FROM ( + SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, `l`.`DefeatedByNickname`, `l`.`DefeatedBySquadId`, `l`.`HighCommandId`, 'LocustCommander' AS `Discriminator` + FROM `LocustCommanders` AS `l` +) AS `u` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` +) AS `u0` ON `u`.`DefeatedByNickname` = `u0`.`Nickname` AND `u`.`DefeatedBySquadId` = `u0`.`SquadId` +WHERE `u0`.`Nickname` IS NOT NULL AND `u0`.`SquadId` IS NOT NULL """); } - public override async Task Where_TimeOnly_Millisecond(bool async) + public override async Task Projecting_property_converted_to_nullable_with_comparison(bool async) { - await base.Where_TimeOnly_Millisecond(async); + await base.Projecting_property_converted_to_nullable_with_comparison(async); AssertSql( -""" -SELECT [m].[Id], [m].[CodeName], [m].[Date], [m].[Duration], [m].[Rating], [m].[Time], [m].[Timeline] -FROM [Missions] AS [m] -WHERE DATEPART(millisecond, [m].[Time]) = 500 + """ +SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, TRUE, FALSE), `u`.`Nickname`, `u`.`SquadId`, `u`.`HasSoulPatch` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL) = 1 """); } - public override async Task Where_TimeOnly_AddHours(bool async) + public override async Task Projecting_property_converted_to_nullable_with_addition(bool async) { - await base.Where_TimeOnly_AddHours(async); + await base.Projecting_property_converted_to_nullable_with_addition(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE TIMEVALUE(DATEADD('h', CLNG(3.0), `m`.`Time`)) = TIMEVALUE('13:15:50') +SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, TRUE, FALSE), `u`.`Nickname`, `u`.`SquadId`, `u`.`HasSoulPatch` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE (IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL) + 1) = 2 """); } - public override async Task Where_TimeOnly_AddMinutes(bool async) + public override async Task Projecting_property_converted_to_nullable_with_addition_and_final_projection(bool async) { - await base.Where_TimeOnly_AddMinutes(async); + await base.Projecting_property_converted_to_nullable_with_addition_and_final_projection(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE TIMEVALUE(DATEADD('n', CLNG(3.0), `m`.`Time`)) = TIMEVALUE('10:18:50') +SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL) + 1 AS `Value` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL) IS NOT NULL """); } - public override async Task Where_TimeOnly_Add_TimeSpan(bool async) - { - await AssertTranslationFailed(() => base.Where_TimeOnly_Add_TimeSpan(async)); - - AssertSql(); - } - - public override async Task Where_TimeOnly_IsBetween(bool async) + public override async Task Projecting_property_converted_to_nullable_with_conditional(bool async) { - await base.Where_TimeOnly_IsBetween(async); + await base.Projecting_property_converted_to_nullable_with_conditional(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE (IIF(`m`.`Time` >= TIMEVALUE('10:00:00'), TRUE, FALSE) BAND IIF(`m`.`Time` < TIMEVALUE('11:00:00'), TRUE, FALSE)) = TRUE +SELECT IIF(`t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL, IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL), -1) +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` """); } - public override async Task Where_TimeOnly_subtract_TimeOnly(bool async) - { - await AssertTranslationFailed(() => base.Where_TimeOnly_subtract_TimeOnly(async)); - - AssertSql(); - } - - public override async Task Where_TimeOnly_FromDateTime_compared_to_property(bool async) + public override async Task Projecting_property_converted_to_nullable_with_function_call(bool async) { - await base.Where_TimeOnly_FromDateTime_compared_to_property(async); + await base.Projecting_property_converted_to_nullable_with_function_call(async); AssertSql( """ -SELECT `t`.`Id` AS `TagId`, `m`.`Id` AS `MissionId` -FROM `Tags` AS `t`, -`Missions` AS `m` -WHERE TIMEVALUE(`t`.`IssueDate`) = `m`.`Time` +SELECT MID(IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL), 0 + 1, 3) +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` """); } - public override async Task Where_TimeOnly_FromDateTime_compared_to_parameter(bool async) + public override async Task Projecting_property_converted_to_nullable_with_function_call2(bool async) { - await base.Where_TimeOnly_FromDateTime_compared_to_parameter(async); + await base.Projecting_property_converted_to_nullable_with_function_call2(async); AssertSql( -""" -@__time_0='02:00' (DbType = Time) - -SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] -FROM [Tags] AS [t] + """ +SELECT `t`.`Note`, MID(`t`.`Note`, 0 + 1, IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL)) AS `Function` +FROM `Tags` AS `t` LEFT JOIN ( - SELECT [g].[Nickname], [g].[SquadId] - FROM [Gears] AS [g] + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` UNION ALL - SELECT [o].[Nickname], [o].[SquadId] - FROM [Officers] AS [o] -) AS [u] ON [t].[GearNickName] = [u].[Nickname] AND [t].[GearSquadId] = [u].[SquadId] -WHERE [u].[Nickname] IS NOT NULL AND [u].[SquadId] IS NOT NULL AND CAST(DATEADD(hour, CAST(CAST([u].[SquadId] AS float) AS int), [t].[IssueDate]) AS time) = @__time_0 + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL) IS NOT NULL """); } - public override async Task Where_TimeOnly_FromDateTime_compared_to_constant(bool async) + public override async Task Projecting_property_converted_to_nullable_into_element_init(bool async) { - await base.Where_TimeOnly_FromDateTime_compared_to_constant(async); + await base.Projecting_property_converted_to_nullable_into_element_init(async); AssertSql( """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +SELECT IIF(`t`.`GearNickName` IS NOT NULL, IIF(LEN(`u`.`Nickname`) IS NULL, NULL, CLNG(LEN(`u`.`Nickname`))), NULL), IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL), IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL) + 1 FROM `Tags` AS `t` -WHERE IIF(DATEADD('h', CDBL(IIF(LEN(`t`.`Note`) IS NULL, NULL, CLNG(LEN(`t`.`Note`)))), `t`.`IssueDate`) IS NULL, NULL, TIMEVALUE(DATEADD('h', CDBL(IIF(LEN(`t`.`Note`) IS NULL, NULL, CLNG(LEN(`t`.`Note`)))), `t`.`IssueDate`))) > TIMEVALUE('09:00:00') +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL) IS NOT NULL +ORDER BY `t`.`Note` """); } - public override async Task Where_TimeOnly_FromTimeSpan_compared_to_property(bool async) + public override async Task Projecting_property_converted_to_nullable_into_member_assignment(bool async) { - await base.Where_TimeOnly_FromTimeSpan_compared_to_property(async); + await base.Projecting_property_converted_to_nullable_into_member_assignment(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE TIMEVALUE(`m`.`Duration`) < `m`.`Time` +SELECT IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL) AS `Id` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL) IS NOT NULL +ORDER BY `t`.`Note` """); } - public override async Task Where_TimeOnly_FromTimeSpan_compared_to_parameter(bool async) + public override async Task Projecting_property_converted_to_nullable_into_new_array(bool async) { - await base.Where_TimeOnly_FromTimeSpan_compared_to_parameter(async); + await base.Projecting_property_converted_to_nullable_into_new_array(async); AssertSql( """ -@__time_0='01:02:03' - -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE TIMEVALUE(`m`.`Duration`) = TIMEVALUE(@__time_0) +SELECT IIF(`t`.`GearNickName` IS NOT NULL, IIF(LEN(`u`.`Nickname`) IS NULL, NULL, CLNG(LEN(`u`.`Nickname`))), NULL), IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL), IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL) + 1 +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL) IS NOT NULL +ORDER BY `t`.`Note` """); } - public override async Task Order_by_TimeOnly_FromTimeSpan(bool async) + public override async Task Projecting_property_converted_to_nullable_into_unary(bool async) { - await base.Order_by_TimeOnly_FromTimeSpan(async); + await base.Projecting_property_converted_to_nullable_into_unary(async); AssertSql( -""" -SELECT [m].[Id], [m].[CodeName], [m].[Date], [m].[Difficulty], [m].[Duration], [m].[Rating], [m].[Time], [m].[Timeline] -FROM [Missions] AS [m] -ORDER BY CAST([m].[Duration] AS time) + """ +SELECT `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL) IS NOT NULL AND IIF(`t`.`GearNickName` IS NOT NULL, `u`.`HasSoulPatch`, NULL) = FALSE +ORDER BY `t`.`Note` """); } - public override async Task Where_DateOnly_FromDateTime_compared_to_property(bool async) + public override async Task Projecting_property_converted_to_nullable_into_member_access(bool async) { - await base.Where_DateOnly_FromDateTime_compared_to_property(async); + await base.Projecting_property_converted_to_nullable_into_member_access(async); AssertSql( """ -SELECT `t`.`Id` AS `TagId`, `m`.`Id` AS `MissionId` -FROM `Tags` AS `t`, -`Missions` AS `m` -WHERE `t`.`IssueDate` > `m`.`Date` +SELECT `u`.`Nickname` +FROM ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`CityOfBirthName` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`CityOfBirthName` + FROM `Officers` AS `o` +) AS `u` +LEFT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName` AND `u`.`SquadId` = `t`.`GearSquadId` +WHERE DATEPART('m', `t`.`IssueDate`) <> 5 +ORDER BY `u`.`Nickname` """); } - public override async Task Where_DateOnly_FromDateTime_compared_to_constant_and_parameter(bool async) + public override async Task Projecting_property_converted_to_nullable_and_use_it_in_order_by(bool async) { - //await base.Where_DateOnly_FromDateTime_compared_to_constant_and_parameter(async); - - var prm = new DateOnly(102, 10, 11); - - await AssertQuery( - async, - ss => ss.Set().Where(x => new[] { prm, new DateOnly(115, 3, 7) }.Contains(DateOnly.FromDateTime(x.IssueDate)))); + await base.Projecting_property_converted_to_nullable_and_use_it_in_order_by(async); AssertSql( - $""" -@__prm_0='0102-10-11T00:00:00.0000000' (DbType = Date) - -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` + """ +SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, TRUE, FALSE), `u`.`Nickname`, `u`.`SquadId`, `u`.`HasSoulPatch` FROM `Tags` AS `t` -WHERE `t`.`IssueDate` IN ({AssertSqlHelper.Parameter("@__prm_0")}, #0115-03-07#) +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` + UNION ALL + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` ON `t`.`GearNickName` = `u`.`Nickname` AND `t`.`GearSquadId` = `u`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `u`.`Nickname`, NULL) IS NOT NULL +ORDER BY IIF(`t`.`GearNickName` IS NOT NULL, `u`.`SquadId`, NULL), `t`.`Note` """); } @@ -12022,9 +10735,9 @@ public override async Task Join_entity_with_itself_grouped_by_key_followed_by_in """ SELECT `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`AssignedCityName`, `s0`.`CityOfBirthName`, `s0`.`FullName`, `s0`.`HasSoulPatch`, `s0`.`LeaderNickname`, `s0`.`LeaderSquadId`, `s0`.`Rank`, `s0`.`Discriminator`, `s0`.`HasSoulPatch0`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM ( - SELECT TOP 10 `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `s`.`HasSoulPatch0` + SELECT TOP @p0 `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator`, `s`.`HasSoulPatch0` FROM ( - SELECT TOP 10 `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u1`.`HasSoulPatch` AS `HasSoulPatch0` + SELECT TOP @p + @p0 `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `u1`.`HasSoulPatch` AS `HasSoulPatch0` FROM ( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` @@ -12096,12 +10809,12 @@ public override async Task Parameter_used_multiple_times_take_appropriate_inferr AssertSql( """ -@__place_0='Ephyra's location' (Size = 255), @__place_0_1='Ephyra's location' (Size = 100) -@__place_0_1='Ephyra's location' (Size = 100) +@place='Ephyra's location' (Size = 255), @place0='Ephyra's location' (Size = 100) +@place='Ephyra's location' (Size = 255) SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` FROM `Cities` AS `c` -WHERE `c`.`Nation` = @__place_0 OR `c`.`Location` = @__place_0_1 OR `c`.`Location` = @__place_0_1 +WHERE `c`.`Nation` = @place OR `c`.`Location` = @place0 OR `c`.`Location` = @place """); } @@ -12111,9 +10824,9 @@ public override async Task Enum_matching_take_value_gets_different_type_mapping( AssertSql( """ -@__value_1='1' +@value='1' -SELECT TOP 1 `u`.`Rank` BAND @__value_1 +SELECT TOP @p `u`.`Rank` BAND @value FROM ( SELECT `g`.`Nickname`, `g`.`Rank` FROM `Gears` AS `g` @@ -12131,7 +10844,7 @@ public override async Task SelectMany_Where_DefaultIfEmpty_with_navigation_in_th AssertSql( """ -@__prm_0='1' +@prm='1' SELECT `u`.`Nickname`, `u`.`FullName`, IIF(`w0`.`Id` IS NOT NULL, TRUE, FALSE) AS `Collection` FROM ( @@ -12144,7 +10857,7 @@ UNION ALL LEFT JOIN ( SELECT `w`.`Id`, `w`.`OwnerFullName` FROM `Weapons` AS `w` - WHERE `w`.`Id` > @__prm_0 + WHERE `w`.`Id` > @prm ) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` """); } @@ -12177,17 +10890,6 @@ FROM [Weapons] AS [w0] """); } - public override async Task DateTimeOffset_DateAdd_AddYears(bool async) - { - await base.DateTimeOffset_DateAdd_AddYears(async); - - AssertSql( - """ -SELECT DATEADD('yyyy', 1, `m`.`Timeline`) -FROM `Missions` AS `m` -"""); - } - public override async Task Correlated_collection_via_SelectMany_with_Distinct_missing_indentifying_columns_in_projection(bool async) { await base.Correlated_collection_via_SelectMany_with_Distinct_missing_indentifying_columns_in_projection(async); @@ -12258,7 +10960,7 @@ public override async Task SelectMany_Where_DefaultIfEmpty_with_navigation_in_th AssertSql( """ -@__isAutomatic_0='True' +@isAutomatic='True' SELECT `u`.`Nickname`, `u`.`FullName`, IIF(`w0`.`Id` IS NOT NULL, TRUE, FALSE) AS `Collection` FROM ( @@ -12271,7 +10973,7 @@ UNION ALL LEFT JOIN ( SELECT `w`.`Id`, `w`.`OwnerFullName` FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` <> @__isAutomatic_0 + WHERE `w`.`IsAutomatic` <> @isAutomatic ) AS `w0` ON `u`.`FullName` = `w0`.`OwnerFullName` """); } @@ -12309,8 +11011,8 @@ public override async Task Comparison_with_value_converted_subclass(bool async) await base.Comparison_with_value_converted_subclass(async); AssertSql( -""" -SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated` + """ +SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated` FROM `LocustHordes` AS `l` WHERE `l`.`ServerAddress` = '127.0.0.1' """); @@ -12421,26 +11123,6 @@ SELECT IIF(SUM(`m`.`Rating`) IS NULL, 0.0, SUM(`m`.`Rating`)) """); } - public override async Task ToString_guid_property_projection(bool async) - { - await AssertQuery( - async, - ss => ss.Set().Select( - ct => new { A = ct.GearNickName, B = ct.Id.ToString("B") }), - elementSorter: e => e.B, - elementAsserter: (e, a) => - { - Assert.Equal(e.A, a.A); - Assert.Equal(e.B.ToLower(), a.B.ToLower()); - }); - - AssertSql( - """ -SELECT `t`.`GearNickName`, `t`.`Id` -FROM `Tags` AS `t` -"""); - } - public override async Task Correlated_collection_with_distinct_not_projecting_identifier_column(bool async) { await base.Correlated_collection_with_distinct_not_projecting_identifier_column(async); @@ -12469,8 +11151,8 @@ public override async Task Include_after_Select_throws(bool async) await base.Include_after_Select_throws(async); AssertSql( -""" -SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, `c`.`Name`, `c`.`Location`, `c`.`Nation` + """ +SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, `c`.`Name`, `c`.`Location`, `c`.`Nation` FROM `LocustHordes` AS `l` LEFT JOIN `Cities` AS `c` ON `l`.`CapitalName` = `c`.`Name` """); @@ -12568,8 +11250,8 @@ public override async Task Project_derivied_entity_with_convert_to_parent(bool a await base.Project_derivied_entity_with_convert_to_parent(async); AssertSql( -""" -SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated` + """ +SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated` FROM `LocustHordes` AS `l` """); } @@ -12734,8 +11416,8 @@ public override async Task Include_on_derived_entity_with_cast(bool async) await base.Include_on_derived_entity_with_cast(async); AssertSql( -""" -SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, `c`.`Name`, `c`.`Location`, `c`.`Nation` + """ +SELECT `l`.`Id`, `l`.`CapitalName`, `l`.`Name`, `l`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, `c`.`Name`, `c`.`Location`, `c`.`Nation` FROM `LocustHordes` AS `l` LEFT JOIN `Cities` AS `c` ON `l`.`CapitalName` = `c`.`Name` ORDER BY `l`.`Id` @@ -13278,7 +11960,7 @@ public override async Task ElementAt_basic_with_OrderBy(bool async) FROM ( SELECT TOP 1 `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` FROM ( - SELECT TOP 1 `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` + SELECT TOP @p + 1 `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` @@ -13304,7 +11986,7 @@ public override async Task ElementAtOrDefault_basic_with_OrderBy(bool async) FROM ( SELECT TOP 1 `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` FROM ( - SELECT TOP 2 `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` + SELECT TOP @p + 1 `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` @@ -13330,7 +12012,7 @@ public override async Task ElementAtOrDefault_basic_with_OrderBy_parameter(bool FROM ( SELECT TOP 1 `u0`.`Nickname`, `u0`.`SquadId`, `u0`.`AssignedCityName`, `u0`.`CityOfBirthName`, `u0`.`FullName`, `u0`.`HasSoulPatch`, `u0`.`LeaderNickname`, `u0`.`LeaderSquadId`, `u0`.`Rank`, `u0`.`Discriminator` FROM ( - SELECT TOP 3 `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` + SELECT TOP @p + 1 `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` FROM `Gears` AS `g` @@ -13403,60 +12085,6 @@ public override async Task Using_indexer_on_byte_array_and_string_in_projection( """); } - public override async Task DateTimeOffset_to_unix_time_milliseconds(bool async) - { - await base.DateTimeOffset_to_unix_time_milliseconds(async); - - AssertSql( - """ -@__unixEpochMilliseconds_0='0' - -SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name], [s1].[SquadId], [s1].[MissionId] -FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] - FROM [Gears] AS [g] - UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] - FROM [Officers] AS [o] -) AS [t] -INNER JOIN [Squads] AS [s] ON [t].[SquadId] = [s].[Id] -LEFT JOIN [SquadMissions] AS [s1] ON [s].[Id] = [s1].[SquadId] -WHERE NOT EXISTS ( - SELECT 1 - FROM [SquadMissions] AS [s0] - INNER JOIN [Missions] AS [m] ON [s0].[MissionId] = [m].[Id] - WHERE [s].[Id] = [s0].[SquadId] AND @__unixEpochMilliseconds_0 = DATEDIFF_BIG(millisecond, '1970-01-01T00:00:00.0000000+00:00', [m].[Timeline])) -ORDER BY [t].[Nickname], [t].[SquadId], [s].[Id], [s1].[SquadId] -"""); - } - - public override async Task DateTimeOffset_to_unix_time_seconds(bool async) - { - await base.DateTimeOffset_to_unix_time_seconds(async); - - AssertSql( - """ -@__unixEpochSeconds_0='0' (DbType = Decimal) - -SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator`, `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name`, `s1`.`SquadId`, `s1`.`MissionId` -FROM (( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, 'Gear' AS `Discriminator` - FROM `Gears` AS `g` - UNION ALL - SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` - FROM `Officers` AS `o` -) AS `u` -INNER JOIN `Squads` AS `s` ON `u`.`SquadId` = `s`.`Id`) -LEFT JOIN `SquadMissions` AS `s1` ON `s`.`Id` = `s1`.`SquadId` -WHERE NOT EXISTS ( - SELECT `s0`.`SquadId` - FROM `SquadMissions` AS `s0` - INNER JOIN `Missions` AS `m` ON `s0`.`MissionId` = `m`.`Id` - WHERE `s`.`Id` = `s0`.`SquadId` AND @__unixEpochSeconds_0 = DATEDIFF('s', CDATE('1970-01-01 00:00:00'), `m`.`Timeline`)) -ORDER BY `u`.`Nickname`, `u`.`SquadId`, `s`.`Id`, `s1`.`SquadId` -"""); - } - public override async Task Set_operator_with_navigation_in_projection_groupby_aggregate(bool async) { await base.Set_operator_with_navigation_in_projection_groupby_aggregate(async); @@ -13838,8 +12466,8 @@ public override async Task Nested_contains_with_enum(bool async) AssertSql( """ -@__key_1='5f221fb9-66f4-442a-92c9-d97ed5989cc7' -@__key_1='5f221fb9-66f4-442a-92c9-d97ed5989cc7' +@key='5f221fb9-66f4-442a-92c9-d97ed5989cc7' +@key='5f221fb9-66f4-442a-92c9-d97ed5989cc7' SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( @@ -13849,16 +12477,16 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -WHERE IIF(`u`.`Rank` = 1, @__key_1, @__key_1) IN ('{0a47bcb7-a1cb-4345-8944-c58f82d6aac7}', '{5f221fb9-66f4-442a-92c9-d97ed5989cc7}') +WHERE IIF(`u`.`Rank` = 1, @key, @key) IN ({0a47bcb7-a1cb-4345-8944-c58f82d6aac7}, {5f221fb9-66f4-442a-92c9-d97ed5989cc7}) """, // """ -@__key_1='5f221fb9-66f4-442a-92c9-d97ed5989cc7' -@__key_1='5f221fb9-66f4-442a-92c9-d97ed5989cc7' +@key='5f221fb9-66f4-442a-92c9-d97ed5989cc7' +@key='5f221fb9-66f4-442a-92c9-d97ed5989cc7' SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` -WHERE IIF(`w`.`AmmunitionType` = 1, @__key_1, @__key_1) IN ('{0a47bcb7-a1cb-4345-8944-c58f82d6aac7}', '{5f221fb9-66f4-442a-92c9-d97ed5989cc7}') +WHERE IIF(`w`.`AmmunitionType` = 1, @key, @key) IN ({0a47bcb7-a1cb-4345-8944-c58f82d6aac7}, {5f221fb9-66f4-442a-92c9-d97ed5989cc7}) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetTestBase.cs b/test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetTestBase.cs index f9a8832a..8583dd24 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetTestBase.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPCInheritanceQueryJetTestBase.cs @@ -481,7 +481,7 @@ public override async Task Subquery_OfType(bool async) """ SELECT DISTINCT `u0`.`Id`, `u0`.`CountryId`, `u0`.`Name`, `u0`.`Species`, `u0`.`EagleId`, `u0`.`IsFlightless`, `u0`.`FoundOn`, `u0`.`Discriminator` FROM ( - SELECT TOP 5 `u`.`Id`, `u`.`CountryId`, `u`.`Name`, `u`.`Species`, `u`.`EagleId`, `u`.`IsFlightless`, `u`.`FoundOn`, `u`.`Discriminator` + SELECT TOP @p `u`.`Id`, `u`.`CountryId`, `u`.`Name`, `u`.`Species`, `u`.`EagleId`, `u`.`IsFlightless`, `u`.`FoundOn`, `u`.`Discriminator` FROM ( SELECT `e`.`Id`, `e`.`CountryId`, `e`.`Name`, `e`.`Species`, `e`.`EagleId`, `e`.`IsFlightless`, CVar(NULL) AS `FoundOn`, 'Eagle' AS `Discriminator` FROM `Eagle` AS `e` diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyNoTrackingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyNoTrackingQueryJetTest.cs index 6e582105..7c2597dc 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyNoTrackingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyNoTrackingQueryJetTest.cs @@ -92,14 +92,14 @@ public override async Task Skip_navigation_count_without_predicate(bool async) await base.Skip_navigation_count_without_predicate(async); AssertSql( -""" -SELECT [e].[Id], [e].[Name] -FROM [EntityOnes] AS [e] -WHERE ( - SELECT COUNT(*) - FROM [JoinOneSelfPayload] AS [j] - INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] - WHERE [e].[Id] = [j].[RightId]) > 0 + """ +SELECT `e`.`Id`, `e`.`Name` +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`) """); } @@ -2018,8 +2018,8 @@ public override async Task Contains_on_skip_collection_navigation(bool async) await base.Contains_on_skip_collection_navigation(async); AssertSql( -$""" -@__entity_equality_two_0_Id='1' (Nullable = true) + """ +@entity_equality_two_Id='1' (Nullable = true) SELECT `e`.`Id`, `e`.`Name` FROM `EntityOnes` AS `e` @@ -2027,7 +2027,7 @@ WHERE EXISTS ( SELECT 1 FROM `JoinOneToTwo` AS `j` INNER JOIN `EntityTwos` AS `e0` ON `j`.`TwoId` = `e0`.`Id` - WHERE `e`.`Id` = `j`.`OneId` AND `e0`.`Id` = {AssertSqlHelper.Parameter("@__entity_equality_two_0_Id")}) + WHERE `e`.`Id` = `j`.`OneId` AND `e0`.`Id` = @entity_equality_two_Id) """); } @@ -2193,14 +2193,14 @@ public override async Task Skip_navigation_count_without_predicate_unidirectiona await base.Skip_navigation_count_without_predicate_unidirectional(async); AssertSql( -""" -SELECT [u].[Id], [u].[Name] -FROM [UnidirectionalEntityOnes] AS [u] -WHERE ( - SELECT COUNT(*) - FROM [UnidirectionalJoinOneSelfPayload] AS [u0] - INNER JOIN [UnidirectionalEntityOnes] AS [u1] ON [u0].[LeftId] = [u1].[Id] - WHERE [u].[Id] = [u0].[RightId]) > 0 + """ +SELECT `u`.`Id`, `u`.`Name` +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`) """); } @@ -2747,8 +2747,8 @@ public override async Task Contains_on_skip_collection_navigation_unidirectional await base.Contains_on_skip_collection_navigation_unidirectional(async); AssertSql( -$""" -@__entity_equality_two_0_Id='1' (Nullable = true) + """ +@entity_equality_two_Id='1' (Nullable = true) SELECT `u`.`Id`, `u`.`Name` FROM `UnidirectionalEntityOnes` AS `u` @@ -2756,7 +2756,7 @@ WHERE EXISTS ( SELECT 1 FROM `UnidirectionalJoinOneToTwo` AS `u0` INNER JOIN `UnidirectionalEntityTwos` AS `u1` ON `u0`.`TwoId` = `u1`.`Id` - WHERE `u`.`Id` = `u0`.`OneId` AND `u1`.`Id` = {AssertSqlHelper.Parameter("@__entity_equality_two_0_Id")}) + WHERE `u`.`Id` = `u0`.`OneId` AND `u1`.`Id` = @entity_equality_two_Id) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyQueryJetTest.cs index e06904b4..b642f545 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyQueryJetTest.cs @@ -92,14 +92,14 @@ public override async Task Skip_navigation_count_without_predicate(bool async) await base.Skip_navigation_count_without_predicate(async); AssertSql( -""" -SELECT [e].[Id], [e].[Name] -FROM [EntityOnes] AS [e] -WHERE ( - SELECT COUNT(*) - FROM [JoinOneSelfPayload] AS [j] - INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] - WHERE [e].[Id] = [j].[RightId]) > 0 + """ +SELECT `e`.`Id`, `e`.`Name` +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`) """); } @@ -2026,8 +2026,8 @@ public override async Task Contains_on_skip_collection_navigation(bool async) await base.Contains_on_skip_collection_navigation(async); AssertSql( -$""" -@__entity_equality_two_0_Id='1' (Nullable = true) + """ +@entity_equality_two_Id='1' (Nullable = true) SELECT `e`.`Id`, `e`.`Name` FROM `EntityOnes` AS `e` @@ -2035,7 +2035,7 @@ WHERE EXISTS ( SELECT 1 FROM `JoinOneToTwo` AS `j` INNER JOIN `EntityTwos` AS `e0` ON `j`.`TwoId` = `e0`.`Id` - WHERE `e`.`Id` = `j`.`OneId` AND `e0`.`Id` = {AssertSqlHelper.Parameter("@__entity_equality_two_0_Id")}) + WHERE `e`.`Id` = `j`.`OneId` AND `e0`.`Id` = @entity_equality_two_Id) """); } @@ -2194,14 +2194,14 @@ public override async Task Skip_navigation_count_without_predicate_unidirectiona await base.Skip_navigation_count_without_predicate_unidirectional(async); AssertSql( -""" -SELECT [u].[Id], [u].[Name] -FROM [UnidirectionalEntityOnes] AS [u] -WHERE ( - SELECT COUNT(*) - FROM [UnidirectionalJoinOneSelfPayload] AS [u0] - INNER JOIN [UnidirectionalEntityOnes] AS [u1] ON [u0].[LeftId] = [u1].[Id] - WHERE [u].[Id] = [u0].[RightId]) > 0 + """ +SELECT `u`.`Id`, `u`.`Name` +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`) """); } @@ -2771,8 +2771,8 @@ public override async Task Contains_on_skip_collection_navigation_unidirectional await base.Contains_on_skip_collection_navigation_unidirectional(async); AssertSql( -$""" -@__entity_equality_two_0_Id='1' (Nullable = true) + """ +@entity_equality_two_Id='1' (Nullable = true) SELECT `u`.`Id`, `u`.`Name` FROM `UnidirectionalEntityOnes` AS `u` @@ -2780,7 +2780,7 @@ WHERE EXISTS ( SELECT 1 FROM `UnidirectionalJoinOneToTwo` AS `u0` INNER JOIN `UnidirectionalEntityTwos` AS `u1` ON `u0`.`TwoId` = `u1`.`Id` - WHERE `u`.`Id` = `u0`.`OneId` AND `u1`.`Id` = {AssertSqlHelper.Parameter("@__entity_equality_two_0_Id")}) + WHERE `u`.`Id` = `u0`.`OneId` AND `u1`.`Id` = @entity_equality_two_Id) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetTest.cs index 44fad800..0bb3a5af 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetTest.cs @@ -481,7 +481,7 @@ public override async Task Subquery_OfType(bool async) """ SELECT DISTINCT `a0`.`Id`, `a0`.`CountryId`, `a0`.`Discriminator`, `a0`.`Name`, `a0`.`Species`, `a0`.`EagleId`, `a0`.`IsFlightless`, `a0`.`FoundOn` FROM ( - SELECT TOP 5 `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`FoundOn` + SELECT TOP @p `a`.`Id`, `a`.`CountryId`, `a`.`Discriminator`, `a`.`Name`, `a`.`Species`, `a`.`EagleId`, `a`.`IsFlightless`, `a`.`FoundOn` FROM `Animals` AS `a` ORDER BY `a`.`Species` ) AS `a0` diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTFiltersInheritanceQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPTFiltersInheritanceQueryJetTest.cs index 4d69ca41..fa74fe23 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTFiltersInheritanceQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPTFiltersInheritanceQueryJetTest.cs @@ -186,14 +186,14 @@ public override async Task Can_use_IgnoreQueryFilters_and_GetDatabaseValues(bool INNER JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id` """, // - $""" -@__p_0='1' + """ +@p='1' SELECT TOP 1 `a`.`Id`, `a`.`CountryId`, `a`.`Name`, `a`.`Species`, `b`.`EagleId`, `b`.`IsFlightless`, `e`.`Group` FROM (`Animals` AS `a` INNER JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id`) INNER JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id` -WHERE `a`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} +WHERE `a`.`Id` = @p """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs index d2f21dc3..127514d4 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs @@ -267,17 +267,17 @@ public override async Task Include_where_list_contains_navigation(bool async) await base.Include_where_list_contains_navigation(async); AssertSql( -""" + """ SELECT `t`.`Id` FROM `Tags` AS `t` """, -// -""" + // + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator`, `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` FROM (`Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` -WHERE `t`.`Id` IS NOT NULL AND `t`.`Id` IN ('{b39a6fba-9026-4d69-828e-fd7068673e57}', '{34c8d86e-a4ac-4be5-827f-584dda348a07}', '{70534e05-782c-4052-8720-c2c54481ce5f}', '{a8ad98f9-e023-4e2a-9a70-c2728455bd34}', '{df36f493-463f-4123-83f9-6b135deeb7ba}', '{a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}') +WHERE `t`.`Id` IS NOT NULL AND `t`.`Id` IN ({b39a6fba-9026-4d69-828e-fd7068673e57}, {34c8d86e-a4ac-4be5-827f-584dda348a07}, {70534e05-782c-4052-8720-c2c54481ce5f}, {a8ad98f9-e023-4e2a-9a70-c2728455bd34}, {df36f493-463f-4123-83f9-6b135deeb7ba}, {a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}) """); } @@ -286,18 +286,18 @@ public override async Task Include_where_list_contains_navigation2(bool async) await base.Include_where_list_contains_navigation2(async); AssertSql( -""" + """ SELECT `t`.`Id` FROM `Tags` AS `t` """, -// -""" + // + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator`, `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` FROM ((`Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) INNER JOIN `Cities` AS `c` ON `g`.`CityOfBirthName` = `c`.`Name`) LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` -WHERE `c`.`Location` IS NOT NULL AND `t`.`Id` IN ('{b39a6fba-9026-4d69-828e-fd7068673e57}', '{34c8d86e-a4ac-4be5-827f-584dda348a07}', '{70534e05-782c-4052-8720-c2c54481ce5f}', '{a8ad98f9-e023-4e2a-9a70-c2728455bd34}', '{df36f493-463f-4123-83f9-6b135deeb7ba}', '{a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}') +WHERE `c`.`Location` IS NOT NULL AND `t`.`Id` IN ({b39a6fba-9026-4d69-828e-fd7068673e57}, {34c8d86e-a4ac-4be5-827f-584dda348a07}, {70534e05-782c-4052-8720-c2c54481ce5f}, {a8ad98f9-e023-4e2a-9a70-c2728455bd34}, {df36f493-463f-4123-83f9-6b135deeb7ba}, {a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}) """); } @@ -306,17 +306,17 @@ public override async Task Navigation_accessed_twice_outside_and_inside_subquery await base.Navigation_accessed_twice_outside_and_inside_subquery(async); AssertSql( -""" + """ SELECT `t`.`Id` FROM `Tags` AS `t` """, -// -""" + // + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM (`Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` -WHERE `t`.`Id` IS NOT NULL AND `t`.`Id` IN ('{b39a6fba-9026-4d69-828e-fd7068673e57}', '{34c8d86e-a4ac-4be5-827f-584dda348a07}', '{70534e05-782c-4052-8720-c2c54481ce5f}', '{a8ad98f9-e023-4e2a-9a70-c2728455bd34}', '{df36f493-463f-4123-83f9-6b135deeb7ba}', '{a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}') +WHERE `t`.`Id` IS NOT NULL AND `t`.`Id` IN ({b39a6fba-9026-4d69-828e-fd7068673e57}, {34c8d86e-a4ac-4be5-827f-584dda348a07}, {70534e05-782c-4052-8720-c2c54481ce5f}, {a8ad98f9-e023-4e2a-9a70-c2728455bd34}, {df36f493-463f-4123-83f9-6b135deeb7ba}, {a7be028a-0cf2-448f-ab55-ce8bc5d8cf69}) """); } @@ -440,1153 +440,813 @@ LEFT JOIN ( """); } - public override async Task Where_enum(bool async) + public override async Task Where_count_subquery_without_collision(bool async) { - await base.Where_enum(async); + await base.Where_count_subquery_without_collision(async); AssertSql( """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE `g`.`Rank` = 4 +WHERE ( + SELECT COUNT(*) + FROM `Weapons` AS `w` + WHERE `g`.`FullName` = `w`.`OwnerFullName`) = 2 """); } - public override async Task Where_nullable_enum_with_constant(bool async) + public override async Task Where_any_subquery_without_collision(bool async) { - await base.Where_nullable_enum_with_constant(async); + await base.Where_any_subquery_without_collision(async); AssertSql( """ -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` = 1 +SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` +FROM `Gears` AS `g` +LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` +WHERE EXISTS ( + SELECT 1 + FROM `Weapons` AS `w` + WHERE `g`.`FullName` = `w`.`OwnerFullName`) """); } - public override async Task Where_nullable_enum_with_null_constant(bool async) + public override async Task Select_inverted_boolean(bool async) { - await base.Where_nullable_enum_with_null_constant(async); + await base.Select_inverted_boolean(async); AssertSql( -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + """ +SELECT `w`.`Id`, `w`.`IsAutomatic` BXOR TRUE AS `Manual` FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` IS NULL +WHERE `w`.`IsAutomatic` = TRUE """); } - public override async Task Where_nullable_enum_with_non_nullable_parameter(bool async) + public override async Task Select_inverted_nullable_boolean(bool async) { - await base.Where_nullable_enum_with_non_nullable_parameter(async); + await base.Select_inverted_nullable_boolean(async); AssertSql( -""" -@__ammunitionType_0='1' - -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` = @__ammunitionType_0 + """ +SELECT `f`.`Id`, `l`.`Eradicated` BXOR TRUE AS `Alive` +FROM `Factions` AS `f` +INNER JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` """); } - public override async Task Where_nullable_enum_with_nullable_parameter(bool async) + public override async Task Select_comparison_with_null(bool async) { - await base.Where_nullable_enum_with_nullable_parameter(async); + await base.Select_comparison_with_null(async); AssertSql( -""" -@__ammunitionType_0='1' (Nullable = true) + """ +@ammunitionType='1' (Nullable = true) +@ammunitionType='1' (Nullable = true) -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` = @ammunitionType AND `w`.`AmmunitionType` IS NOT NULL, TRUE, FALSE) AS `Cartridge` FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` = @__ammunitionType_0 +WHERE `w`.`AmmunitionType` = @ammunitionType """, -// -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + // + """ +SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` IS NULL, TRUE, FALSE) AS `Cartridge` FROM `Weapons` AS `w` WHERE `w`.`AmmunitionType` IS NULL """); } - public override async Task Where_bitwise_and_enum(bool async) + public override async Task Select_null_parameter(bool async) { - await base.Where_bitwise_and_enum(async); + await base.Select_null_parameter(async); AssertSql( -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` -FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (`g`.`Rank` BAND 2) > 0 + """ +@ammunitionType='1' (Nullable = true) + +SELECT `w`.`Id`, @ammunitionType AS `AmmoType` +FROM `Weapons` AS `w` """, -// -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` -FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (`g`.`Rank` BAND 2) = 2 + // + """ +SELECT `w`.`Id`, CVar(NULL) AS `AmmoType` +FROM `Weapons` AS `w` +""", + // + """ +@ammunitionType='2' (Nullable = true) + +SELECT `w`.`Id`, @ammunitionType AS `AmmoType` +FROM `Weapons` AS `w` +""", + // + """ +SELECT `w`.`Id`, CVar(NULL) AS `AmmoType` +FROM `Weapons` AS `w` """); } - public override async Task Where_bitwise_and_integral(bool async) + public override async Task Select_ternary_operation_with_boolean(bool async) { - await base.Where_bitwise_and_integral(async); + await base.Select_ternary_operation_with_boolean(async); AssertSql( """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` -FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (`g`.`Rank` BAND 1) = 1 -""", -// -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` -FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (CLNG(`g`.`Rank`) BAND 1) = 1 -""", -// -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` -FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (CINT(`g`.`Rank`) BAND 1) = 1 +SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = TRUE, 1, 0) AS `Num` +FROM `Weapons` AS `w` """); } - public override async Task Where_bitwise_and_nullable_enum_with_constant(bool async) + public override async Task Select_ternary_operation_with_inverted_boolean(bool async) { - await base.Where_bitwise_and_nullable_enum_with_constant(async); + await base.Select_ternary_operation_with_inverted_boolean(async); AssertSql( -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + """ +SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE, 1, 0) AS `Num` FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND 1) > 0 """); } - public override async Task Where_bitwise_and_nullable_enum_with_null_constant(bool async) + public override async Task Select_ternary_operation_with_has_value_not_null(bool async) { - await base.Where_bitwise_and_nullable_enum_with_null_constant(async); + await base.Select_ternary_operation_with_has_value_not_null(async); AssertSql( - """ -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +""" +SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` IS NOT NULL AND `w`.`AmmunitionType` = 1, 'Yes', 'No') AS `IsCartridge` FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND NULL) > 0 +WHERE `w`.`AmmunitionType` IS NOT NULL AND `w`.`AmmunitionType` = 1 """); } - public override async Task Where_bitwise_and_nullable_enum_with_non_nullable_parameter(bool async) + public override async Task Select_ternary_operation_multiple_conditions(bool async) { - await base.Where_bitwise_and_nullable_enum_with_non_nullable_parameter(async); + await base.Select_ternary_operation_multiple_conditions(async); AssertSql( """ -@__ammunitionType_0='1' - -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` = 2 AND `w`.`SynergyWithId` = 1, 'Yes', 'No') AS `IsCartridge` FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND @__ammunitionType_0) > 0 """); } - public override async Task Where_bitwise_and_nullable_enum_with_nullable_parameter(bool async) + public override async Task Select_ternary_operation_multiple_conditions_2(bool async) { - await base.Where_bitwise_and_nullable_enum_with_nullable_parameter(async); + await base.Select_ternary_operation_multiple_conditions_2(async); AssertSql( -""" -@__ammunitionType_0='1' (Nullable = true) - -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND @__ammunitionType_0) > 0 -""", -// -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` + """ +SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE AND `w`.`SynergyWithId` = 1, 'Yes', 'No') AS `IsCartridge` FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND NULL) > 0 """); } - public override async Task Where_bitwise_or_enum(bool async) + public override async Task Select_multiple_conditions(bool async) { - await base.Where_bitwise_or_enum(async); + await base.Select_multiple_conditions(async); AssertSql( """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` -FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (`g`.`Rank` BOR 2) > 0 +SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE AND `w`.`SynergyWithId` = 1 AND `w`.`SynergyWithId` IS NOT NULL, TRUE, FALSE) AS `IsCartridge` +FROM `Weapons` AS `w` """); } - public override async Task Bitwise_projects_values_in_select(bool async) + public override async Task Select_nested_ternary_operations(bool async) { - await base.Bitwise_projects_values_in_select(async); + await base.Select_nested_ternary_operations(async); AssertSql( """ -SELECT TOP 1 CBOOL((`g`.`Rank` BAND 2) BXOR 2) BXOR TRUE AS `BitwiseTrue`, CBOOL((`g`.`Rank` BAND 2) BXOR 4) BXOR TRUE AS `BitwiseFalse`, `g`.`Rank` BAND 2 AS `BitwiseValue` -FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND 2) = 2 +SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE, IIF(`w`.`AmmunitionType` = 1, 'ManualCartridge', 'Manual'), 'Auto') AS `IsManualCartridge` +FROM `Weapons` AS `w` """); } - public override async Task Where_enum_has_flag(bool async) + public override async Task Null_propagation_optimization1(bool async) { - await base.Where_enum_has_flag(async); + await base.Null_propagation_optimization1(async); AssertSql( -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` -FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (`g`.`Rank` BAND 2) = 2 -""", -// -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` -FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (`g`.`Rank` BAND 18) = 18 -""", -// -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` -FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (`g`.`Rank` BAND 1) = 1 -""", -// -""" + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (`g`.`Rank` BAND 1) = 1 -""", -// +WHERE `g`.`LeaderNickname` = 'Marcus' +"""); + } + + public override async Task Null_propagation_optimization2(bool async) + { + await base.Null_propagation_optimization2(async); + + AssertSql( """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (2 BAND `g`.`Rank`) = `g`.`Rank` +WHERE IIF(`g`.`LeaderNickname` IS NULL, NULL, IIF(`g`.`LeaderNickname` LIKE '%us', TRUE, FALSE)) = TRUE """); } - public override async Task Where_enum_has_flag_subquery(bool async) + public override async Task Null_propagation_optimization3(bool async) { - await base.Where_enum_has_flag_subquery(async); + await base.Null_propagation_optimization3(async); AssertSql( - """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` -FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (`g`.`Rank` BAND IIF(( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) IS NULL, 0, ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`))) = IIF(( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) IS NULL, 0, ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`)) -""", - // - """ + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (2 BAND IIF(( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) IS NULL, 0, ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`))) = IIF(( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) IS NULL, 0, ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`)) +WHERE IIF(`g`.`LeaderNickname` IS NOT NULL, IIF(`g`.`LeaderNickname` LIKE '%us', TRUE, FALSE), NULL) = TRUE """); } - public override async Task Where_enum_has_flag_subquery_with_pushdown(bool async) + public override async Task Null_propagation_optimization4(bool async) { - await base.Where_enum_has_flag_subquery_with_pushdown(async); + await base.Null_propagation_optimization4(async); + // issue #16050 AssertSql( """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (`g`.`Rank` BAND ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`)) = ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) OR ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) IS NULL -""", - // +WHERE IIF(`g`.`LeaderNickname` IS NULL, NULL, IIF(LEN(`g`.`LeaderNickname`) IS NULL, NULL, CLNG(LEN(`g`.`LeaderNickname`)))) = 5 +"""); + } + + public override async Task Null_propagation_optimization5(bool async) + { + await base.Null_propagation_optimization5(async); + + AssertSql( """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (2 BAND ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`)) = ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) OR ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) IS NULL +WHERE IIF(`g`.`LeaderNickname` IS NOT NULL, IIF(LEN(`g`.`LeaderNickname`) IS NULL, NULL, CLNG(LEN(`g`.`LeaderNickname`))), NULL) = 5 """); } - public override async Task Where_enum_has_flag_subquery_client_eval(bool async) + public override async Task Null_propagation_optimization6(bool async) { - await base.Where_enum_has_flag_subquery_client_eval(async); + await base.Null_propagation_optimization6(async); AssertSql( """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (`g`.`Rank` BAND ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`)) = ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) OR ( - SELECT TOP 1 `g0`.`Rank` - FROM `Gears` AS `g0` - ORDER BY `g0`.`Nickname`, `g0`.`SquadId`) IS NULL +WHERE IIF(`g`.`LeaderNickname` IS NOT NULL, IIF(LEN(`g`.`LeaderNickname`) IS NULL, NULL, CLNG(LEN(`g`.`LeaderNickname`))), NULL) = 5 """); } - public override async Task Where_enum_has_flag_with_non_nullable_parameter(bool async) + public override async Task Select_null_propagation_optimization7(bool async) { - await base.Where_enum_has_flag_with_non_nullable_parameter(async); + await base.Select_null_propagation_optimization7(async); AssertSql( """ -@__parameter_0='2' -@__parameter_0='2' - -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` +SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, `g`.`LeaderNickname` & `g`.`LeaderNickname`, NULL) FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (`g`.`Rank` BAND @__parameter_0) = @__parameter_0 """); } - public override async Task Where_has_flag_with_nullable_parameter(bool async) + public override async Task Select_null_propagation_optimization8(bool async) { - await base.Where_has_flag_with_nullable_parameter(async); + await base.Select_null_propagation_optimization8(async); AssertSql( - """ -@__parameter_0='2' (Nullable = true) -@__parameter_0='2' (Nullable = true) - -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` + """ +SELECT IIF(`g`.`LeaderNickname` IS NULL, '', `g`.`LeaderNickname`) & IIF(`g`.`LeaderNickname` IS NULL, '', `g`.`LeaderNickname`) FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (`g`.`Rank` BAND @__parameter_0) = @__parameter_0 """); } - public override async Task Select_enum_has_flag(bool async) + public override async Task Select_null_propagation_optimization9(bool async) { - await base.Select_enum_has_flag(async); + await base.Select_null_propagation_optimization9(async); AssertSql( """ -SELECT TOP 1 CBOOL((`g`.`Rank` BAND 2) BXOR 2) BXOR TRUE AS `hasFlagTrue`, CBOOL((`g`.`Rank` BAND 4) BXOR 4) BXOR TRUE AS `hasFlagFalse` +SELECT IIF(LEN(`g`.`FullName`) IS NULL, NULL, CLNG(LEN(`g`.`FullName`))) FROM `Gears` AS `g` -WHERE (`g`.`Rank` BAND 2) = 2 """); } - public override async Task Where_count_subquery_without_collision(bool async) + public override async Task Select_null_propagation_negative1(bool async) { - await base.Where_count_subquery_without_collision(async); + await base.Select_null_propagation_negative1(async); AssertSql( -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` + """ +SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, CBOOL(IIF(LEN(`g`.`Nickname`) IS NULL, NULL, CLNG(LEN(`g`.`Nickname`))) BXOR 5) BXOR TRUE, NULL) FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE ( - SELECT COUNT(*) - FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName`) = 2 """); } - public override async Task Where_any_subquery_without_collision(bool async) + public override async Task Select_null_propagation_negative2(bool async) { - await base.Where_any_subquery_without_collision(async); + await base.Select_null_propagation_negative2(async); AssertSql( -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` -FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE EXISTS ( - SELECT 1 - FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName`) + """ +SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, `s`.`LeaderNickname`, NULL) +FROM `Gears` AS `g`, +( + SELECT `g0`.`LeaderNickname` + FROM `Gears` AS `g0` +) AS `s` """); } - public override async Task Select_inverted_boolean(bool async) + public override async Task Select_null_propagation_negative3(bool async) { - await base.Select_inverted_boolean(async); + await base.Select_null_propagation_negative3(async); AssertSql( - """ -SELECT `w`.`Id`, `w`.`IsAutomatic` BXOR TRUE AS `Manual` -FROM `Weapons` AS `w` -WHERE `w`.`IsAutomatic` = TRUE +""" +SELECT [t].[Nickname], CASE + WHEN ([t].[Nickname] IS NOT NULL) AND ([t].[SquadId] IS NOT NULL) THEN CASE + WHEN [t].[LeaderNickname] IS NOT NULL THEN CAST(1 AS bit) + ELSE CAST(0 AS bit) + END + ELSE NULL +END AS [Condition] +FROM [Gears] AS [g] +LEFT JOIN ( + SELECT [g0].[Nickname], [g0].[SquadId], [g0].[LeaderNickname] + FROM [Gears] AS [g0] +) AS [t] ON [g].[HasSoulPatch] = CAST(1 AS bit) +ORDER BY [t].[Nickname] """); } - public override async Task Select_inverted_nullable_boolean(bool async) + public override async Task Select_null_propagation_negative4(bool async) { - await base.Select_inverted_nullable_boolean(async); + await base.Select_null_propagation_negative4(async); AssertSql( - """ -SELECT `f`.`Id`, `l`.`Eradicated` BXOR TRUE AS `Alive` -FROM `Factions` AS `f` -INNER JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` +""" +SELECT CASE + WHEN ([t].[Nickname] IS NOT NULL) AND ([t].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + ELSE CAST(0 AS bit) +END, [t].[Nickname] +FROM [Gears] AS [g] +LEFT JOIN ( + SELECT [g0].[Nickname], [g0].[SquadId] + FROM [Gears] AS [g0] +) AS [t] ON [g].[HasSoulPatch] = CAST(1 AS bit) +ORDER BY [t].[Nickname] """); } - public override async Task Select_comparison_with_null(bool async) + public override async Task Select_null_propagation_negative5(bool async) { - await base.Select_comparison_with_null(async); + await base.Select_null_propagation_negative5(async); AssertSql( """ -@__ammunitionType_0='1' (Nullable = true) -@__ammunitionType_0='1' (Nullable = true) - -SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` = @__ammunitionType_0 AND `w`.`AmmunitionType` IS NOT NULL, TRUE, FALSE) AS `Cartridge` -FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` = @__ammunitionType_0 -""", -// -""" -SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` IS NULL, TRUE, FALSE) AS `Cartridge` -FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` IS NULL +SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, IIF(IIF(LEN(`g`.`LeaderNickname`) IS NULL, NULL, CLNG(LEN(`g`.`LeaderNickname`))) <> IIF(LEN(`g`.`LeaderNickname`) IS NULL, NULL, CLNG(LEN(`g`.`LeaderNickname`))), TRUE, FALSE), NULL) +FROM `Gears` AS `g` """); } - public override async Task Select_null_parameter(bool async) + public override async Task Select_null_propagation_negative6(bool async) { - await base.Select_null_parameter(async); + await base.Select_null_propagation_negative6(async); AssertSql( """ -@__ammunitionType_0='1' (Nullable = true) - -SELECT `w`.`Id`, @__ammunitionType_0 AS `AmmoType` -FROM `Weapons` AS `w` -""", - // - """ -SELECT `w`.`Id`, CVar(NULL) AS `AmmoType` -FROM `Weapons` AS `w` -""", - // - """ -@__ammunitionType_0='2' (Nullable = true) - -SELECT `w`.`Id`, @__ammunitionType_0 AS `AmmoType` -FROM `Weapons` AS `w` -""", - // - """ -SELECT `w`.`Id`, CVar(NULL) AS `AmmoType` -FROM `Weapons` AS `w` +SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, FALSE, NULL) +FROM `Gears` AS `g` """); } - public override async Task Select_ternary_operation_with_boolean(bool async) + public override async Task Select_null_propagation_negative7(bool async) { - await base.Select_ternary_operation_with_boolean(async); + await base.Select_null_propagation_negative7(async); AssertSql( """ -SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = TRUE, 1, 0) AS `Num` -FROM `Weapons` AS `w` +SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, TRUE, NULL) +FROM `Gears` AS `g` """); } - public override async Task Select_ternary_operation_with_inverted_boolean(bool async) + public override async Task Select_null_propagation_negative8(bool async) { - await base.Select_ternary_operation_with_inverted_boolean(async); + await base.Select_null_propagation_negative8(async); AssertSql( """ -SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE, 1, 0) AS `Num` -FROM `Weapons` AS `w` -"""); - } - - public override async Task Select_ternary_operation_with_has_value_not_null(bool async) - { - await base.Select_ternary_operation_with_has_value_not_null(async); - - AssertSql( -""" -SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` IS NOT NULL AND `w`.`AmmunitionType` = 1, 'Yes', 'No') AS `IsCartridge` -FROM `Weapons` AS `w` -WHERE `w`.`AmmunitionType` IS NOT NULL AND `w`.`AmmunitionType` = 1 +SELECT IIF(`s0`.`Id` IS NOT NULL, `c`.`Name`, NULL) +FROM ((`Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName` + FROM `Gears` AS `g` +) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId`) +LEFT JOIN `Squads` AS `s0` ON `s`.`SquadId` = `s0`.`Id`) +LEFT JOIN `Cities` AS `c` ON `s`.`AssignedCityName` = `c`.`Name` """); } - public override async Task Select_ternary_operation_multiple_conditions(bool async) + public override async Task Select_null_propagation_negative9(bool async) { - await base.Select_ternary_operation_multiple_conditions(async); + await base.Select_null_propagation_negative9(async); AssertSql( -""" -SELECT `w`.`Id`, IIF(`w`.`AmmunitionType` = 2 AND `w`.`SynergyWithId` = 1, 'Yes', 'No') AS `IsCartridge` -FROM `Weapons` AS `w` + """ +SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, CBOOL(IIF(LEN(`g`.`Nickname`) IS NULL, NULL, CLNG(LEN(`g`.`Nickname`))) BXOR 5) BXOR TRUE, NULL) +FROM `Gears` AS `g` """); } - public override async Task Select_ternary_operation_multiple_conditions_2(bool async) + public override async Task Select_null_propagation_works_for_navigations_with_composite_keys(bool async) { - await base.Select_ternary_operation_multiple_conditions_2(async); + await base.Select_null_propagation_works_for_navigations_with_composite_keys(async); AssertSql( """ -SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE AND `w`.`SynergyWithId` = 1, 'Yes', 'No') AS `IsCartridge` -FROM `Weapons` AS `w` +SELECT `s`.`Nickname` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` +) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` """); } - public override async Task Select_multiple_conditions(bool async) + public override async Task Select_null_propagation_works_for_multiple_navigations_with_composite_keys(bool async) { - await base.Select_multiple_conditions(async); + await base.Select_null_propagation_works_for_multiple_navigations_with_composite_keys(async); AssertSql( """ -SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE AND `w`.`SynergyWithId` = 1 AND `w`.`SynergyWithId` IS NOT NULL, TRUE, FALSE) AS `IsCartridge` -FROM `Weapons` AS `w` +SELECT IIF(`c`.`Name` IS NOT NULL, `c`.`Name`, NULL) +FROM (((`Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` +) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId`) +LEFT JOIN `Tags` AS `t0` ON (`s`.`Nickname` = `t0`.`GearNickName` OR (`s`.`Nickname` IS NULL AND `t0`.`GearNickName` IS NULL)) AND (`s`.`SquadId` = `t0`.`GearSquadId` OR (`s`.`SquadId` IS NULL AND `t0`.`GearSquadId` IS NULL))) +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName` + FROM `Gears` AS `g0` +) AS `s0` ON `t0`.`GearNickName` = `s0`.`Nickname` AND `t0`.`GearSquadId` = `s0`.`SquadId`) +LEFT JOIN `Cities` AS `c` ON `s0`.`AssignedCityName` = `c`.`Name` """); } - public override async Task Select_nested_ternary_operations(bool async) + public override async Task Select_conditional_with_anonymous_type_and_null_constant(bool async) { - await base.Select_nested_ternary_operations(async); + await base.Select_conditional_with_anonymous_type_and_null_constant(async); AssertSql( """ -SELECT `w`.`Id`, IIF(`w`.`IsAutomatic` = FALSE, IIF(`w`.`AmmunitionType` = 1, 'ManualCartridge', 'Manual'), 'Auto') AS `IsManualCartridge` -FROM `Weapons` AS `w` +SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, TRUE, FALSE), `g`.`HasSoulPatch` +FROM `Gears` AS `g` +ORDER BY `g`.`Nickname` """); } - public override async Task Null_propagation_optimization1(bool async) + public override async Task Select_conditional_with_anonymous_types(bool async) { - await base.Null_propagation_optimization1(async); + await base.Select_conditional_with_anonymous_types(async); AssertSql( """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` +SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, TRUE, FALSE), `g`.`Nickname`, `g`.`FullName` FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE `g`.`LeaderNickname` = 'Marcus' +ORDER BY `g`.`Nickname` """); } - public override async Task Null_propagation_optimization2(bool async) + public override async Task Where_conditional_equality_1(bool async) { - await base.Null_propagation_optimization2(async); + await base.Where_conditional_equality_1(async); AssertSql( """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` +SELECT `g`.`Nickname` FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE IIF(`g`.`LeaderNickname` IS NULL, NULL, IIF(`g`.`LeaderNickname` LIKE '%us', TRUE, FALSE)) = TRUE +WHERE `g`.`LeaderNickname` IS NULL +ORDER BY `g`.`Nickname` """); } - public override async Task Null_propagation_optimization3(bool async) + public override async Task Where_conditional_equality_2(bool async) { - await base.Null_propagation_optimization3(async); + await base.Where_conditional_equality_2(async); AssertSql( - """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` +""" +SELECT `g`.`Nickname` FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE IIF(`g`.`LeaderNickname` IS NOT NULL, IIF(`g`.`LeaderNickname` LIKE '%us', TRUE, FALSE), NULL) = TRUE +WHERE `g`.`LeaderNickname` IS NULL +ORDER BY `g`.`Nickname` """); } - public override async Task Null_propagation_optimization4(bool async) + public override async Task Where_conditional_equality_3(bool async) { - await base.Null_propagation_optimization4(async); + await base.Where_conditional_equality_3(async); - // issue #16050 AssertSql( """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` +SELECT `g`.`Nickname` FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE IIF(`g`.`LeaderNickname` IS NULL, NULL, IIF(LEN(`g`.`LeaderNickname`) IS NULL, NULL, CLNG(LEN(`g`.`LeaderNickname`)))) = 5 +ORDER BY `g`.`Nickname` """); } - public override async Task Null_propagation_optimization5(bool async) + public override async Task Select_coalesce_with_anonymous_types(bool async) { - await base.Null_propagation_optimization5(async); + await base.Select_coalesce_with_anonymous_types(async); AssertSql( - """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` +""" +SELECT `g`.`LeaderNickname`, `g`.`FullName` FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE IIF(`g`.`LeaderNickname` IS NOT NULL, IIF(LEN(`g`.`LeaderNickname`) IS NULL, NULL, CLNG(LEN(`g`.`LeaderNickname`))), NULL) = 5 +ORDER BY `g`.`Nickname` """); } - public override async Task Null_propagation_optimization6(bool async) + public override async Task Where_compare_anonymous_types(bool async) { - await base.Null_propagation_optimization6(async); + await base.Where_compare_anonymous_types(async); - AssertSql( - """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` -FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE IIF(`g`.`LeaderNickname` IS NOT NULL, IIF(LEN(`g`.`LeaderNickname`) IS NULL, NULL, CLNG(LEN(`g`.`LeaderNickname`))), NULL) = 5 -"""); + AssertSql(); } - public override async Task Select_null_propagation_optimization7(bool async) + public override async Task Where_member_access_on_anonymous_type(bool async) { - await base.Select_null_propagation_optimization7(async); + await base.Where_member_access_on_anonymous_type(async); AssertSql( """ -SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, `g`.`LeaderNickname` & `g`.`LeaderNickname`, NULL) +SELECT `g`.`Nickname` FROM `Gears` AS `g` +WHERE `g`.`LeaderNickname` = 'Marcus' """); } - public override async Task Select_null_propagation_optimization8(bool async) + public override async Task Where_compare_anonymous_types_with_uncorrelated_members(bool async) { - await base.Select_null_propagation_optimization8(async); + await base.Where_compare_anonymous_types_with_uncorrelated_members(async); AssertSql( """ -SELECT IIF(`g`.`LeaderNickname` IS NULL, '', `g`.`LeaderNickname`) & IIF(`g`.`LeaderNickname` IS NULL, '', `g`.`LeaderNickname`) +SELECT `g`.`Nickname` FROM `Gears` AS `g` +WHERE 0 = 1 """); } - public override async Task Select_null_propagation_optimization9(bool async) + public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scalar(bool async) { - await base.Select_null_propagation_optimization9(async); + await base.Select_Where_Navigation_Scalar_Equals_Navigation_Scalar(async); AssertSql( """ -SELECT IIF(LEN(`g`.`FullName`) IS NULL, NULL, CLNG(LEN(`g`.`FullName`))) -FROM `Gears` AS `g` +SELECT `s`.`Id`, `s`.`GearNickName`, `s`.`GearSquadId`, `s`.`IssueDate`, `s`.`Note`, `s`.`Id0`, `s`.`GearNickName0`, `s`.`GearSquadId0`, `s`.`IssueDate0`, `s`.`Note0` +FROM (( + SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note`, `t0`.`Id` AS `Id0`, `t0`.`GearNickName` AS `GearNickName0`, `t0`.`GearSquadId` AS `GearSquadId0`, `t0`.`IssueDate` AS `IssueDate0`, `t0`.`Note` AS `Note0` + FROM `Tags` AS `t`, + `Tags` AS `t0` +) AS `s` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` +) AS `s0` ON `s`.`GearNickName` = `s0`.`Nickname` AND `s`.`GearSquadId` = `s0`.`SquadId`) +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId` + FROM `Gears` AS `g0` +) AS `s1` ON `s`.`GearNickName0` = `s1`.`Nickname` AND `s`.`GearSquadId0` = `s1`.`SquadId` +WHERE `s0`.`Nickname` = `s1`.`Nickname` OR (`s0`.`Nickname` IS NULL AND `s1`.`Nickname` IS NULL) """); } - public override async Task Select_null_propagation_negative1(bool async) + public override async Task Conditional_Navigation_With_Trivial_Member_Access(bool async) { - await base.Select_null_propagation_negative1(async); + await base.Conditional_Navigation_With_Trivial_Member_Access(async); AssertSql( """ -SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, CBOOL(IIF(LEN(`g`.`Nickname`) IS NULL, NULL, CLNG(LEN(`g`.`Nickname`))) BXOR 5) BXOR TRUE, NULL) -FROM `Gears` AS `g` +SELECT `g`.`Nickname` +FROM (`Gears` AS `g` +LEFT JOIN `Cities` AS `c` ON `g`.`AssignedCityName` = `c`.`Name`) +INNER JOIN `Cities` AS `c0` ON `g`.`CityOfBirthName` = `c0`.`Name` +WHERE IIF(`c`.`Name` IS NOT NULL, `c`.`Name`, `c0`.`Name`) <> 'Ephyra' """); } - public override async Task Select_null_propagation_negative2(bool async) + public override async Task Conditional_Navigation_With_Member_Access_On_Same_Type(bool async) { - await base.Select_null_propagation_negative2(async); + await base.Conditional_Navigation_With_Member_Access_On_Same_Type(async); AssertSql( """ -SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, `s`.`LeaderNickname`, NULL) -FROM `Gears` AS `g`, -( - SELECT `g0`.`LeaderNickname` - FROM `Gears` AS `g0` -) AS `s` +SELECT `g`.`Nickname`, `g`.`FullName` +FROM (`Gears` AS `g` +LEFT JOIN `Cities` AS `c` ON `g`.`AssignedCityName` = `c`.`Name`) +INNER JOIN `Cities` AS `c0` ON `g`.`CityOfBirthName` = `c0`.`Name` +WHERE IIF(`c`.`Name` IS NOT NULL, `c`.`Nation`, `c0`.`Nation`) = 'Tyrus' """); } - public override async Task Select_null_propagation_negative3(bool async) + public override async Task Conditional_Navigation_With_Member_Access_On_Related_Types(bool async) { - await base.Select_null_propagation_negative3(async); + await base.Conditional_Navigation_With_Member_Access_On_Related_Types(async); AssertSql( -""" -SELECT [t].[Nickname], CASE - WHEN ([t].[Nickname] IS NOT NULL) AND ([t].[SquadId] IS NOT NULL) THEN CASE - WHEN [t].[LeaderNickname] IS NOT NULL THEN CAST(1 AS bit) - ELSE CAST(0 AS bit) - END - ELSE NULL -END AS [Condition] -FROM [Gears] AS [g] + """ +SELECT `f`.`Name` +FROM ((`Factions` AS `f` +INNER JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id`) LEFT JOIN ( - SELECT [g0].[Nickname], [g0].[SquadId], [g0].[LeaderNickname] - FROM [Gears] AS [g0] -) AS [t] ON [g].[HasSoulPatch] = CAST(1 AS bit) -ORDER BY [t].[Nickname] -"""); - } - - public override async Task Select_null_propagation_negative4(bool async) - { - await base.Select_null_propagation_negative4(async); - - AssertSql( -""" -SELECT CASE - WHEN ([t].[Nickname] IS NOT NULL) AND ([t].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) - ELSE CAST(0 AS bit) -END, [t].[Nickname] -FROM [Gears] AS [g] + SELECT `l0`.`Name`, `l0`.`ThreatLevel` + FROM `LocustLeaders` AS `l0` +) AS `s` ON `l`.`DeputyCommanderName` = `s`.`Name`) LEFT JOIN ( - SELECT [g0].[Nickname], [g0].[SquadId] - FROM [Gears] AS [g0] -) AS [t] ON [g].[HasSoulPatch] = CAST(1 AS bit) -ORDER BY [t].[Nickname] -"""); - } - - public override async Task Select_null_propagation_negative5(bool async) - { - await base.Select_null_propagation_negative5(async); - - AssertSql( -""" -SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, IIF(IIF(LEN(`g`.`LeaderNickname`) IS NULL, NULL, CLNG(LEN(`g`.`LeaderNickname`))) <> IIF(LEN(`g`.`LeaderNickname`) IS NULL, NULL, CLNG(LEN(`g`.`LeaderNickname`))), TRUE, FALSE), NULL) -FROM `Gears` AS `g` + SELECT `l1`.`Name`, `l1`.`ThreatLevel` + FROM `LocustLeaders` AS `l1` + INNER JOIN `LocustCommanders` AS `l2` ON `l1`.`Name` = `l2`.`Name` +) AS `s0` ON `l`.`CommanderName` = `s0`.`Name` +WHERE IIF(`s`.`Name` IS NOT NULL, `s`.`ThreatLevel`, `s0`.`ThreatLevel`) = 4 """); } - public override async Task Select_null_propagation_negative6(bool async) + public override async Task Select_Singleton_Navigation_With_Member_Access(bool async) { - await base.Select_null_propagation_negative6(async); + await base.Select_Singleton_Navigation_With_Member_Access(async); AssertSql( """ -SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, FALSE, NULL) -FROM `Gears` AS `g` +SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` + 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` +WHERE `s`.`Nickname` = 'Marcus' AND (`s`.`CityOfBirthName` <> 'Ephyra' OR `s`.`CityOfBirthName` IS NULL) """); } - public override async Task Select_null_propagation_negative7(bool async) + public override async Task Select_Where_Navigation(bool async) { - await base.Select_null_propagation_negative7(async); + await base.Select_Where_Navigation(async); AssertSql( -""" -SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, TRUE, NULL) -FROM `Gears` AS `g` + """ +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` +) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` +WHERE `s`.`Nickname` = 'Marcus' """); } - public override async Task Select_null_propagation_negative8(bool async) + public override async Task Select_Where_Navigation_Equals_Navigation(bool async) { - await base.Select_null_propagation_negative8(async); + await base.Select_Where_Navigation_Equals_Navigation(async); AssertSql( """ -SELECT IIF(`s0`.`Id` IS NOT NULL, `c`.`Name`, NULL) -FROM ((`Tags` AS `t` +SELECT `s`.`Id`, `s`.`GearNickName`, `s`.`GearSquadId`, `s`.`IssueDate`, `s`.`Note`, `s`.`Id0`, `s`.`GearNickName0`, `s`.`GearSquadId0`, `s`.`IssueDate0`, `s`.`Note0` +FROM (( + SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note`, `t0`.`Id` AS `Id0`, `t0`.`GearNickName` AS `GearNickName0`, `t0`.`GearSquadId` AS `GearSquadId0`, `t0`.`IssueDate` AS `IssueDate0`, `t0`.`Note` AS `Note0` + FROM `Tags` AS `t`, + `Tags` AS `t0` +) AS `s` LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName` + SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` -) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId`) -LEFT JOIN `Squads` AS `s0` ON `s`.`SquadId` = `s0`.`Id`) -LEFT JOIN `Cities` AS `c` ON `s`.`AssignedCityName` = `c`.`Name` +) AS `s0` ON `s`.`GearNickName` = `s0`.`Nickname` AND `s`.`GearSquadId` = `s0`.`SquadId`) +LEFT JOIN ( + SELECT `g0`.`Nickname`, `g0`.`SquadId` + FROM `Gears` AS `g0` +) AS `s1` ON `s`.`GearNickName0` = `s1`.`Nickname` AND `s`.`GearSquadId0` = `s1`.`SquadId` +WHERE (`s0`.`Nickname` = `s1`.`Nickname` OR (`s0`.`Nickname` IS NULL AND `s1`.`Nickname` IS NULL)) AND (`s0`.`SquadId` = `s1`.`SquadId` OR (`s0`.`SquadId` IS NULL AND `s1`.`SquadId` IS NULL)) """); } - public override async Task Select_null_propagation_negative9(bool async) + public override async Task Select_Where_Navigation_Null(bool async) { - await base.Select_null_propagation_negative9(async); + await base.Select_Where_Navigation_Null(async); AssertSql( """ -SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, CBOOL(IIF(LEN(`g`.`Nickname`) IS NULL, NULL, CLNG(LEN(`g`.`Nickname`))) BXOR 5) BXOR TRUE, NULL) -FROM `Gears` AS `g` +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` +) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` +WHERE `s`.`Nickname` IS NULL OR `s`.`SquadId` IS NULL """); } - public override async Task Select_null_propagation_works_for_navigations_with_composite_keys(bool async) + public override async Task Select_Where_Navigation_Null_Reverse(bool async) { - await base.Select_null_propagation_works_for_navigations_with_composite_keys(async); + await base.Select_Where_Navigation_Null_Reverse(async); AssertSql( """ -SELECT `s`.`Nickname` +SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` FROM `Tags` AS `t` LEFT JOIN ( SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` ) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` +WHERE `s`.`Nickname` IS NULL OR `s`.`SquadId` IS NULL """); } - public override async Task Select_null_propagation_works_for_multiple_navigations_with_composite_keys(bool async) + public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scalar_Projected(bool async) { - await base.Select_null_propagation_works_for_multiple_navigations_with_composite_keys(async); + await base.Select_Where_Navigation_Scalar_Equals_Navigation_Scalar_Projected(async); AssertSql( """ -SELECT IIF(`c`.`Name` IS NOT NULL, `c`.`Name`, NULL) -FROM (((`Tags` AS `t` +SELECT `s`.`Id` AS `Id1`, `s`.`Id0` AS `Id2` +FROM (( + SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t0`.`Id` AS `Id0`, `t0`.`GearNickName` AS `GearNickName0`, `t0`.`GearSquadId` AS `GearSquadId0` + FROM `Tags` AS `t`, + `Tags` AS `t0` +) AS `s` LEFT JOIN ( SELECT `g`.`Nickname`, `g`.`SquadId` FROM `Gears` AS `g` -) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId`) -LEFT JOIN `Tags` AS `t0` ON (`s`.`Nickname` = `t0`.`GearNickName` OR (`s`.`Nickname` IS NULL AND `t0`.`GearNickName` IS NULL)) AND (`s`.`SquadId` = `t0`.`GearSquadId` OR (`s`.`SquadId` IS NULL AND `t0`.`GearSquadId` IS NULL))) +) AS `s0` ON `s`.`GearNickName` = `s0`.`Nickname` AND `s`.`GearSquadId` = `s0`.`SquadId`) LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName` + SELECT `g0`.`Nickname`, `g0`.`SquadId` FROM `Gears` AS `g0` -) AS `s0` ON `t0`.`GearNickName` = `s0`.`Nickname` AND `t0`.`GearSquadId` = `s0`.`SquadId`) -LEFT JOIN `Cities` AS `c` ON `s0`.`AssignedCityName` = `c`.`Name` -"""); - } - - public override async Task Select_conditional_with_anonymous_type_and_null_constant(bool async) - { - await base.Select_conditional_with_anonymous_type_and_null_constant(async); - - AssertSql( - """ -SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, TRUE, FALSE), `g`.`HasSoulPatch` -FROM `Gears` AS `g` -ORDER BY `g`.`Nickname` +) AS `s1` ON `s`.`GearNickName0` = `s1`.`Nickname` AND `s`.`GearSquadId0` = `s1`.`SquadId` +WHERE `s0`.`Nickname` = `s1`.`Nickname` OR (`s0`.`Nickname` IS NULL AND `s1`.`Nickname` IS NULL) """); } - public override async Task Select_conditional_with_anonymous_types(bool async) + public override async Task Optional_Navigation_Null_Coalesce_To_Clr_Type(bool async) { - await base.Select_conditional_with_anonymous_types(async); + await base.Optional_Navigation_Null_Coalesce_To_Clr_Type(async); AssertSql( - """ -SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, TRUE, FALSE), `g`.`Nickname`, `g`.`FullName` -FROM `Gears` AS `g` -ORDER BY `g`.`Nickname` +""" +SELECT TOP 1 IIF(`w0`.`IsAutomatic` IS NULL, FALSE, `w0`.`IsAutomatic`) AS `IsAutomatic` +FROM `Weapons` AS `w` +LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +ORDER BY `w`.`Id` """); } - public override async Task Where_conditional_equality_1(bool async) + public override async Task Where_subquery_boolean(bool async) { - await base.Where_conditional_equality_1(async); + await base.Where_subquery_boolean(async); AssertSql( """ -SELECT `g`.`Nickname` +SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` -WHERE `g`.`LeaderNickname` IS NULL -ORDER BY `g`.`Nickname` +LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` +WHERE IIF(( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `g`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`) IS NULL, FALSE, ( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `g`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`)) = TRUE """); } - public override async Task Where_conditional_equality_2(bool async) + public override async Task Where_subquery_boolean_with_pushdown(bool async) { - await base.Where_conditional_equality_2(async); + await base.Where_subquery_boolean_with_pushdown(async); AssertSql( -""" -SELECT `g`.`Nickname` + """ +SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` -WHERE `g`.`LeaderNickname` IS NULL -ORDER BY `g`.`Nickname` +LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` +WHERE ( + SELECT TOP 1 `w`.`IsAutomatic` + FROM `Weapons` AS `w` + WHERE `g`.`FullName` = `w`.`OwnerFullName` + ORDER BY `w`.`Id`) = TRUE """); } - public override async Task Where_conditional_equality_3(bool async) + public override async Task Where_subquery_distinct_firstordefault_boolean(bool async) { - await base.Where_conditional_equality_3(async); - - AssertSql( - """ -SELECT `g`.`Nickname` -FROM `Gears` AS `g` -ORDER BY `g`.`Nickname` -"""); - } - - public override async Task Select_coalesce_with_anonymous_types(bool async) - { - await base.Select_coalesce_with_anonymous_types(async); - - AssertSql( -""" -SELECT `g`.`LeaderNickname`, `g`.`FullName` -FROM `Gears` AS `g` -ORDER BY `g`.`Nickname` -"""); - } - - public override async Task Where_compare_anonymous_types(bool async) - { - await base.Where_compare_anonymous_types(async); - - AssertSql(); - } - - public override async Task Where_member_access_on_anonymous_type(bool async) - { - await base.Where_member_access_on_anonymous_type(async); - - AssertSql( -""" -SELECT `g`.`Nickname` -FROM `Gears` AS `g` -WHERE `g`.`LeaderNickname` = 'Marcus' -"""); - } - - public override async Task Where_compare_anonymous_types_with_uncorrelated_members(bool async) - { - await base.Where_compare_anonymous_types_with_uncorrelated_members(async); - - AssertSql( - """ -SELECT `g`.`Nickname` -FROM `Gears` AS `g` -WHERE 0 = 1 -"""); - } - - public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scalar(bool async) - { - await base.Select_Where_Navigation_Scalar_Equals_Navigation_Scalar(async); - - AssertSql( - """ -SELECT `s`.`Id`, `s`.`GearNickName`, `s`.`GearSquadId`, `s`.`IssueDate`, `s`.`Note`, `s`.`Id0`, `s`.`GearNickName0`, `s`.`GearSquadId0`, `s`.`IssueDate0`, `s`.`Note0` -FROM (( - SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note`, `t0`.`Id` AS `Id0`, `t0`.`GearNickName` AS `GearNickName0`, `t0`.`GearSquadId` AS `GearSquadId0`, `t0`.`IssueDate` AS `IssueDate0`, `t0`.`Note` AS `Note0` - FROM `Tags` AS `t`, - `Tags` AS `t0` -) AS `s` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` -) AS `s0` ON `s`.`GearNickName` = `s0`.`Nickname` AND `s`.`GearSquadId` = `s0`.`SquadId`) -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId` - FROM `Gears` AS `g0` -) AS `s1` ON `s`.`GearNickName0` = `s1`.`Nickname` AND `s`.`GearSquadId0` = `s1`.`SquadId` -WHERE `s0`.`Nickname` = `s1`.`Nickname` OR (`s0`.`Nickname` IS NULL AND `s1`.`Nickname` IS NULL) -"""); - } - - public override async Task Select_Singleton_Navigation_With_Member_Access(bool async) - { - await base.Select_Singleton_Navigation_With_Member_Access(async); - - AssertSql( - """ -SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` - 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` -WHERE `s`.`Nickname` = 'Marcus' AND (`s`.`CityOfBirthName` <> 'Ephyra' OR `s`.`CityOfBirthName` IS NULL) -"""); - } - - public override async Task Select_Where_Navigation(bool async) - { - await base.Select_Where_Navigation(async); - - AssertSql( - """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` -) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` -WHERE `s`.`Nickname` = 'Marcus' -"""); - } - - public override async Task Select_Where_Navigation_Equals_Navigation(bool async) - { - await base.Select_Where_Navigation_Equals_Navigation(async); - - AssertSql( - """ -SELECT `s`.`Id`, `s`.`GearNickName`, `s`.`GearSquadId`, `s`.`IssueDate`, `s`.`Note`, `s`.`Id0`, `s`.`GearNickName0`, `s`.`GearSquadId0`, `s`.`IssueDate0`, `s`.`Note0` -FROM (( - SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note`, `t0`.`Id` AS `Id0`, `t0`.`GearNickName` AS `GearNickName0`, `t0`.`GearSquadId` AS `GearSquadId0`, `t0`.`IssueDate` AS `IssueDate0`, `t0`.`Note` AS `Note0` - FROM `Tags` AS `t`, - `Tags` AS `t0` -) AS `s` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` -) AS `s0` ON `s`.`GearNickName` = `s0`.`Nickname` AND `s`.`GearSquadId` = `s0`.`SquadId`) -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId` - FROM `Gears` AS `g0` -) AS `s1` ON `s`.`GearNickName0` = `s1`.`Nickname` AND `s`.`GearSquadId0` = `s1`.`SquadId` -WHERE (`s0`.`Nickname` = `s1`.`Nickname` OR (`s0`.`Nickname` IS NULL AND `s1`.`Nickname` IS NULL)) AND (`s0`.`SquadId` = `s1`.`SquadId` OR (`s0`.`SquadId` IS NULL AND `s1`.`SquadId` IS NULL)) -"""); - } - - public override async Task Select_Where_Navigation_Null(bool async) - { - await base.Select_Where_Navigation_Null(async); - - AssertSql( - """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` -) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` -WHERE `s`.`Nickname` IS NULL OR `s`.`SquadId` IS NULL -"""); - } - - public override async Task Select_Where_Navigation_Null_Reverse(bool async) - { - await base.Select_Where_Navigation_Null_Reverse(async); - - AssertSql( - """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` -) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` -WHERE `s`.`Nickname` IS NULL OR `s`.`SquadId` IS NULL -"""); - } - - public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scalar_Projected(bool async) - { - await base.Select_Where_Navigation_Scalar_Equals_Navigation_Scalar_Projected(async); - - AssertSql( - """ -SELECT `s`.`Id` AS `Id1`, `s`.`Id0` AS `Id2` -FROM (( - SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t0`.`Id` AS `Id0`, `t0`.`GearNickName` AS `GearNickName0`, `t0`.`GearSquadId` AS `GearSquadId0` - FROM `Tags` AS `t`, - `Tags` AS `t0` -) AS `s` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` -) AS `s0` ON `s`.`GearNickName` = `s0`.`Nickname` AND `s`.`GearSquadId` = `s0`.`SquadId`) -LEFT JOIN ( - SELECT `g0`.`Nickname`, `g0`.`SquadId` - FROM `Gears` AS `g0` -) AS `s1` ON `s`.`GearNickName0` = `s1`.`Nickname` AND `s`.`GearSquadId0` = `s1`.`SquadId` -WHERE `s0`.`Nickname` = `s1`.`Nickname` OR (`s0`.`Nickname` IS NULL AND `s1`.`Nickname` IS NULL) -"""); - } - - public override async Task Optional_Navigation_Null_Coalesce_To_Clr_Type(bool async) - { - await base.Optional_Navigation_Null_Coalesce_To_Clr_Type(async); - - AssertSql( -""" -SELECT TOP 1 IIF(`w0`.`IsAutomatic` IS NULL, FALSE, `w0`.`IsAutomatic`) AS `IsAutomatic` -FROM `Weapons` AS `w` -LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -ORDER BY `w`.`Id` -"""); - } - - public override async Task Where_subquery_boolean(bool async) - { - await base.Where_subquery_boolean(async); - - AssertSql( -""" -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` -FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE IIF(( - SELECT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`) IS NULL, FALSE, ( - SELECT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`)) = TRUE -"""); - } - - public override async Task Where_subquery_boolean_with_pushdown(bool async) - { - await base.Where_subquery_boolean_with_pushdown(async); - - AssertSql( - """ -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` -FROM `Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE ( - SELECT TOP 1 `w`.`IsAutomatic` - FROM `Weapons` AS `w` - WHERE `g`.`FullName` = `w`.`OwnerFullName` - ORDER BY `w`.`Id`) = TRUE -"""); - } - - public override async Task Where_subquery_distinct_firstordefault_boolean(bool async) - { - await base.Where_subquery_distinct_firstordefault_boolean(async); + await base.Where_subquery_distinct_firstordefault_boolean(async); AssertSql( """ @@ -1683,10 +1343,10 @@ public override async Task Where_subquery_distinct_singleordefault_boolean2(bool FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` WHERE `g`.`HasSoulPatch` = TRUE AND IIF(( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` + SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%')) IS NULL, FALSE, ( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` + SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%'))) = TRUE ORDER BY `g`.`Nickname` @@ -2223,12 +1883,12 @@ public override async Task Non_unicode_parameter_is_used_for_non_unicode_column( await base.Non_unicode_parameter_is_used_for_non_unicode_column(async); AssertSql( -""" -@__value_0='Unknown' (Size = 100) + """ +@value='Unknown' (Size = 100) SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` FROM `Cities` AS `c` -WHERE `c`.`Location` = @__value_0 +WHERE `c`.`Location` = @value """); } @@ -2928,246 +2588,17 @@ LEFT JOIN [Weapons] AS [w] ON [w].[SynergyWithId] IS NOT NULL """); } - public override async Task Where_datetimeoffset_now(bool async) + public override async Task Orderby_added_for_client_side_GroupJoin_composite_dependent_to_principal_LOJ_when_incomplete_key_is_used( + bool async) { - await base.Where_datetimeoffset_now(async); + await base.Orderby_added_for_client_side_GroupJoin_composite_dependent_to_principal_LOJ_when_incomplete_key_is_used(async); - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE `m`.`Timeline` <> NOW() -"""); + AssertSql(); } - public override async Task Where_datetimeoffset_utcnow(bool async) + public override async Task Complex_predicate_with_AndAlso_and_nullable_bool_property(bool async) { - var dtoffset = -1 * TimeZoneInfo.Local.BaseUtcOffset.TotalMinutes; - await base.Where_datetimeoffset_utcnow(async); - - AssertSql( - $""" -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE `m`.`Timeline` <> DATEADD('n', {dtoffset}.0, NOW()) -"""); - } - - public override async Task Where_datetimeoffset_date_component(bool async) - { - //We have to specifically use 1 JAn 100 as that is the minimum in Jet. - //The default 0 in DateTimeOffset is normally mapped to the OLE Automation date 30 Dec 1899 - //Investigate if we can pick the scenario up automatically and have a new DateTimeOffset().Date go to the required value if we have a comparison - //await base.Where_datetimeoffset_date_component(async); - await AssertQuery( - async, - ss => from m in ss.Set() - where m.Timeline.Date > new DateTimeOffset(100, 1, 1, 0, 0, 0, new TimeSpan()).Date - select m); - - AssertSql( - """ -@__Date_0='0100-01-01T00:00:00.0000000' (DbType = DateTime) - -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEVALUE(`m`.`Timeline`) > CDATE(@__Date_0) -"""); - } - - public override async Task Where_datetimeoffset_year_component(bool async) - { - await AssertQuery( - async, - ss => from m in ss.Set() - where m.Timeline.Year == 102 - select m); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('yyyy', `m`.`Timeline`) = 102 -"""); - } - - public override async Task Where_datetimeoffset_month_component(bool async) - { - await base.Where_datetimeoffset_month_component(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('m', `m`.`Timeline`) = 1 -"""); - } - - public override async Task Where_datetimeoffset_dayofyear_component(bool async) - { - await base.Where_datetimeoffset_dayofyear_component(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('y', `m`.`Timeline`) = 2 -"""); - } - - public override async Task Where_datetimeoffset_day_component(bool async) - { - await base.Where_datetimeoffset_day_component(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('d', `m`.`Timeline`) = 2 -"""); - } - - public override async Task Where_datetimeoffset_hour_component(bool async) - { - await AssertQuery( - async, - ss => from m in ss.Set() - where m.Timeline.Hour == 8 - select m); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('h', `m`.`Timeline`) = 8 -"""); - } - - public override async Task Where_datetimeoffset_minute_component(bool async) - { - await base.Where_datetimeoffset_minute_component(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('n', `m`.`Timeline`) = 0 -"""); - } - - public override async Task Where_datetimeoffset_second_component(bool async) - { - await base.Where_datetimeoffset_second_component(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('s', `m`.`Timeline`) = 0 -"""); - } - - public override async Task Where_datetimeoffset_millisecond_component(bool async) - { - await base.Where_datetimeoffset_millisecond_component(async); - - AssertSql( -""" -SELECT [m].[Id], [m].[CodeName], [m].[Duration], [m].[Rating], [m].[Timeline] -FROM [Missions] AS [m] -WHERE DATEPART(millisecond, [m].[Timeline]) = 0 -"""); - } - - public override async Task DateTimeOffset_DateAdd_AddMonths(bool async) - { - await base.DateTimeOffset_DateAdd_AddMonths(async); - - AssertSql( - """ -SELECT DATEADD('m', 1, `m`.`Timeline`) -FROM `Missions` AS `m` -"""); - } - - public override async Task DateTimeOffset_DateAdd_AddDays(bool async) - { - await base.DateTimeOffset_DateAdd_AddDays(async); - - AssertSql( - """ -SELECT DATEADD('d', 1.0, `m`.`Timeline`) -FROM `Missions` AS `m` -"""); - } - - public override async Task DateTimeOffset_DateAdd_AddHours(bool async) - { - await base.DateTimeOffset_DateAdd_AddHours(async); - - AssertSql( - """ -SELECT DATEADD('h', 1.0, `m`.`Timeline`) -FROM `Missions` AS `m` -"""); - } - - public override async Task DateTimeOffset_DateAdd_AddMinutes(bool async) - { - await base.DateTimeOffset_DateAdd_AddMinutes(async); - - AssertSql( - """ -SELECT DATEADD('n', 1.0, `m`.`Timeline`) -FROM `Missions` AS `m` -"""); - } - - public override async Task DateTimeOffset_DateAdd_AddSeconds(bool async) - { - await base.DateTimeOffset_DateAdd_AddSeconds(async); - - AssertSql( - """ -SELECT DATEADD('s', 1.0, `m`.`Timeline`) -FROM `Missions` AS `m` -"""); - } - - public override async Task DateTimeOffset_DateAdd_AddMilliseconds(bool async) - { - await base.DateTimeOffset_DateAdd_AddMilliseconds(async); - - AssertSql( -""" -SELECT DATEADD(millisecond, CAST(300.0E0 AS int), [m].[Timeline]) -FROM [Missions] AS [m] -"""); - } - - public override async Task Where_datetimeoffset_milliseconds_parameter_and_constant(bool async) - { - await base.Where_datetimeoffset_milliseconds_parameter_and_constant(async); - - AssertSql( - """ -SELECT COUNT(*) -FROM `Missions` AS `m` -WHERE `m`.`Timeline` = #1902-01-02 10:00:00# -"""); - } - - public override async Task Orderby_added_for_client_side_GroupJoin_composite_dependent_to_principal_LOJ_when_incomplete_key_is_used( - bool async) - { - await base.Orderby_added_for_client_side_GroupJoin_composite_dependent_to_principal_LOJ_when_incomplete_key_is_used(async); - - AssertSql(); - } - - public override async Task Complex_predicate_with_AndAlso_and_nullable_bool_property(bool async) - { - await base.Complex_predicate_with_AndAlso_and_nullable_bool_property(async); + await base.Complex_predicate_with_AndAlso_and_nullable_bool_property(async); AssertSql( """ @@ -3275,7 +2706,7 @@ public override async Task Contains_with_local_nullable_guid_list_closure(bool a """ SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` FROM `Tags` AS `t` -WHERE `t`.`Id` IN ('{df36f493-463f-4123-83f9-6b135deeb7ba}', '{23cbcf9b-ce14-45cf-aafa-2c2667ebfdd3}', '{ab1b82d7-88db-42bd-a132-7eef9aa68af4}') +WHERE `t`.`Id` IN ({df36f493-463f-4123-83f9-6b135deeb7ba}, {23cbcf9b-ce14-45cf-aafa-2c2667ebfdd3}, {ab1b82d7-88db-42bd-a132-7eef9aa68af4}) """); } @@ -3448,7 +2879,7 @@ public override async Task Subquery_with_result_operator_is_not_lifted(bool asyn """ SELECT `s`.`FullName` FROM ( - SELECT TOP 2 `g`.`FullName`, `g`.`Rank` + SELECT TOP @p `g`.`FullName`, `g`.`Rank` FROM `Gears` AS `g` WHERE `g`.`HasSoulPatch` = FALSE ORDER BY `g`.`FullName` @@ -3519,7 +2950,7 @@ public override async Task Take_without_orderby_followed_by_orderBy_is_pushed_do """ SELECT `s`.`FullName` FROM ( - SELECT TOP 999 `g`.`FullName`, `g`.`Rank` + SELECT TOP @p `g`.`FullName`, `g`.`Rank` FROM `Gears` AS `g` WHERE `g`.`HasSoulPatch` = FALSE ) AS `s` @@ -3564,8 +2995,8 @@ public override async Task Member_access_on_derived_materialized_entity_using_ca await base.Member_access_on_derived_materialized_entity_using_cast(async); AssertSql( -""" -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` + """ +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` WHERE `l`.`Id` IS NOT NULL @@ -3626,7 +3057,7 @@ public override async Task Navigation_access_on_derived_materialized_entity_usin AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator`, `s`.`ThreatLevel` AS `Threat` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator`, `s`.`ThreatLevel` AS `Threat` FROM (`Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id`) LEFT JOIN ( @@ -3716,7 +3147,7 @@ public override async Task Include_on_derived_entity_using_OfType(bool async) await base.Include_on_derived_entity_using_OfType(async); AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator`, `s`.`Name`, `s`.`LocustHordeId`, `s`.`ThreatLevel`, `s`.`ThreatLevelByte`, `s`.`ThreatLevelNullableByte`, `s`.`DefeatedByNickname`, `s`.`DefeatedBySquadId`, `s`.`HighCommandId`, `s0`.`Name`, `s0`.`LocustHordeId`, `s0`.`ThreatLevel`, `s0`.`ThreatLevelByte`, `s0`.`ThreatLevelNullableByte`, `s0`.`DefeatedByNickname`, `s0`.`DefeatedBySquadId`, `s0`.`HighCommandId`, `s0`.`Discriminator` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator`, `s`.`Name`, `s`.`LocustHordeId`, `s`.`ThreatLevel`, `s`.`ThreatLevelByte`, `s`.`ThreatLevelNullableByte`, `s`.`DefeatedByNickname`, `s`.`DefeatedBySquadId`, `s`.`HighCommandId`, `s0`.`Name`, `s0`.`LocustHordeId`, `s0`.`ThreatLevel`, `s0`.`ThreatLevelByte`, `s0`.`ThreatLevelNullableByte`, `s0`.`DefeatedByNickname`, `s0`.`DefeatedBySquadId`, `s0`.`HighCommandId`, `s0`.`Discriminator` FROM ((`Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id`) LEFT JOIN ( @@ -4170,7 +3601,7 @@ public override async Task ThenInclude_collection_on_derived_after_derived_refer AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator`, `s`.`Name`, `s`.`LocustHordeId`, `s`.`ThreatLevel`, `s`.`ThreatLevelByte`, `s`.`ThreatLevelNullableByte`, `s`.`DefeatedByNickname`, `s`.`DefeatedBySquadId`, `s`.`HighCommandId`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`AssignedCityName`, `s0`.`CityOfBirthName`, `s0`.`FullName`, `s0`.`HasSoulPatch`, `s0`.`LeaderNickname`, `s0`.`LeaderSquadId`, `s0`.`Rank`, `s0`.`Discriminator`, `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`AssignedCityName`, `s1`.`CityOfBirthName`, `s1`.`FullName`, `s1`.`HasSoulPatch`, `s1`.`LeaderNickname`, `s1`.`LeaderSquadId`, `s1`.`Rank`, `s1`.`Discriminator` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator`, `s`.`Name`, `s`.`LocustHordeId`, `s`.`ThreatLevel`, `s`.`ThreatLevelByte`, `s`.`ThreatLevelNullableByte`, `s`.`DefeatedByNickname`, `s`.`DefeatedBySquadId`, `s`.`HighCommandId`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`AssignedCityName`, `s0`.`CityOfBirthName`, `s0`.`FullName`, `s0`.`HasSoulPatch`, `s0`.`LeaderNickname`, `s0`.`LeaderSquadId`, `s0`.`Rank`, `s0`.`Discriminator`, `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 ( @@ -4221,7 +3652,7 @@ public override async Task ThenInclude_reference_on_derived_after_derived_collec AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator`, `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` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator`, `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` FROM (`Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id`) LEFT JOIN ( @@ -4243,8 +3674,8 @@ public override async Task Multiple_derived_included_on_one_method(bool async) await base.Multiple_derived_included_on_one_method(async); AssertSql( - """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator`, `s`.`Name`, `s`.`LocustHordeId`, `s`.`ThreatLevel`, `s`.`ThreatLevelByte`, `s`.`ThreatLevelNullableByte`, `s`.`DefeatedByNickname`, `s`.`DefeatedBySquadId`, `s`.`HighCommandId`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`AssignedCityName`, `s0`.`CityOfBirthName`, `s0`.`FullName`, `s0`.`HasSoulPatch`, `s0`.`LeaderNickname`, `s0`.`LeaderSquadId`, `s0`.`Rank`, `s0`.`Discriminator`, `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`AssignedCityName`, `s1`.`CityOfBirthName`, `s1`.`FullName`, `s1`.`HasSoulPatch`, `s1`.`LeaderNickname`, `s1`.`LeaderSquadId`, `s1`.`Rank`, `s1`.`Discriminator` + """ +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator`, `s`.`Name`, `s`.`LocustHordeId`, `s`.`ThreatLevel`, `s`.`ThreatLevelByte`, `s`.`ThreatLevelNullableByte`, `s`.`DefeatedByNickname`, `s`.`DefeatedBySquadId`, `s`.`HighCommandId`, `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`AssignedCityName`, `s0`.`CityOfBirthName`, `s0`.`FullName`, `s0`.`HasSoulPatch`, `s0`.`LeaderNickname`, `s0`.`LeaderSquadId`, `s0`.`Rank`, `s0`.`Discriminator`, `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 ( @@ -5113,6 +4544,21 @@ LEFT JOIN ( """); } + public override async Task Correlated_collections_on_RightJoin_with_predicate(bool async) + { + await base.Correlated_collections_on_RightJoin_with_predicate(async); + + AssertSql( + """ +SELECT [g].[Nickname], [g].[SquadId], [t].[Id], [w].[Name], [w].[Id] +FROM [Gears] AS [g] +RIGHT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] +LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] +WHERE [g].[HasSoulPatch] = CAST(0 AS bit) +ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id] +"""); + } + public override async Task Correlated_collections_on_left_join_with_null_value(bool async) { await base.Correlated_collections_on_left_join_with_null_value(async); @@ -5385,10 +4831,10 @@ public override async Task Null_semantics_on_nullable_bool_from_inner_join_subqu AssertSql( """ -SELECT `s`.`Id`, `s`.`CapitalName`, `s`.`Name`, `s`.`ServerAddress`, `s`.`CommanderName`, `s`.`Eradicated`, `s`.`Discriminator` +SELECT `s`.`Id`, `s`.`CapitalName`, `s`.`Name`, `s`.`ServerAddress`, `s`.`CommanderName`, `s`.`DeputyCommanderName`, `s`.`Eradicated`, `s`.`Discriminator` FROM `LocustLeaders` AS `l` INNER JOIN ( - SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l0`.`CommanderName`, `l0`.`Eradicated`, IIF(`l0`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` + SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l0`.`CommanderName`, `l0`.`DeputyCommanderName`, `l0`.`Eradicated`, IIF(`l0`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l0` ON `f`.`Id` = `l0`.`Id` WHERE `l0`.`Id` IS NOT NULL AND `f`.`Name` = 'Swarm' @@ -5403,10 +4849,10 @@ public override async Task Null_semantics_on_nullable_bool_from_left_join_subque AssertSql( """ -SELECT `s`.`Id`, `s`.`CapitalName`, `s`.`Name`, `s`.`ServerAddress`, `s`.`CommanderName`, `s`.`Eradicated`, `s`.`Discriminator` +SELECT `s`.`Id`, `s`.`CapitalName`, `s`.`Name`, `s`.`ServerAddress`, `s`.`CommanderName`, `s`.`DeputyCommanderName`, `s`.`Eradicated`, `s`.`Discriminator` FROM `LocustLeaders` AS `l` LEFT JOIN ( - SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l0`.`CommanderName`, `l0`.`Eradicated`, IIF(`l0`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` + SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l0`.`CommanderName`, `l0`.`DeputyCommanderName`, `l0`.`Eradicated`, IIF(`l0`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l0` ON `f`.`Id` = `l0`.`Id` WHERE `l0`.`Id` IS NOT NULL AND `f`.`Name` = 'Swarm' @@ -5420,10 +4866,10 @@ public override async Task Include_on_derived_type_with_order_by_and_paging(bool await base.Include_on_derived_type_with_order_by_and_paging(async); AssertSql( - """ + """ 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` FROM ( - SELECT TOP 10 `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, IIF(`l0`.`Name` IS NOT NULL, 'LocustCommander', NULL) 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` + SELECT TOP @p `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, IIF(`l0`.`Name` IS NOT NULL, 'LocustCommander', NULL) 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` FROM ((`LocustLeaders` AS `l` LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`Name` = `l0`.`Name`) LEFT JOIN ( @@ -6328,10 +5774,10 @@ public override async Task Select_subquery_distinct_singleordefault_boolean2(boo AssertSql( """ SELECT IIF(( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` + SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%')) IS NULL, FALSE, ( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` + SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND (`w`.`Name` LIKE '%Lancer%'))) FROM `Gears` AS `g` @@ -6380,12 +5826,12 @@ public override async Task Select_subquery_distinct_singleordefault_boolean_empt await base.Select_subquery_distinct_singleordefault_boolean_empty2(async); AssertSql( -""" + """ SELECT IIF(( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` + SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND `w`.`Name` = 'BFG') IS NULL, FALSE, ( - SELECT DISTINCT TOP 1 `w`.`IsAutomatic` + SELECT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` WHERE `g`.`FullName` = `w`.`OwnerFullName` AND `w`.`Name` = 'BFG')) FROM `Gears` AS `g` @@ -6589,17 +6035,6 @@ public override async Task String_concat_on_various_types(bool async) """); } - public override async Task Time_of_day_datetimeoffset(bool async) - { - await base.Time_of_day_datetimeoffset(async); - - AssertSql( - """ -SELECT TIMEVALUE(`m`.`Timeline`) -FROM `Missions` AS `m` -"""); - } - public override async Task GroupBy_Property_Include_Select_Average(bool async) { await base.GroupBy_Property_Include_Select_Average(async); @@ -6810,7 +6245,7 @@ public override async Task OrderBy_same_expression_containing_IsNull_correctly_d """ SELECT IIF(`g`.`LeaderNickname` IS NOT NULL, CBOOL(IIF(LEN(`g`.`Nickname`) IS NULL, NULL, CLNG(LEN(`g`.`Nickname`))) BXOR 5) BXOR TRUE, NULL) FROM `Gears` AS `g` -ORDER BY NOT (IIF(IIF(`g`.`LeaderNickname` IS NOT NULL, CBOOL(IIF(LEN(`g`.`Nickname`) IS NULL, NULL, CLNG(LEN(`g`.`Nickname`))) BXOR 5) BXOR TRUE, NULL) IS NOT NULL, TRUE, FALSE)) +ORDER BY NOT (IIF(`g`.`LeaderNickname` IS NOT NULL, TRUE, FALSE)) """); } @@ -6954,40 +6389,6 @@ WHERE IIF(LEN(`s0`.`Name`) IS NULL, NULL, MID(`t`.`Note`, 0 + 1, IIF(LEN(`s0`.`N """); } - public override async Task Filter_with_new_Guid(bool async) - { - await base.Filter_with_new_Guid(async); - - AssertSql( - """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` -FROM `Tags` AS `t` -WHERE `t`.`Id` = '{df36f493-463f-4123-83f9-6b135deeb7ba}' -"""); - } - - public override async Task Filter_with_new_Guid_closure(bool async) - { - await base.Filter_with_new_Guid_closure(async); - - AssertSql( -""" -@__p_0='df36f493-463f-4123-83f9-6b135deeb7bd' - -SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[Note] -FROM [Tags] AS [t] -WHERE [t].[Id] = @__p_0 -""", -// -""" -@__p_0='b39a6fba-9026-4d69-828e-fd7068673e57' - -SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[Note] -FROM [Tags] AS [t] -WHERE [t].[Id] = @__p_0 -"""); - } - public override async Task OfTypeNav1(bool async) { await base.OfTypeNav1(async); @@ -7073,7 +6474,7 @@ public override async Task Nav_rewrite_with_convert2(bool async) AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` FROM ((`Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id`) LEFT JOIN `Cities` AS `c` ON `f`.`CapitalName` = `c`.`Name`) @@ -7092,7 +6493,7 @@ public override async Task Nav_rewrite_with_convert3(bool async) AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` FROM ((`Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id`) LEFT JOIN `Cities` AS `c` ON `f`.`CapitalName` = `c`.`Name`) @@ -7196,13 +6597,13 @@ await AssertQuery( m => start <= m.Timeline.Date && m.Timeline < end && dates.Contains(m.Timeline))); AssertSql( - """ -@__start_0='1902-01-01T08:30:00.0000000Z' (DbType = DateTime) -@__end_1='1902-01-03T08:30:00.0000000Z' (DbType = DateTime) + """ +@start='1902-01-01T08:30:00.0000000Z' (DbType = DateTime) +@end='1902-01-03T08:30:00.0000000Z' (DbType = DateTime) SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` FROM `Missions` AS `m` -WHERE @__start_0 <= DATEVALUE(`m`.`Timeline`) AND `m`.`Timeline` < @__end_1 AND `m`.`Timeline` = CDATE('1902-01-02 08:30:00') +WHERE @start <= DATEVALUE(`m`.`Timeline`) AND `m`.`Timeline` < @end AND `m`.`Timeline` = CDATE('1902-01-02 08:30:00') """); } @@ -7334,14 +6735,14 @@ public override async Task SelectMany_Where_DefaultIfEmpty_with_navigation_in_th AssertSql( """ -@__isAutomatic_0='True' +@isAutomatic='True' SELECT `g`.`Nickname`, `g`.`FullName`, IIF(`w0`.`Id` IS NOT NULL, TRUE, FALSE) AS `Collection` FROM `Gears` AS `g` LEFT JOIN ( SELECT `w`.`Id`, `w`.`OwnerFullName` FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` = @__isAutomatic_0 + WHERE `w`.`IsAutomatic` = @isAutomatic ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` """); } @@ -7384,7 +6785,7 @@ public override async Task Navigation_based_on_complex_expression1(bool async) AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` FROM (`Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id`) LEFT JOIN ( @@ -7402,7 +6803,7 @@ public override async Task Navigation_based_on_complex_expression2(bool async) AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` FROM (`Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id`) LEFT JOIN ( @@ -7632,14 +7033,14 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para AssertSql( """ -@__prm_Inner_Nickname_0='Marcus' (Size = 255) +@prm_Inner_Nickname='Marcus' (Size = 255) SELECT `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator` FROM ( SELECT DISTINCT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` - WHERE `g`.`Nickname` <> @__prm_Inner_Nickname_0 + WHERE `g`.`Nickname` <> @prm_Inner_Nickname ) AS `s` ORDER BY `s`.`FullName` """); @@ -7651,8 +7052,8 @@ public override async Task Query_reusing_parameter_with_inner_query_doesnt_decla AssertSql( """ -@__squadId_0='1' -@__squadId_0='1' +@squadId='1' +@squadId='1' SELECT `u`.`Nickname`, `u`.`SquadId`, `u`.`AssignedCityName`, `u`.`CityOfBirthName`, `u`.`FullName`, `u`.`HasSoulPatch`, `u`.`LeaderNickname`, `u`.`LeaderSquadId`, `u`.`Rank`, `u`.`Discriminator` FROM ( @@ -7663,7 +7064,7 @@ public override async Task Query_reusing_parameter_with_inner_query_doesnt_decla WHERE `s`.`Id` IN ( SELECT `s0`.`Id` FROM `Squads` AS `s0` - WHERE `s0`.`Id` = @__squadId_0 + WHERE `s0`.`Id` = @squadId ) UNION ALL SELECT `g0`.`Nickname`, `g0`.`SquadId`, `g0`.`AssignedCityName`, `g0`.`CityOfBirthName`, `g0`.`FullName`, `g0`.`HasSoulPatch`, `g0`.`LeaderNickname`, `g0`.`LeaderSquadId`, `g0`.`Rank`, IIF(`o0`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` @@ -7673,7 +7074,7 @@ UNION ALL WHERE `s1`.`Id` IN ( SELECT `s2`.`Id` FROM `Squads` AS `s2` - WHERE `s2`.`Id` = @__squadId_0 + WHERE `s2`.`Id` = @squadId ) ) AS `u` ORDER BY `u`.`FullName` @@ -7686,15 +7087,15 @@ public override async Task Query_reusing_parameter_with_inner_query_expression_d AssertSql( """ -@__gearId_0='1' -@__gearId_0='1' +@gearId='1' +@gearId='1' SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` FROM `Squads` AS `s` WHERE EXISTS ( SELECT 1 FROM `Gears` AS `g` - WHERE `s`.`Id` = `g`.`SquadId` AND `g`.`SquadId` = @__gearId_0 AND `g`.`SquadId` = @__gearId_0) + WHERE `s`.`Id` = `g`.`SquadId` AND `g`.`SquadId` = @gearId AND `g`.`SquadId` = @gearId) """); } @@ -7704,8 +7105,8 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para AssertSql( """ -@__entity_equality_prm_Inner_Squad_0_Id='1' (Nullable = true) -@__entity_equality_prm_Inner_Squad_0_Id='1' (Nullable = true) +@entity_equality_prm_Inner_Squad_Id='1' (Nullable = true) +@entity_equality_prm_Inner_Squad_Id='1' (Nullable = true) SELECT `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`AssignedCityName`, `s1`.`CityOfBirthName`, `s1`.`FullName`, `s1`.`HasSoulPatch`, `s1`.`LeaderNickname`, `s1`.`LeaderSquadId`, `s1`.`Rank`, `s1`.`Discriminator` FROM ( @@ -7713,10 +7114,10 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para FROM (`Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) INNER JOIN `Squads` AS `s` ON `g`.`SquadId` = `s`.`Id` - WHERE `s`.`Id` = @__entity_equality_prm_Inner_Squad_0_Id + WHERE `s`.`Id` = @entity_equality_prm_Inner_Squad_Id ) AS `s1` INNER JOIN `Squads` AS `s0` ON `s1`.`SquadId` = `s0`.`Id` -WHERE `s0`.`Id` = @__entity_equality_prm_Inner_Squad_0_Id +WHERE `s0`.`Id` = @entity_equality_prm_Inner_Squad_Id ORDER BY `s1`.`FullName` """); } @@ -7877,9 +7278,9 @@ public override async Task Select_null_parameter_is_not_null(bool async) AssertSql( """ -@__p_0='False' +@p='False' -SELECT CBOOL(@__p_0) +SELECT CBOOL(@p) FROM `Gears` AS `g` """); } @@ -7890,12 +7291,12 @@ public override async Task Where_null_parameter_is_not_null(bool async) AssertSql( """ -@__p_0='False' +@p='False' SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE @__p_0 = TRUE +WHERE @p = TRUE """); } @@ -7929,33 +7330,33 @@ public override async Task Where_with_enum_flags_parameter(bool async) await base.Where_with_enum_flags_parameter(async); AssertSql( -""" -@__rank_0='1' (Nullable = true) -@__rank_0='1' (Nullable = true) + """ +@rank='1' (Nullable = true) +@rank='1' (Nullable = true) SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (`g`.`Rank` BAND @__rank_0) = @__rank_0 +WHERE (`g`.`Rank` BAND @rank) = @rank """, -// -""" + // + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` """, -// -""" -@__rank_0='2' (Nullable = true) -@__rank_0='2' (Nullable = true) + // + """ +@rank='2' (Nullable = true) +@rank='2' (Nullable = true) SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (`g`.`Rank` BOR @__rank_0) <> @__rank_0 +WHERE (`g`.`Rank` BOR @rank) <> @rank """, -// -""" + // + """ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` @@ -7991,28 +7392,28 @@ public override async Task Bitwise_operation_with_non_null_parameter_optimizes_n AssertSql( """ -@__ranks_0='134' +@ranks='134' SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (`g`.`Rank` BAND @__ranks_0) <> 0 +WHERE (`g`.`Rank` BAND @ranks) <> 0 """, // """ -@__ranks_0='134' -@__ranks_0='134' +@ranks='134' +@ranks='134' -SELECT CBOOL((`g`.`Rank` BOR @__ranks_0) BXOR @__ranks_0) BXOR TRUE +SELECT CBOOL((`g`.`Rank` BOR @ranks) BXOR @ranks) BXOR TRUE FROM `Gears` AS `g` """, // """ -@__ranks_0='134' -@__ranks_0='134' -@__ranks_0='134' +@ranks='134' +@ranks='134' +@ranks='134' -SELECT CBOOL((`g`.`Rank` BOR (`g`.`Rank` BOR (@__ranks_0 BOR (`g`.`Rank` BOR @__ranks_0)))) BXOR @__ranks_0) BXOR TRUE +SELECT CBOOL((`g`.`Rank` BOR (`g`.`Rank` BOR (@ranks BOR (`g`.`Rank` BOR @ranks)))) BXOR @ranks) BXOR TRUE FROM `Gears` AS `g` """); } @@ -8022,44 +7423,44 @@ public override async Task Bitwise_operation_with_null_arguments(bool async) await base.Bitwise_operation_with_null_arguments(async); AssertSql( -""" + """ SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` WHERE `w`.`AmmunitionType` IS NULL """, -// -""" + // + """ SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` WHERE `w`.`AmmunitionType` IS NULL """, -// -""" + // + """ SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` WHERE `w`.`AmmunitionType` IS NULL """, -// -""" + // + """ SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` """, -// -""" -@__prm_0='2' (Nullable = true) + // + """ +@prm='2' (Nullable = true) SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND @__prm_0) <> 0 OR `w`.`AmmunitionType` IS NULL +WHERE (`w`.`AmmunitionType` BAND @prm) <> 0 OR `w`.`AmmunitionType` IS NULL """, -// -""" -@__prm_0='1' (Nullable = true) -@__prm_0='1' (Nullable = true) - + // + """ +@prm='1' (Nullable = true) +@prm='1' (Nullable = true) + SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` -WHERE (`w`.`AmmunitionType` BAND @__prm_0) = @__prm_0 +WHERE (`w`.`AmmunitionType` BAND @prm) = @prm """); } @@ -8068,22 +7469,22 @@ public override async Task Logical_operation_with_non_null_parameter_optimizes_n await base.Logical_operation_with_non_null_parameter_optimizes_null_checks(async); AssertSql( -""" -@__prm_0='True' + """ +@prm='True' SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE `g`.`HasSoulPatch` <> @__prm_0 +WHERE `g`.`HasSoulPatch` <> @prm """, -// -""" -@__prm_0='False' + // + """ +@prm='False' SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE `g`.`HasSoulPatch` <> @__prm_0 +WHERE `g`.`HasSoulPatch` <> @prm """); } @@ -8118,70 +7519,6 @@ WHERE IIF(`s`.`Name` = 'Locust', TRUE, NULL) <> TRUE OR IIF(`s`.`Name` = 'Locust """); } - public override async Task Byte_array_contains_literal(bool async) - { - await base.Byte_array_contains_literal(async); - - AssertSql( - """ -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE INSTR(1, STRCONV(`s`.`Banner`, 64), 0x01, 0) > 0 -"""); - } - - public override async Task Byte_array_filter_by_length_literal(bool async) - { - var exception = await Assert.ThrowsAsync(() => base.Byte_array_filter_by_length_literal(async)); - } - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public async Task Byte_array_filter_by_length_literal2(bool async) - { - await AssertQuery( - async, - ss => ss.Set().Where(w => EF.Functions.ByteArrayLength(w.Banner) == 2), - ss => ss.Set().Where(w => w.Banner != null && w.Banner.Length == 2)); - - AssertSql( - """ -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE IIF(ASCB(RIGHTB(`s`.`Banner`, 1)) = 0, LENB(`s`.`Banner`) - 1, LENB(`s`.`Banner`)) = 2 -"""); - } - - public override async Task Byte_array_filter_by_length_parameter(bool async) - { - var exception = await Assert.ThrowsAsync(() => base.Byte_array_filter_by_length_parameter(async)); - } - - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public async Task Byte_array_filter_by_length_parameter2(bool async) - { - var someByteArr = new[] { (byte)42, (byte)24 }; - await AssertQuery( - async, - ss => ss.Set().Where(w => EF.Functions.ByteArrayLength(w.Banner) == someByteArr.Length), - ss => ss.Set().Where(w => w.Banner != null && w.Banner.Length == someByteArr.Length)); - - AssertSql( - """ -@__p_1='2' - -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE IIF(ASCB(RIGHTB(`s`.`Banner`, 1)) = 0, LENB(`s`.`Banner`) - 1, LENB(`s`.`Banner`)) = @__p_1 -"""); - } - - public override void Byte_array_filter_by_length_parameter_compiled() - { - var exception = Assert.Throws(() => base.Byte_array_filter_by_length_parameter_compiled()); - } - [ConditionalFact] public virtual void Byte_array_filter_by_length_parameter_compiled2() { @@ -8196,30 +7533,16 @@ public virtual void Byte_array_filter_by_length_parameter_compiled2() AssertSql( """ -@__byteArrayParam='0x2A80' (Size = 510) -@__byteArrayParam='0x2A80' (Size = 510) -@__byteArrayParam='0x2A80' (Size = 510) -@__byteArrayParam='0x2A80' (Size = 510) -@__byteArrayParam='0x2A80' (Size = 510) -@__byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) +@byteArrayParam='0x2A80' (Size = 510) SELECT COUNT(*) FROM `Squads` AS `s` -WHERE IIF(ASCB(RIGHTB(`s`.`Banner`, 1)) = 0, LENB(`s`.`Banner`) - 1, LENB(`s`.`Banner`)) = IIF(IIF(ASCB(RIGHTB(@__byteArrayParam, 1)) = 0, LENB(@__byteArrayParam) - 1, LENB(@__byteArrayParam)) IS NULL, NULL, CLNG(IIF(ASCB(RIGHTB(@__byteArrayParam, 1)) = 0, LENB(@__byteArrayParam) - 1, LENB(@__byteArrayParam)))) -"""); - } - - public override async Task Byte_array_contains_parameter(bool async) - { - await base.Byte_array_contains_parameter(async); - - AssertSql( - """ -@__someByte_0='1' (Size = 1) - -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE INSTR(1, STRCONV(`s`.`Banner`, 64), CHR(@__someByte_0), 0) > 0 +WHERE IIF(ASCB(RIGHTB(`s`.`Banner`, 1)) = 0, LENB(`s`.`Banner`) - 1, LENB(`s`.`Banner`)) = IIF(IIF(ASCB(RIGHTB(@byteArrayParam, 1)) = 0, LENB(@byteArrayParam) - 1, LENB(@byteArrayParam)) IS NULL, NULL, CLNG(IIF(ASCB(RIGHTB(@byteArrayParam, 1)) = 0, LENB(@byteArrayParam) - 1, LENB(@byteArrayParam)))) """); } @@ -8251,12 +7574,12 @@ public override async Task Conditional_expression_with_test_being_simplified_to_ AssertSql( """ -@__prm_0='True' +@prm='True' SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE IIF(`g`.`HasSoulPatch` = @__prm_0, TRUE, FALSE) = TRUE +WHERE IIF(`g`.`HasSoulPatch` = @prm, TRUE, FALSE) = TRUE """); } @@ -8265,17 +7588,17 @@ public override async Task Conditional_expression_with_test_being_simplified_to_ await base.Conditional_expression_with_test_being_simplified_to_constant_complex(isAsync); AssertSql( -""" -@__prm_0='True' -@__prm2_1='Marcus' Lancer' (Size = 255) + """ +@prm='True' +@prm2='Marcus' Lancer' (Size = 255) SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE IIF(`g`.`HasSoulPatch` = @__prm_0 AND ( +WHERE IIF(`g`.`HasSoulPatch` = @prm AND ( SELECT TOP 1 `w`.`Name` FROM `Weapons` AS `w` - WHERE `w`.`Id` = `g`.`SquadId`) = @__prm2_1, TRUE, FALSE) = TRUE + WHERE `w`.`Id` = `g`.`SquadId`) = @prm2, TRUE, FALSE) = TRUE """); } @@ -8301,12 +7624,12 @@ await AssertQuery( ss => ss.Set().Where(m => m.Timeline.Date >= dateTimeOffset.Date)); AssertSql( - """ -@__dateTimeOffset_Date_0='0102-03-01T00:00:00.0000000' (DbType = DateTime) + """ +@dateTimeOffset_Date='0102-03-01T00:00:00.0000000' (DbType = DateTime) SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` FROM `Missions` AS `m` -WHERE DATEVALUE(`m`.`Timeline`) >= CDATE(@__dateTimeOffset_Date_0) +WHERE DATEVALUE(`m`.`Timeline`) >= CDATE(@dateTimeOffset_Date) """); } @@ -8343,20 +7666,6 @@ SELECT FALSE """); } - public override async Task Byte_array_filter_by_SequenceEqual(bool isAsync) - { - await base.Byte_array_filter_by_SequenceEqual(isAsync); - - AssertSql( -""" -@__byteArrayParam_0='0x0405060708' (Size = 5) - -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE `s`.`Banner5` = @__byteArrayParam_0 -"""); - } - public override async Task Group_by_nullable_property_HasValue_and_project_the_grouping_key(bool async) { await base.Group_by_nullable_property_HasValue_and_project_the_grouping_key(async); @@ -8410,98 +7719,6 @@ WHERE CLNG(`l`.`ThreatLevel`) <= (5 + CLNG(`l`.`ThreatLevel`)) """); } - public override async Task TimeSpan_Hours(bool async) - { - await base.TimeSpan_Hours(async); - - AssertSql( - """ -SELECT DATEPART('h', `m`.`Duration`) -FROM `Missions` AS `m` -"""); - } - - public override async Task TimeSpan_Minutes(bool async) - { - await base.TimeSpan_Minutes(async); - - AssertSql( -""" -SELECT DATEPART('n', `m`.`Duration`) -FROM `Missions` AS `m` -"""); - } - - public override async Task TimeSpan_Seconds(bool async) - { - await base.TimeSpan_Seconds(async); - - AssertSql( -""" -SELECT DATEPART('s', `m`.`Duration`) -FROM `Missions` AS `m` -"""); - } - - public override async Task TimeSpan_Milliseconds(bool async) - { - await base.TimeSpan_Milliseconds(async); - - AssertSql( -""" -SELECT DATEPART(millisecond, [m].[Duration]) -FROM [Missions] AS [m] -"""); - } - - public override async Task Where_TimeSpan_Hours(bool async) - { - await base.Where_TimeSpan_Hours(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('h', `m`.`Duration`) = 1 -"""); - } - - public override async Task Where_TimeSpan_Minutes(bool async) - { - await base.Where_TimeSpan_Minutes(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('n', `m`.`Duration`) = 2 -"""); - } - - public override async Task Where_TimeSpan_Seconds(bool async) - { - await base.Where_TimeSpan_Seconds(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('s', `m`.`Duration`) = 3 -"""); - } - - public override async Task Where_TimeSpan_Milliseconds(bool async) - { - await base.Where_TimeSpan_Milliseconds(async); - - AssertSql( -""" -SELECT [m].[Id], [m].[CodeName], [m].[Duration], [m].[Rating], [m].[Timeline] -FROM [Missions] AS [m] -WHERE DATEPART(millisecond, [m].[Duration]) = 1 -"""); - } - public override async Task Contains_on_collection_of_byte_subquery(bool async) { await base.Contains_on_collection_of_byte_subquery(async); @@ -8566,23 +7783,6 @@ SELECT 1 """); } - public override async Task Contains_on_byte_array_property_using_byte_column(bool async) - { - await base.Contains_on_byte_array_property_using_byte_column(async); - - AssertSql( - """ -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name`, `s0`.`Name`, `s0`.`LocustHordeId`, `s0`.`ThreatLevel`, `s0`.`ThreatLevelByte`, `s0`.`ThreatLevelNullableByte`, `s0`.`DefeatedByNickname`, `s0`.`DefeatedBySquadId`, `s0`.`HighCommandId`, `s0`.`Discriminator` -FROM `Squads` AS `s`, -( - SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, IIF(`l0`.`Name` IS NOT NULL, 'LocustCommander', NULL) AS `Discriminator` - FROM `LocustLeaders` AS `l` - LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`Name` = `l0`.`Name` -) AS `s0` -WHERE INSTR(1, STRCONV(`s`.`Banner`, 64), CHR(`s0`.`ThreatLevelByte`), 0) > 0 -"""); - } - public override async Task Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion( bool async) { @@ -8683,11 +7883,11 @@ public override async Task Enum_closure_typed_as_underlying_type_generates_corre AssertSql( """ -@__prm_0='1' (Nullable = true) +@prm='1' (Nullable = true) SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` -WHERE @__prm_0 = `w`.`AmmunitionType` +WHERE @prm = `w`.`AmmunitionType` """); } @@ -8696,13 +7896,13 @@ public override async Task Enum_flags_closure_typed_as_underlying_type_generates await base.Enum_flags_closure_typed_as_underlying_type_generates_correct_parameter_type(async); AssertSql( -""" -@__prm_0='133' + """ +@prm='133' SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (@__prm_0 BAND `g`.`Rank`) = `g`.`Rank` +WHERE (@prm BAND `g`.`Rank`) = `g`.`Rank` """); } @@ -8712,12 +7912,12 @@ public override async Task Enum_flags_closure_typed_as_different_type_generates_ AssertSql( """ -@__prm_0='5' +@prm='5' SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (@__prm_0 BAND CLNG(`g`.`Rank`)) = CLNG(`g`.`Rank`) +WHERE (@prm BAND CLNG(`g`.`Rank`)) = CLNG(`g`.`Rank`) """); } @@ -8726,38 +7926,25 @@ public override async Task Constant_enum_with_same_underlying_value_as_previousl await base.Constant_enum_with_same_underlying_value_as_previously_parameterized_int(async); AssertSql( -""" -SELECT TOP 1 `g`.`Rank` BAND 1 + """ +SELECT TOP @p `g`.`Rank` BAND 1 FROM `Gears` AS `g` ORDER BY `g`.`Nickname` """); } - public override async Task Enum_array_contains(bool async) - { - await base.Enum_array_contains(async); - - AssertSql( -""" -SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` -FROM `Weapons` AS `w` -LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` -WHERE `w0`.`Id` IS NOT NULL AND (`w0`.`AmmunitionType` IS NULL OR `w0`.`AmmunitionType` = 1) -"""); - } - public override async Task Coalesce_with_non_root_evaluatable_Convert(bool async) { await base.Coalesce_with_non_root_evaluatable_Convert(async); AssertSql( - $""" -@__rank_0='1' (Nullable = true) + """ +@rank='1' (Nullable = true) SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE {AssertSqlHelper.Parameter("@__rank_0")} = `g`.`Rank` +WHERE @rank = `g`.`Rank` """); } @@ -9034,30 +8221,6 @@ FROM [Weapons] AS [w] """); } - public override async Task First_on_byte_array(bool async) - { - await base.First_on_byte_array(async); - - AssertSql( - """ -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE ASCB(MIDB(`s`.`Banner`, 1, 1)) = 2 -"""); - } - - public override async Task Array_access_on_byte_array(bool async) - { - await base.Array_access_on_byte_array(async); - - AssertSql( - """ -SELECT `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name` -FROM `Squads` AS `s` -WHERE ASCB(MIDB(`s`.`Banner5`, 2 + 1, 1)) = 6 -"""); - } - public override async Task Project_shadow_properties(bool async) { await base.Project_shadow_properties(async); @@ -9086,560 +8249,257 @@ WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] -) AS [t] -WHERE [g].[Nickname] = [t].[Nickname] AND [g].[SquadId] = [t].[SquadId] -"""); - } - - public override async Task Composite_key_entity_not_equal(bool async) - { - await base.Composite_key_entity_not_equal(async); - - AssertSql( -""" -SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], CASE - WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' -END AS [Discriminator], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] -FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -CROSS JOIN ( - SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE - WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' - END AS [Discriminator] - FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] -) AS [t] -WHERE [g].[Nickname] <> [t].[Nickname] OR [g].[SquadId] <> [t].[SquadId] -"""); - } - - public override async Task Composite_key_entity_equal_null(bool async) - { - await base.Composite_key_entity_equal_null(async); - - AssertSql( - """ -SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, IIF(`l0`.`Name` IS NOT NULL, 'LocustCommander', NULL) AS `Discriminator` -FROM (`LocustLeaders` AS `l` -LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`Name` = `l0`.`Name`) -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` -) AS `s` ON `l0`.`DefeatedByNickname` = `s`.`Nickname` AND `l0`.`DefeatedBySquadId` = `s`.`SquadId` -WHERE `l0`.`Name` IS NOT NULL AND (`s`.`Nickname` IS NULL OR `s`.`SquadId` IS NULL) -"""); - } - - public override async Task Composite_key_entity_not_equal_null(bool async) - { - await base.Composite_key_entity_not_equal_null(async); - - AssertSql( - """ -SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, IIF(`l0`.`Name` IS NOT NULL, 'LocustCommander', NULL) AS `Discriminator` -FROM (`LocustLeaders` AS `l` -LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`Name` = `l0`.`Name`) -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` -) AS `s` ON `l0`.`DefeatedByNickname` = `s`.`Nickname` AND `l0`.`DefeatedBySquadId` = `s`.`SquadId` -WHERE `l0`.`Name` IS NOT NULL AND `s`.`Nickname` IS NOT NULL AND `s`.`SquadId` IS NOT NULL -"""); - } - - public override async Task Projecting_property_converted_to_nullable_with_comparison(bool async) - { - await base.Projecting_property_converted_to_nullable_with_comparison(async); - - AssertSql( - """ -SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, TRUE, FALSE), `s`.`Nickname`, `s`.`SquadId`, `s`.`HasSoulPatch` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` -) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL) = 1 -"""); - } - - public override async Task Projecting_property_converted_to_nullable_with_addition(bool async) - { - await base.Projecting_property_converted_to_nullable_with_addition(async); - - AssertSql( - """ -SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, TRUE, FALSE), `s`.`Nickname`, `s`.`SquadId`, `s`.`HasSoulPatch` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` -) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` -WHERE (IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL) + 1) = 2 -"""); - } - - public override async Task Projecting_property_converted_to_nullable_with_addition_and_final_projection(bool async) - { - await base.Projecting_property_converted_to_nullable_with_addition_and_final_projection(async); - - AssertSql( - """ -SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL) + 1 AS `Value` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` -) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL) IS NOT NULL -"""); - } - - public override async Task Projecting_property_converted_to_nullable_with_conditional(bool async) - { - await base.Projecting_property_converted_to_nullable_with_conditional(async); - - AssertSql( - """ -SELECT IIF(`t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL, IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL), -1) -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` -) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` -"""); - } - - public override async Task Projecting_property_converted_to_nullable_with_function_call(bool async) - { - await base.Projecting_property_converted_to_nullable_with_function_call(async); - - AssertSql( - """ -SELECT MID(IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL), 0 + 1, 3) -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` -) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` -"""); - } - - public override async Task Projecting_property_converted_to_nullable_with_function_call2(bool async) - { - await base.Projecting_property_converted_to_nullable_with_function_call2(async); - - AssertSql( - """ -SELECT `t`.`Note`, MID(`t`.`Note`, 0 + 1, IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL)) AS `Function` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` -) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL) IS NOT NULL -"""); - } - - public override async Task Projecting_property_converted_to_nullable_into_element_init(bool async) - { - await base.Projecting_property_converted_to_nullable_into_element_init(async); - - AssertSql( - """ -SELECT IIF(`t`.`GearNickName` IS NOT NULL, IIF(LEN(`s`.`Nickname`) IS NULL, NULL, CLNG(LEN(`s`.`Nickname`))), NULL), IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL), IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL) + 1 -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` -) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL) IS NOT NULL -ORDER BY `t`.`Note` -"""); - } - - public override async Task Projecting_property_converted_to_nullable_into_member_assignment(bool async) - { - await base.Projecting_property_converted_to_nullable_into_member_assignment(async); - - AssertSql( - """ -SELECT IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL) AS `Id` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` -) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL) IS NOT NULL -ORDER BY `t`.`Note` -"""); - } - - public override async Task Projecting_property_converted_to_nullable_into_new_array(bool async) - { - await base.Projecting_property_converted_to_nullable_into_new_array(async); - - AssertSql( - """ -SELECT IIF(`t`.`GearNickName` IS NOT NULL, IIF(LEN(`s`.`Nickname`) IS NULL, NULL, CLNG(LEN(`s`.`Nickname`))), NULL), IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL), IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL) + 1 -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId` - FROM `Gears` AS `g` -) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL) IS NOT NULL -ORDER BY `t`.`Note` -"""); - } - - public override async Task Projecting_property_converted_to_nullable_into_unary(bool async) - { - await base.Projecting_property_converted_to_nullable_into_unary(async); - - AssertSql( - """ -SELECT `t`.`Note` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` -) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL) IS NOT NULL AND IIF(`t`.`GearNickName` IS NOT NULL, `s`.`HasSoulPatch`, NULL) = FALSE -ORDER BY `t`.`Note` -"""); - } - - public override async Task Projecting_property_converted_to_nullable_into_member_access(bool async) - { - await base.Projecting_property_converted_to_nullable_into_member_access(async); - - AssertSql( -""" -SELECT `g`.`Nickname` -FROM `Gears` AS `g` -LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` -WHERE DATEPART('m', `t`.`IssueDate`) <> 5 -ORDER BY `g`.`Nickname` -"""); - } - - public override async Task Projecting_property_converted_to_nullable_and_use_it_in_order_by(bool async) - { - await base.Projecting_property_converted_to_nullable_and_use_it_in_order_by(async); - - AssertSql( - """ -SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, TRUE, FALSE), `s`.`Nickname`, `s`.`SquadId`, `s`.`HasSoulPatch` -FROM `Tags` AS `t` -LEFT JOIN ( - SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` - FROM `Gears` AS `g` -) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` -WHERE IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL) IS NOT NULL -ORDER BY IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL), `t`.`Note` -"""); - } - - public override async Task Where_DateOnly_Year(bool async) - { - await base.Where_DateOnly_Year(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('yyyy', `m`.`Date`) = 1990 -"""); - } - - public override async Task Where_DateOnly_Month(bool async) - { - await base.Where_DateOnly_Month(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('m', `m`.`Date`) = 11 -"""); - } - - public override async Task Where_DateOnly_Day(bool async) - { - await base.Where_DateOnly_Day(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('d', `m`.`Date`) = 10 -"""); - } - - public override async Task Where_DateOnly_DayOfYear(bool async) - { - await base.Where_DateOnly_DayOfYear(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('y', `m`.`Date`) = 314 -"""); - } - - public override async Task Where_DateOnly_DayOfWeek(bool async) - { - await AssertTranslationFailed(() => base.Where_DateOnly_DayOfWeek(async)); - - AssertSql(); - } - - public override async Task Where_DateOnly_AddYears(bool async) - { - await base.Where_DateOnly_AddYears(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEADD('yyyy', CLNG(3), `m`.`Date`) = #1993-11-10# -"""); - } - - public override async Task Where_DateOnly_AddMonths(bool async) - { - await base.Where_DateOnly_AddMonths(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEADD('m', CLNG(3), `m`.`Date`) = #1991-02-10# -"""); - } - - public override async Task Where_DateOnly_AddDays(bool async) - { - await base.Where_DateOnly_AddDays(async); - - AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEADD('d', CLNG(3), `m`.`Date`) = #1990-11-13# +) AS [t] +WHERE [g].[Nickname] = [t].[Nickname] AND [g].[SquadId] = [t].[SquadId] """); } - public override async Task Where_TimeOnly_Hour(bool async) + public override async Task Composite_key_entity_not_equal(bool async) { - await base.Where_TimeOnly_Hour(async); + await base.Composite_key_entity_not_equal(async); AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('h', `m`.`Time`) = 10 +""" +SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], CASE + WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' +END AS [Discriminator], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] +FROM [Gears] AS [g] +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +CROSS JOIN ( + SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE + WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' + END AS [Discriminator] + FROM [Gears] AS [g0] + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] +) AS [t] +WHERE [g].[Nickname] <> [t].[Nickname] OR [g].[SquadId] <> [t].[SquadId] """); } - public override async Task Where_TimeOnly_Minute(bool async) + public override async Task Composite_key_entity_equal_null(bool async) { - await base.Where_TimeOnly_Minute(async); + await base.Composite_key_entity_equal_null(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('n', `m`.`Time`) = 15 +SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, IIF(`l0`.`Name` IS NOT NULL, 'LocustCommander', NULL) AS `Discriminator` +FROM (`LocustLeaders` AS `l` +LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`Name` = `l0`.`Name`) +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` +) AS `s` ON `l0`.`DefeatedByNickname` = `s`.`Nickname` AND `l0`.`DefeatedBySquadId` = `s`.`SquadId` +WHERE `l0`.`Name` IS NOT NULL AND (`s`.`Nickname` IS NULL OR `s`.`SquadId` IS NULL) """); } - public override async Task Where_TimeOnly_Second(bool async) + public override async Task Composite_key_entity_not_equal_null(bool async) { - await base.Where_TimeOnly_Second(async); + await base.Composite_key_entity_not_equal_null(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE DATEPART('s', `m`.`Time`) = 50 +SELECT `l`.`Name`, `l`.`LocustHordeId`, `l`.`ThreatLevel`, `l`.`ThreatLevelByte`, `l`.`ThreatLevelNullableByte`, `l0`.`DefeatedByNickname`, `l0`.`DefeatedBySquadId`, `l0`.`HighCommandId`, IIF(`l0`.`Name` IS NOT NULL, 'LocustCommander', NULL) AS `Discriminator` +FROM (`LocustLeaders` AS `l` +LEFT JOIN `LocustCommanders` AS `l0` ON `l`.`Name` = `l0`.`Name`) +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` +) AS `s` ON `l0`.`DefeatedByNickname` = `s`.`Nickname` AND `l0`.`DefeatedBySquadId` = `s`.`SquadId` +WHERE `l0`.`Name` IS NOT NULL AND `s`.`Nickname` IS NOT NULL AND `s`.`SquadId` IS NOT NULL """); } - public override async Task Where_TimeOnly_Millisecond(bool async) + public override async Task Projecting_property_converted_to_nullable_with_comparison(bool async) { - await base.Where_TimeOnly_Millisecond(async); + await base.Projecting_property_converted_to_nullable_with_comparison(async); AssertSql( -""" -SELECT [m].[Id], [m].[CodeName], [m].[Date], [m].[Duration], [m].[Rating], [m].[Time], [m].[Timeline] -FROM [Missions] AS [m] -WHERE DATEPART(millisecond, [m].[Time]) = 500 + """ +SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, TRUE, FALSE), `s`.`Nickname`, `s`.`SquadId`, `s`.`HasSoulPatch` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` +) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL) = 1 """); } - public override async Task Where_TimeOnly_AddHours(bool async) + public override async Task Projecting_property_converted_to_nullable_with_addition(bool async) { - await base.Where_TimeOnly_AddHours(async); + await base.Projecting_property_converted_to_nullable_with_addition(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE TIMEVALUE(DATEADD('h', CLNG(3.0), `m`.`Time`)) = TIMEVALUE('13:15:50') +SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, TRUE, FALSE), `s`.`Nickname`, `s`.`SquadId`, `s`.`HasSoulPatch` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` +) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` +WHERE (IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL) + 1) = 2 """); } - public override async Task Where_TimeOnly_AddMinutes(bool async) + public override async Task Projecting_property_converted_to_nullable_with_addition_and_final_projection(bool async) { - await base.Where_TimeOnly_AddMinutes(async); + await base.Projecting_property_converted_to_nullable_with_addition_and_final_projection(async); AssertSql( - """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE TIMEVALUE(DATEADD('n', CLNG(3.0), `m`.`Time`)) = TIMEVALUE('10:18:50') + """ +SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL) + 1 AS `Value` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` +) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL) IS NOT NULL """); } - public override async Task Where_TimeOnly_Add_TimeSpan(bool async) - { - await AssertTranslationFailed(() => base.Where_TimeOnly_Add_TimeSpan(async)); - - AssertSql(); - } - - public override async Task Where_TimeOnly_IsBetween(bool async) + public override async Task Projecting_property_converted_to_nullable_with_conditional(bool async) { - await base.Where_TimeOnly_IsBetween(async); + await base.Projecting_property_converted_to_nullable_with_conditional(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE (IIF(`m`.`Time` >= TIMEVALUE('10:00:00'), TRUE, FALSE) BAND IIF(`m`.`Time` < TIMEVALUE('11:00:00'), TRUE, FALSE)) = TRUE +SELECT IIF(`t`.`Note` <> 'K.I.A.' OR `t`.`Note` IS NULL, IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL), -1) +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` +) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` """); } - public override async Task Where_TimeOnly_subtract_TimeOnly(bool async) - { - await AssertTranslationFailed(() => base.Where_TimeOnly_subtract_TimeOnly(async)); - - AssertSql(); - } - - public override async Task Where_TimeOnly_FromDateTime_compared_to_property(bool async) + public override async Task Projecting_property_converted_to_nullable_with_function_call(bool async) { - await base.Where_TimeOnly_FromDateTime_compared_to_property(async); + await base.Projecting_property_converted_to_nullable_with_function_call(async); AssertSql( """ -SELECT `t`.`Id` AS `TagId`, `m`.`Id` AS `MissionId` -FROM `Tags` AS `t`, -`Missions` AS `m` -WHERE TIMEVALUE(`t`.`IssueDate`) = `m`.`Time` +SELECT MID(IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL), 0 + 1, 3) +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` +) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` """); } - public override async Task Where_TimeOnly_FromDateTime_compared_to_parameter(bool async) + public override async Task Projecting_property_converted_to_nullable_with_function_call2(bool async) { - await base.Where_TimeOnly_FromDateTime_compared_to_parameter(async); + await base.Projecting_property_converted_to_nullable_with_function_call2(async); AssertSql( -""" -@__time_0='02:00' (DbType = Time) - -SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] -FROM [Tags] AS [t] + """ +SELECT `t`.`Note`, MID(`t`.`Note`, 0 + 1, IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL)) AS `Function` +FROM `Tags` AS `t` LEFT JOIN ( - SELECT [g].[Nickname], [g].[SquadId] - FROM [Gears] AS [g] -) AS [s] ON [t].[GearNickName] = [s].[Nickname] AND [t].[GearSquadId] = [s].[SquadId] -WHERE [s].[Nickname] IS NOT NULL AND [s].[SquadId] IS NOT NULL AND CAST(DATEADD(hour, CAST(CAST([s].[SquadId] AS float) AS int), [t].[IssueDate]) AS time) = @__time_0 + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` +) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL) IS NOT NULL """); } - public override async Task Where_TimeOnly_FromDateTime_compared_to_constant(bool async) + public override async Task Projecting_property_converted_to_nullable_into_element_init(bool async) { - await base.Where_TimeOnly_FromDateTime_compared_to_constant(async); + await base.Projecting_property_converted_to_nullable_into_element_init(async); AssertSql( """ -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` +SELECT IIF(`t`.`GearNickName` IS NOT NULL, IIF(LEN(`s`.`Nickname`) IS NULL, NULL, CLNG(LEN(`s`.`Nickname`))), NULL), IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL), IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL) + 1 FROM `Tags` AS `t` -WHERE IIF(DATEADD('h', CDBL(IIF(LEN(`t`.`Note`) IS NULL, NULL, CLNG(LEN(`t`.`Note`)))), `t`.`IssueDate`) IS NULL, NULL, TIMEVALUE(DATEADD('h', CDBL(IIF(LEN(`t`.`Note`) IS NULL, NULL, CLNG(LEN(`t`.`Note`)))), `t`.`IssueDate`))) > TIMEVALUE('09:00:00') +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` +) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL) IS NOT NULL +ORDER BY `t`.`Note` """); } - public override async Task Where_TimeOnly_FromTimeSpan_compared_to_property(bool async) + public override async Task Projecting_property_converted_to_nullable_into_member_assignment(bool async) { - await base.Where_TimeOnly_FromTimeSpan_compared_to_property(async); + await base.Projecting_property_converted_to_nullable_into_member_assignment(async); AssertSql( """ -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE TIMEVALUE(`m`.`Duration`) < `m`.`Time` +SELECT IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL) AS `Id` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` +) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL) IS NOT NULL +ORDER BY `t`.`Note` """); } - public override async Task Where_TimeOnly_FromTimeSpan_compared_to_parameter(bool async) + public override async Task Projecting_property_converted_to_nullable_into_new_array(bool async) { - await base.Where_TimeOnly_FromTimeSpan_compared_to_parameter(async); + await base.Projecting_property_converted_to_nullable_into_new_array(async); AssertSql( """ -@__time_0='01:02:03' - -SELECT `m`.`Id`, `m`.`CodeName`, `m`.`Date`, `m`.`Difficulty`, `m`.`Duration`, `m`.`Rating`, `m`.`Time`, `m`.`Timeline` -FROM `Missions` AS `m` -WHERE TIMEVALUE(`m`.`Duration`) = TIMEVALUE(@__time_0) +SELECT IIF(`t`.`GearNickName` IS NOT NULL, IIF(LEN(`s`.`Nickname`) IS NULL, NULL, CLNG(LEN(`s`.`Nickname`))), NULL), IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL), IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL) + 1 +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId` + FROM `Gears` AS `g` +) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL) IS NOT NULL +ORDER BY `t`.`Note` """); } - public override async Task Order_by_TimeOnly_FromTimeSpan(bool async) + public override async Task Projecting_property_converted_to_nullable_into_unary(bool async) { - await base.Order_by_TimeOnly_FromTimeSpan(async); + await base.Projecting_property_converted_to_nullable_into_unary(async); AssertSql( -""" -SELECT [m].[Id], [m].[CodeName], [m].[Date], [m].[Difficulty], [m].[Duration], [m].[Rating], [m].[Time], [m].[Timeline] -FROM [Missions] AS [m] -ORDER BY CAST([m].[Duration] AS time) + """ +SELECT `t`.`Note` +FROM `Tags` AS `t` +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` +) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL) IS NOT NULL AND IIF(`t`.`GearNickName` IS NOT NULL, `s`.`HasSoulPatch`, NULL) = FALSE +ORDER BY `t`.`Note` """); } - public override async Task Where_DateOnly_FromDateTime_compared_to_property(bool async) + public override async Task Projecting_property_converted_to_nullable_into_member_access(bool async) { - await base.Where_DateOnly_FromDateTime_compared_to_property(async); + await base.Projecting_property_converted_to_nullable_into_member_access(async); AssertSql( - """ -SELECT `t`.`Id` AS `TagId`, `m`.`Id` AS `MissionId` -FROM `Tags` AS `t`, -`Missions` AS `m` -WHERE `t`.`IssueDate` > `m`.`Date` +""" +SELECT `g`.`Nickname` +FROM `Gears` AS `g` +LEFT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName` AND `g`.`SquadId` = `t`.`GearSquadId` +WHERE DATEPART('m', `t`.`IssueDate`) <> 5 +ORDER BY `g`.`Nickname` """); } - public override async Task Where_DateOnly_FromDateTime_compared_to_constant_and_parameter(bool async) + public override async Task Projecting_property_converted_to_nullable_and_use_it_in_order_by(bool async) { - //await base.Where_DateOnly_FromDateTime_compared_to_constant_and_parameter(async); - - var prm = new DateOnly(102, 10, 11); - - await AssertQuery( - async, - ss => ss.Set().Where(x => new[] { prm, new DateOnly(115, 3, 7) }.Contains(DateOnly.FromDateTime(x.IssueDate)))); + await base.Projecting_property_converted_to_nullable_and_use_it_in_order_by(async); AssertSql( - $""" -@__prm_0='0102-10-11T00:00:00.0000000' (DbType = Date) - -SELECT `t`.`Id`, `t`.`GearNickName`, `t`.`GearSquadId`, `t`.`IssueDate`, `t`.`Note` + """ +SELECT `t`.`Note`, IIF(`t`.`GearNickName` IS NOT NULL, TRUE, FALSE), `s`.`Nickname`, `s`.`SquadId`, `s`.`HasSoulPatch` FROM `Tags` AS `t` -WHERE `t`.`IssueDate` IN ({AssertSqlHelper.Parameter("@__prm_0")}, #0115-03-07#) +LEFT JOIN ( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` +) AS `s` ON `t`.`GearNickName` = `s`.`Nickname` AND `t`.`GearSquadId` = `s`.`SquadId` +WHERE IIF(`t`.`GearNickName` IS NOT NULL, `s`.`Nickname`, NULL) IS NOT NULL +ORDER BY IIF(`t`.`GearNickName` IS NOT NULL, `s`.`SquadId`, NULL), `t`.`Note` """); } @@ -9690,9 +8550,9 @@ public override async Task Join_entity_with_itself_grouped_by_key_followed_by_in """ SELECT `s1`.`Nickname`, `s1`.`SquadId`, `s1`.`AssignedCityName`, `s1`.`CityOfBirthName`, `s1`.`FullName`, `s1`.`HasSoulPatch`, `s1`.`LeaderNickname`, `s1`.`LeaderSquadId`, `s1`.`Rank`, `s1`.`Discriminator`, `s1`.`HasSoulPatch0`, `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM ( - SELECT TOP 10 `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`AssignedCityName`, `s0`.`CityOfBirthName`, `s0`.`FullName`, `s0`.`HasSoulPatch`, `s0`.`LeaderNickname`, `s0`.`LeaderSquadId`, `s0`.`Rank`, `s0`.`Discriminator`, `s0`.`HasSoulPatch0` + SELECT TOP @p0 `s0`.`Nickname`, `s0`.`SquadId`, `s0`.`AssignedCityName`, `s0`.`CityOfBirthName`, `s0`.`FullName`, `s0`.`HasSoulPatch`, `s0`.`LeaderNickname`, `s0`.`LeaderSquadId`, `s0`.`Rank`, `s0`.`Discriminator`, `s0`.`HasSoulPatch0` FROM ( - SELECT TOP 10 `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator`, `s`.`HasSoulPatch` AS `HasSoulPatch0` + SELECT TOP @p + @p0 `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator`, `s`.`HasSoulPatch` AS `HasSoulPatch0` FROM (`Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) LEFT JOIN ( @@ -9743,12 +8603,12 @@ public override async Task Parameter_used_multiple_times_take_appropriate_inferr AssertSql( """ -@__place_0='Ephyra's location' (Size = 255), @__place_0_1='Ephyra's location' (Size = 100) -@__place_0_1='Ephyra's location' (Size = 100) +@place='Ephyra's location' (Size = 255), @place0='Ephyra's location' (Size = 100) +@place='Ephyra's location' (Size = 255) SELECT `c`.`Name`, `c`.`Location`, `c`.`Nation` FROM `Cities` AS `c` -WHERE `c`.`Nation` = @__place_0 OR `c`.`Location` = @__place_0_1 OR `c`.`Location` = @__place_0_1 +WHERE `c`.`Nation` = @place OR `c`.`Location` = @place0 OR `c`.`Location` = @place """); } @@ -9758,9 +8618,9 @@ public override async Task Enum_matching_take_value_gets_different_type_mapping( AssertSql( """ -@__value_1='1' +@value='1' -SELECT TOP 1 `g`.`Rank` BAND @__value_1 +SELECT TOP @p `g`.`Rank` BAND @value FROM `Gears` AS `g` ORDER BY `g`.`Nickname` """); @@ -9771,15 +8631,15 @@ public override async Task SelectMany_Where_DefaultIfEmpty_with_navigation_in_th await base.SelectMany_Where_DefaultIfEmpty_with_navigation_in_the_collection_selector_order_comparison(async); AssertSql( - """ -@__prm_0='1' + """ +@prm='1' SELECT `g`.`Nickname`, `g`.`FullName`, IIF(`w0`.`Id` IS NOT NULL, TRUE, FALSE) AS `Collection` FROM `Gears` AS `g` LEFT JOIN ( SELECT `w`.`Id`, `w`.`OwnerFullName` FROM `Weapons` AS `w` - WHERE `w`.`Id` > @__prm_0 + WHERE `w`.`Id` > @prm ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` """); } @@ -9809,17 +8669,6 @@ FROM [Weapons] AS [w0] """); } - public override async Task DateTimeOffset_DateAdd_AddYears(bool async) - { - await base.DateTimeOffset_DateAdd_AddYears(async); - - AssertSql( - """ -SELECT DATEADD('yyyy', 1, `m`.`Timeline`) -FROM `Missions` AS `m` -"""); - } - public override async Task Correlated_collection_via_SelectMany_with_Distinct_missing_indentifying_columns_in_projection(bool async) { await base.Correlated_collection_via_SelectMany_with_Distinct_missing_indentifying_columns_in_projection(async); @@ -9867,15 +8716,15 @@ public override async Task SelectMany_Where_DefaultIfEmpty_with_navigation_in_th await base.SelectMany_Where_DefaultIfEmpty_with_navigation_in_the_collection_selector_not_equal(async); AssertSql( - """ -@__isAutomatic_0='True' + """ +@isAutomatic='True' SELECT `g`.`Nickname`, `g`.`FullName`, IIF(`w0`.`Id` IS NOT NULL, TRUE, FALSE) AS `Collection` FROM `Gears` AS `g` LEFT JOIN ( SELECT `w`.`Id`, `w`.`OwnerFullName` FROM `Weapons` AS `w` - WHERE `w`.`IsAutomatic` <> @__isAutomatic_0 + WHERE `w`.`IsAutomatic` <> @isAutomatic ) AS `w0` ON `g`.`FullName` = `w0`.`OwnerFullName` """); } @@ -9909,8 +8758,8 @@ public override async Task Comparison_with_value_converted_subclass(bool async) await base.Comparison_with_value_converted_subclass(async); AssertSql( - """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` + """ +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` WHERE `f`.`ServerAddress` = '127.0.0.1' @@ -10026,26 +8875,6 @@ SELECT IIF(SUM(`m`.`Rating`) IS NULL, 0.0, SUM(`m`.`Rating`)) """); } - public override async Task ToString_guid_property_projection(bool async) - { - await AssertQuery( - async, - ss => ss.Set().Select( - ct => new { A = ct.GearNickName, B = ct.Id.ToString("B") }), - elementSorter: e => e.B, - elementAsserter: (e, a) => - { - Assert.Equal(e.A, a.A); - Assert.Equal(e.B.ToLower(), a.B.ToLower()); - }); - - AssertSql( - """ -SELECT `t`.`GearNickName`, `t`.`Id` -FROM `Tags` AS `t` -"""); - } - public override async Task Correlated_collection_with_distinct_not_projecting_identifier_column(bool async) { await base.Correlated_collection_with_distinct_not_projecting_identifier_column(async); @@ -10068,8 +8897,8 @@ public override async Task Include_after_Select_throws(bool async) await base.Include_after_Select_throws(async); AssertSql( -""" -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator`, `c`.`Name`, `c`.`Location`, `c`.`Nation` + """ +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator`, `c`.`Name`, `c`.`Location`, `c`.`Nation` FROM (`Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id`) LEFT JOIN `Cities` AS `c` ON `f`.`CapitalName` = `c`.`Name` @@ -10142,8 +8971,8 @@ public override async Task Project_derivied_entity_with_convert_to_parent(bool a { await base.Project_derivied_entity_with_convert_to_parent(async); AssertSql( -""" -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` + """ +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator` FROM `Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id` WHERE `l`.`Id` IS NOT NULL @@ -10295,7 +9124,7 @@ public override async Task Include_on_derived_entity_with_cast(bool async) AssertSql( """ -SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator`, `c`.`Name`, `c`.`Location`, `c`.`Nation` +SELECT `f`.`Id`, `f`.`CapitalName`, `f`.`Name`, `f`.`ServerAddress`, `l`.`CommanderName`, `l`.`DeputyCommanderName`, `l`.`Eradicated`, IIF(`l`.`Id` IS NOT NULL, 'LocustHorde', NULL) AS `Discriminator`, `c`.`Name`, `c`.`Location`, `c`.`Nation` FROM (`Factions` AS `f` LEFT JOIN `LocustHordes` AS `l` ON `f`.`Id` = `l`.`Id`) LEFT JOIN `Cities` AS `c` ON `f`.`CapitalName` = `c`.`Name` @@ -10751,7 +9580,7 @@ public override async Task ElementAt_basic_with_OrderBy(bool async) FROM ( SELECT TOP 1 `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator` FROM ( - SELECT TOP 1 `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` + SELECT TOP @p + 1 `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ORDER BY `g`.`FullName` @@ -10772,7 +9601,7 @@ public override async Task ElementAtOrDefault_basic_with_OrderBy(bool async) FROM ( SELECT TOP 1 `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator` FROM ( - SELECT TOP 2 `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` + SELECT TOP @p + 1 `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ORDER BY `g`.`FullName` @@ -10793,7 +9622,7 @@ public override async Task ElementAtOrDefault_basic_with_OrderBy_parameter(bool FROM ( SELECT TOP 1 `s`.`Nickname`, `s`.`SquadId`, `s`.`AssignedCityName`, `s`.`CityOfBirthName`, `s`.`FullName`, `s`.`HasSoulPatch`, `s`.`LeaderNickname`, `s`.`LeaderSquadId`, `s`.`Rank`, `s`.`Discriminator` FROM ( - SELECT TOP 3 `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` + SELECT TOP @p + 1 `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` ORDER BY `g`.`FullName` @@ -10851,52 +9680,6 @@ public override async Task Using_indexer_on_byte_array_and_string_in_projection( """); } - public override async Task DateTimeOffset_to_unix_time_milliseconds(bool async) - { - await base.DateTimeOffset_to_unix_time_milliseconds(async); - - AssertSql( -""" -@__unixEpochMilliseconds_0='0' - -SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], CASE - WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' -END AS [Discriminator], [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name], [s1].[SquadId], [s1].[MissionId] -FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -INNER JOIN [Squads] AS [s] ON [g].[SquadId] = [s].[Id] -LEFT JOIN [SquadMissions] AS [s1] ON [s].[Id] = [s1].[SquadId] -WHERE NOT EXISTS ( - SELECT 1 - FROM [SquadMissions] AS [s0] - INNER JOIN [Missions] AS [m] ON [s0].[MissionId] = [m].[Id] - WHERE [s].[Id] = [s0].[SquadId] AND @__unixEpochMilliseconds_0 = DATEDIFF_BIG(millisecond, '1970-01-01T00:00:00.0000000+00:00', [m].[Timeline])) -ORDER BY [g].[Nickname], [g].[SquadId], [s].[Id], [s1].[SquadId] -"""); - } - - public override async Task DateTimeOffset_to_unix_time_seconds(bool async) - { - await base.DateTimeOffset_to_unix_time_seconds(async); - - AssertSql( - $""" -@__unixEpochSeconds_0='0' (DbType = Decimal) - -SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator`, `s`.`Id`, `s`.`Banner`, `s`.`Banner5`, `s`.`InternalNumber`, `s`.`Name`, `s1`.`SquadId`, `s1`.`MissionId` -FROM ((`Gears` AS `g` -LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId`) -INNER JOIN `Squads` AS `s` ON `g`.`SquadId` = `s`.`Id`) -LEFT JOIN `SquadMissions` AS `s1` ON `s`.`Id` = `s1`.`SquadId` -WHERE NOT EXISTS ( - SELECT `s0`.`SquadId` - FROM `SquadMissions` AS `s0` - INNER JOIN `Missions` AS `m` ON `s0`.`MissionId` = `m`.`Id` - WHERE `s`.`Id` = `s0`.`SquadId` AND {AssertSqlHelper.Parameter("@__unixEpochSeconds_0")} = DATEDIFF('s', CDATE('1970-01-01 00:00:00'), `m`.`Timeline`)) -ORDER BY `g`.`Nickname`, `g`.`SquadId`, `s`.`Id`, `s1`.`SquadId` -"""); - } - public override async Task Set_operator_with_navigation_in_projection_groupby_aggregate(bool async) { await base.Set_operator_with_navigation_in_projection_groupby_aggregate(async); @@ -11170,22 +9953,22 @@ public override async Task Nested_contains_with_enum(bool async) AssertSql( """ -@__key_1='5f221fb9-66f4-442a-92c9-d97ed5989cc7' -@__key_1='5f221fb9-66f4-442a-92c9-d97ed5989cc7' +@key='5f221fb9-66f4-442a-92c9-d97ed5989cc7' +@key='5f221fb9-66f4-442a-92c9-d97ed5989cc7' SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE IIF(`g`.`Rank` = 1, @__key_1, @__key_1) IN ('{0a47bcb7-a1cb-4345-8944-c58f82d6aac7}', '{5f221fb9-66f4-442a-92c9-d97ed5989cc7}') +WHERE IIF(`g`.`Rank` = 1, @key, @key) IN ({0a47bcb7-a1cb-4345-8944-c58f82d6aac7}, {5f221fb9-66f4-442a-92c9-d97ed5989cc7}) """, // """ -@__key_1='5f221fb9-66f4-442a-92c9-d97ed5989cc7' -@__key_1='5f221fb9-66f4-442a-92c9-d97ed5989cc7' +@key='5f221fb9-66f4-442a-92c9-d97ed5989cc7' +@key='5f221fb9-66f4-442a-92c9-d97ed5989cc7' SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` -WHERE IIF(`w`.`AmmunitionType` = 1, @__key_1, @__key_1) IN ('{0a47bcb7-a1cb-4345-8944-c58f82d6aac7}', '{5f221fb9-66f4-442a-92c9-d97ed5989cc7}') +WHERE IIF(`w`.`AmmunitionType` = 1, @key, @key) IN ({0a47bcb7-a1cb-4345-8944-c58f82d6aac7}, {5f221fb9-66f4-442a-92c9-d97ed5989cc7}) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTInheritanceQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPTInheritanceQueryJetTest.cs index 374917c9..0a2dc61b 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTInheritanceQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPTInheritanceQueryJetTest.cs @@ -490,7 +490,7 @@ public override async Task Subquery_OfType(bool async) """ SELECT DISTINCT `s`.`Id`, `s`.`CountryId`, `s`.`Name`, `s`.`Species`, `s`.`EagleId`, `s`.`IsFlightless`, `s`.`FoundOn`, `s`.`Discriminator` FROM ( - SELECT TOP 5 `a`.`Id`, `a`.`CountryId`, `a`.`Name`, `a`.`Species`, `b`.`EagleId`, `b`.`IsFlightless`, `k`.`FoundOn`, IIF(`k`.`Id` IS NOT NULL, 'Kiwi', IIF(`e`.`Id` IS NOT NULL, 'Eagle', NULL)) AS `Discriminator` + SELECT TOP @p `a`.`Id`, `a`.`CountryId`, `a`.`Name`, `a`.`Species`, `b`.`EagleId`, `b`.`IsFlightless`, `k`.`FoundOn`, IIF(`k`.`Id` IS NOT NULL, 'Kiwi', IIF(`e`.`Id` IS NOT NULL, 'Eagle', NULL)) AS `Discriminator` FROM ((`Animals` AS `a` INNER JOIN `Birds` AS `b` ON `a`.`Id` = `b`.`Id`) LEFT JOIN `Eagle` AS `e` ON `a`.`Id` = `e`.`Id`) diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyNoTrackingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyNoTrackingQueryJetTest.cs index f5fa94b1..bd134805 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyNoTrackingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyNoTrackingQueryJetTest.cs @@ -93,14 +93,14 @@ public override async Task Skip_navigation_count_without_predicate(bool async) await base.Skip_navigation_count_without_predicate(async); AssertSql( -""" -SELECT [e].[Id], [e].[Name] -FROM [EntityOnes] AS [e] -WHERE ( - SELECT COUNT(*) - FROM [JoinOneSelfPayload] AS [j] - INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] - WHERE [e].[Id] = [j].[RightId]) > 0 + """ +SELECT `e`.`Id`, `e`.`Name` +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`) """); } @@ -1948,8 +1948,8 @@ public override async Task Contains_on_skip_collection_navigation(bool async) await base.Contains_on_skip_collection_navigation(async); AssertSql( -$""" -@__entity_equality_two_0_Id='1' (Nullable = true) + """ +@entity_equality_two_Id='1' (Nullable = true) SELECT `e`.`Id`, `e`.`Name` FROM `EntityOnes` AS `e` @@ -1957,7 +1957,7 @@ WHERE EXISTS ( SELECT 1 FROM `JoinOneToTwo` AS `j` INNER JOIN `EntityTwos` AS `e0` ON `j`.`TwoId` = `e0`.`Id` - WHERE `e`.`Id` = `j`.`OneId` AND `e0`.`Id` = {AssertSqlHelper.Parameter("@__entity_equality_two_0_Id")}) + WHERE `e`.`Id` = `j`.`OneId` AND `e0`.`Id` = @entity_equality_two_Id) """); } @@ -2134,14 +2134,14 @@ public override async Task Skip_navigation_count_without_predicate_unidirectiona await base.Skip_navigation_count_without_predicate_unidirectional(async); AssertSql( -""" -SELECT [u].[Id], [u].[Name] -FROM [UnidirectionalEntityOnes] AS [u] -WHERE ( - SELECT COUNT(*) - FROM [UnidirectionalJoinOneSelfPayload] AS [u0] - INNER JOIN [UnidirectionalEntityOnes] AS [u1] ON [u0].[LeftId] = [u1].[Id] - WHERE [u].[Id] = [u0].[RightId]) > 0 + """ +SELECT `u`.`Id`, `u`.`Name` +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`) """); } @@ -2662,8 +2662,8 @@ public override async Task Contains_on_skip_collection_navigation_unidirectional await base.Contains_on_skip_collection_navigation_unidirectional(async); AssertSql( -$""" -@__entity_equality_two_0_Id='1' (Nullable = true) + """ +@entity_equality_two_Id='1' (Nullable = true) SELECT `u`.`Id`, `u`.`Name` FROM `UnidirectionalEntityOnes` AS `u` @@ -2671,7 +2671,7 @@ WHERE EXISTS ( SELECT 1 FROM `UnidirectionalJoinOneToTwo` AS `u0` INNER JOIN `UnidirectionalEntityTwos` AS `u1` ON `u0`.`TwoId` = `u1`.`Id` - WHERE `u`.`Id` = `u0`.`OneId` AND `u1`.`Id` = {AssertSqlHelper.Parameter("@__entity_equality_two_0_Id")}) + WHERE `u`.`Id` = `u0`.`OneId` AND `u1`.`Id` = @entity_equality_two_Id) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyQueryJetTest.cs index d83975b7..0b1dc743 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyQueryJetTest.cs @@ -92,14 +92,14 @@ public override async Task Skip_navigation_count_without_predicate(bool async) await base.Skip_navigation_count_without_predicate(async); AssertSql( -""" -SELECT [e].[Id], [e].[Name] -FROM [EntityOnes] AS [e] -WHERE ( - SELECT COUNT(*) - FROM [JoinOneSelfPayload] AS [j] - INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] - WHERE [e].[Id] = [j].[RightId]) > 0 + """ +SELECT `e`.`Id`, `e`.`Name` +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`) """); } @@ -1955,8 +1955,8 @@ public override async Task Contains_on_skip_collection_navigation(bool async) await base.Contains_on_skip_collection_navigation(async); AssertSql( -$""" -@__entity_equality_two_0_Id='1' (Nullable = true) + """ +@entity_equality_two_Id='1' (Nullable = true) SELECT `e`.`Id`, `e`.`Name` FROM `EntityOnes` AS `e` @@ -1964,7 +1964,7 @@ WHERE EXISTS ( SELECT 1 FROM `JoinOneToTwo` AS `j` INNER JOIN `EntityTwos` AS `e0` ON `j`.`TwoId` = `e0`.`Id` - WHERE `e`.`Id` = `j`.`OneId` AND `e0`.`Id` = {AssertSqlHelper.Parameter("@__entity_equality_two_0_Id")}) + WHERE `e`.`Id` = `j`.`OneId` AND `e0`.`Id` = @entity_equality_two_Id) """); } @@ -2134,14 +2134,14 @@ public override async Task Skip_navigation_count_without_predicate_unidirectiona await base.Skip_navigation_count_without_predicate_unidirectional(async); AssertSql( -""" -SELECT [u].[Id], [u].[Name] -FROM [UnidirectionalEntityOnes] AS [u] -WHERE ( - SELECT COUNT(*) - FROM [UnidirectionalJoinOneSelfPayload] AS [u0] - INNER JOIN [UnidirectionalEntityOnes] AS [u1] ON [u0].[LeftId] = [u1].[Id] - WHERE [u].[Id] = [u0].[RightId]) > 0 + """ +SELECT `u`.`Id`, `u`.`Name` +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`) """); } @@ -2685,8 +2685,8 @@ public override async Task Contains_on_skip_collection_navigation_unidirectional await base.Contains_on_skip_collection_navigation_unidirectional(async); AssertSql( -$""" -@__entity_equality_two_0_Id='1' (Nullable = true) + """ +@entity_equality_two_Id='1' (Nullable = true) SELECT `u`.`Id`, `u`.`Name` FROM `UnidirectionalEntityOnes` AS `u` @@ -2694,7 +2694,7 @@ WHERE EXISTS ( SELECT 1 FROM `UnidirectionalJoinOneToTwo` AS `u0` INNER JOIN `UnidirectionalEntityTwos` AS `u1` ON `u0`.`TwoId` = `u1`.`Id` - WHERE `u`.`Id` = `u0`.`OneId` AND `u1`.`Id` = {AssertSqlHelper.Parameter("@__entity_equality_two_0_Id")}) + WHERE `u`.`Id` = `u0`.`OneId` AND `u1`.`Id` = @entity_equality_two_Id) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/ToSqlQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ToSqlQueryJetTest.cs index 62ed9275..f6943373 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ToSqlQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ToSqlQueryJetTest.cs @@ -1,15 +1,16 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; using Xunit; namespace EntityFrameworkCore.Jet.FunctionalTests.Query; -public class ToSqlQueryJetTest : ToSqlQueryTestBase +public class ToSqlQueryJetTest(NonSharedFixture fixture) : ToSqlQueryTestBase(fixture) { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/BasicTypesQueryJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/BasicTypesQueryJetFixture.cs new file mode 100644 index 00000000..9c6b85e5 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/BasicTypesQueryJetFixture.cs @@ -0,0 +1,148 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Translations; +using Microsoft.EntityFrameworkCore.TestModels.BasicTypesModel; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System; +using System.Threading.Tasks; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations; + +public class BasicTypesQueryJetFixture : BasicTypesQueryFixtureBase, ITestSqlLoggerFactory +{ + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; + + public TestSqlLoggerFactory TestSqlLoggerFactory + => (TestSqlLoggerFactory)ListLoggerFactory; + + protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) + { + base.OnModelCreating(modelBuilder, context); + + modelBuilder.Entity().Property(b => b.Decimal).HasColumnType("decimal(18,2)"); + modelBuilder.Entity().Property(b => b.Decimal).HasColumnType("decimal(18,2)"); + } + + protected override Task SeedAsync(BasicTypesContext context) + { + var data = new BasicTypesData(); + //for every data.BasicTypesEntities and data.NullableBasicTypesEntities take the DateTime and DateTimeOffset and set the milliseconds to 0 + foreach (var entity in data.BasicTypesEntities) + { + entity.DateTime = new DateTime(entity.DateTime.Year, entity.DateTime.Month, entity.DateTime.Day, entity.DateTime.Hour, entity.DateTime.Minute, entity.DateTime.Second); + entity.DateTimeOffset = new DateTimeOffset(entity.DateTimeOffset.Year, entity.DateTimeOffset.Month, entity.DateTimeOffset.Day, entity.DateTimeOffset.Hour, entity.DateTimeOffset.Minute, entity.DateTimeOffset.Second, entity.DateTimeOffset.Offset); + entity.TimeOnly = new TimeOnly(entity.TimeOnly.Hour, entity.TimeOnly.Minute, entity.TimeOnly.Second); + entity.TimeSpan = new TimeSpan(entity.TimeSpan.Days, entity.TimeSpan.Hours, entity.TimeSpan.Minutes, entity.TimeSpan.Seconds); + if (entity.DateOnly.Year < 100) + { + entity.DateOnly = entity.DateOnly.AddYears(100); // Adjust for Jet's handling of DateOnly + } + if (entity.DateTime.Year < 100) + { + entity.DateTime = entity.DateTime.AddYears(100); // Adjust for Jet's handling of DateTime + } + if (entity.DateTimeOffset.Year < 100) + { + entity.DateTimeOffset = entity.DateTimeOffset.AddYears(100); // Adjust for Jet's handling of DateTimeOffset + } + } + + foreach (var entity in data.NullableBasicTypesEntities) + { + if (entity.DateTime.HasValue) + { + entity.DateTime = new DateTime(entity.DateTime.Value.Year, entity.DateTime.Value.Month, entity.DateTime.Value.Day, entity.DateTime.Value.Hour, entity.DateTime.Value.Minute, entity.DateTime.Value.Second); + } + if (entity.DateTimeOffset.HasValue) + { + entity.DateTimeOffset = new DateTimeOffset(entity.DateTimeOffset.Value.Year, entity.DateTimeOffset.Value.Month, entity.DateTimeOffset.Value.Day, entity.DateTimeOffset.Value.Hour, entity.DateTimeOffset.Value.Minute, entity.DateTimeOffset.Value.Second, entity.DateTimeOffset.Value.Offset); + } + if (entity.TimeOnly.HasValue) + { + entity.TimeOnly = new TimeOnly(entity.TimeOnly.Value.Hour, entity.TimeOnly.Value.Minute, entity.TimeOnly.Value.Second); + } + if (entity.TimeSpan.HasValue) + { + entity.TimeSpan = new TimeSpan(entity.TimeSpan.Value.Days, entity.TimeSpan.Value.Hours, entity.TimeSpan.Value.Minutes, entity.TimeSpan.Value.Seconds); + } + if (entity.DateOnly.HasValue && entity.DateOnly.Value.Year < 100) + { + entity.DateOnly = entity.DateOnly.Value.AddYears(100); // Adjust for Jet's handling of DateOnly + } + if (entity.DateTime.HasValue && entity.DateTime.Value.Year < 100) + { + entity.DateTime = entity.DateTime.Value.AddYears(100); // Adjust for Jet's handling of DateTime + } + if (entity.DateTimeOffset.HasValue && entity.DateTimeOffset.Value.Year < 100) + { + entity.DateTimeOffset = entity.DateTimeOffset.Value.AddYears(100); // Adjust for Jet's handling of DateTimeOffset + } + } + + context.AddRange(data.BasicTypesEntities); + context.AddRange(data.NullableBasicTypesEntities); + return context.SaveChangesAsync(); + } + + public override ISetSource GetExpectedData() + { + BasicTypesData result = (BasicTypesData)base.GetExpectedData(); + result.BasicTypesEntities.ForEach(b => + { + b.DateTime = new DateTime(b.DateTime.Year, b.DateTime.Month, b.DateTime.Day, b.DateTime.Hour, b.DateTime.Minute, b.DateTime.Second); + b.DateTimeOffset = new DateTimeOffset(b.DateTimeOffset.Year, b.DateTimeOffset.Month, b.DateTimeOffset.Day, b.DateTimeOffset.Hour, b.DateTimeOffset.Minute, b.DateTimeOffset.Second, b.DateTimeOffset.Offset); + b.TimeOnly = new TimeOnly(b.TimeOnly.Hour, b.TimeOnly.Minute, b.TimeOnly.Second); + b.TimeSpan = new TimeSpan(b.TimeSpan.Days, b.TimeSpan.Hours, b.TimeSpan.Minutes, b.TimeSpan.Seconds); + if (b.DateOnly.Year < 100) + { + b.DateOnly = b.DateOnly.AddYears(100); // Adjust for Jet's handling of DateOnly + } + if (b.DateTime.Year < 100) + { + b.DateTime = b.DateTime.AddYears(100); // Adjust for Jet's handling of DateTime + } + if (b.DateTimeOffset.Year < 100) + { + b.DateTimeOffset = b.DateTimeOffset.AddYears(100); // Adjust for Jet's handling of DateTimeOffset + } + }); + + result.NullableBasicTypesEntities.ForEach(b => + { + if (b.DateTime.HasValue) + { + b.DateTime = new DateTime(b.DateTime.Value.Year, b.DateTime.Value.Month, b.DateTime.Value.Day, b.DateTime.Value.Hour, b.DateTime.Value.Minute, b.DateTime.Value.Second); + } + if (b.DateTimeOffset.HasValue) + { + b.DateTimeOffset = new DateTimeOffset(b.DateTimeOffset.Value.Year, b.DateTimeOffset.Value.Month, b.DateTimeOffset.Value.Day, b.DateTimeOffset.Value.Hour, b.DateTimeOffset.Value.Minute, b.DateTimeOffset.Value.Second, b.DateTimeOffset.Value.Offset); + } + if (b.TimeOnly.HasValue) + { + b.TimeOnly = new TimeOnly(b.TimeOnly.Value.Hour, b.TimeOnly.Value.Minute, b.TimeOnly.Value.Second); + } + if (b.TimeSpan.HasValue) + { + b.TimeSpan = new TimeSpan(b.TimeSpan.Value.Days, b.TimeSpan.Value.Hours, b.TimeSpan.Value.Minutes, b.TimeSpan.Value.Seconds); + } + if (b.DateOnly.HasValue && b.DateOnly.Value.Year < 100) + { + b.DateOnly = b.DateOnly.Value.AddYears(100); // Adjust for Jet's handling of DateOnly + } + if (b.DateTime.HasValue && b.DateTime.Value.Year < 100) + { + b.DateTime = b.DateTime.Value.AddYears(100); // Adjust for Jet's handling of DateTime + } + if (b.DateTimeOffset.HasValue && b.DateTimeOffset.Value.Year < 100) + { + b.DateTimeOffset = b.DateTimeOffset.Value.AddYears(100); // Adjust for Jet's handling of DateTimeOffset + } + }); + + return result; + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/ByteArrayTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/ByteArrayTranslationsJetTest.cs new file mode 100644 index 00000000..45cb9d54 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/ByteArrayTranslationsJetTest.cs @@ -0,0 +1,115 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Translations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations; + +public class ByteArrayTranslationsJetTest : ByteArrayTranslationsTestBase +{ + public ByteArrayTranslationsJetTest(BasicTypesQueryJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Length(bool async) + { + await base.Length(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CAST(DATALENGTH([b].[ByteArray]) AS int) = 4 +"""); + } + + public override async Task Index(bool async) + { + await base.Index(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CAST(DATALENGTH([b].[ByteArray]) AS int) >= 3 AND CAST(SUBSTRING([b].[ByteArray], 2 + 1, 1) AS tinyint) = CAST(190 AS tinyint) +"""); + } + + public override async Task First(bool async) + { + await base.First(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CAST(DATALENGTH([b].[ByteArray]) AS int) >= 1 AND CAST(SUBSTRING([b].[ByteArray], 1, 1) AS tinyint) = CAST(222 AS tinyint) +"""); + } + + public override async Task Contains_with_constant(bool async) + { + await base.Contains_with_constant(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE INSTR(1, STRCONV(`b`.`ByteArray`, 64), 0x01, 0) > 0 +"""); + } + + public override async Task Contains_with_parameter(bool async) + { + await base.Contains_with_parameter(async); + + AssertSql( + """ +@someByte='1' (Size = 1) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE INSTR(1, STRCONV(`b`.`ByteArray`, 64), CHR(@someByte), 0) > 0 +"""); + } + + public override async Task Contains_with_column(bool async) + { + await base.Contains_with_column(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE INSTR(1, STRCONV(`b`.`ByteArray`, 64), CHR(`b`.`Byte`), 0) > 0 +"""); + } + + public override async Task SequenceEqual(bool async) + { + await base.SequenceEqual(async); + + AssertSql( + """ +@byteArrayParam='0xDEADBEEF' (Size = 510) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`ByteArray` = @byteArrayParam +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/EnumTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/EnumTranslationsJetTest.cs new file mode 100644 index 00000000..ff5e66ef --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/EnumTranslationsJetTest.cs @@ -0,0 +1,317 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Translations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations; + +public class EnumTranslationsJetTest : EnumTranslationsTestBase +{ + public EnumTranslationsJetTest(BasicTypesQueryJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + #region Equality + + public override async Task Equality_to_constant(bool async) + { + await base.Equality_to_constant(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Enum` = 0 +"""); + } + + public override async Task Equality_to_parameter(bool async) + { + await base.Equality_to_parameter(async); + + AssertSql( + """ +@basicEnum='0' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Enum` = @basicEnum +"""); + } + + public override async Task Equality_nullable_enum_to_constant(bool async) + { + await base.Equality_nullable_enum_to_constant(async); + + AssertSql( + """ +SELECT `n`.`Id`, `n`.`Bool`, `n`.`Byte`, `n`.`ByteArray`, `n`.`DateOnly`, `n`.`DateTime`, `n`.`DateTimeOffset`, `n`.`Decimal`, `n`.`Double`, `n`.`Enum`, `n`.`FlagsEnum`, `n`.`Float`, `n`.`Guid`, `n`.`Int`, `n`.`Long`, `n`.`Short`, `n`.`String`, `n`.`TimeOnly`, `n`.`TimeSpan` +FROM `NullableBasicTypesEntities` AS `n` +WHERE `n`.`Enum` = 0 +"""); + } + + public override async Task Equality_nullable_enum_to_parameter(bool async) + { + await base.Equality_nullable_enum_to_parameter(async); + + AssertSql( + """ +@basicEnum='0' + +SELECT `n`.`Id`, `n`.`Bool`, `n`.`Byte`, `n`.`ByteArray`, `n`.`DateOnly`, `n`.`DateTime`, `n`.`DateTimeOffset`, `n`.`Decimal`, `n`.`Double`, `n`.`Enum`, `n`.`FlagsEnum`, `n`.`Float`, `n`.`Guid`, `n`.`Int`, `n`.`Long`, `n`.`Short`, `n`.`String`, `n`.`TimeOnly`, `n`.`TimeSpan` +FROM `NullableBasicTypesEntities` AS `n` +WHERE `n`.`Enum` = @basicEnum +"""); + } + + public override async Task Equality_nullable_enum_to_null_constant(bool async) + { + await base.Equality_nullable_enum_to_null_constant(async); + + AssertSql( + """ +SELECT `n`.`Id`, `n`.`Bool`, `n`.`Byte`, `n`.`ByteArray`, `n`.`DateOnly`, `n`.`DateTime`, `n`.`DateTimeOffset`, `n`.`Decimal`, `n`.`Double`, `n`.`Enum`, `n`.`FlagsEnum`, `n`.`Float`, `n`.`Guid`, `n`.`Int`, `n`.`Long`, `n`.`Short`, `n`.`String`, `n`.`TimeOnly`, `n`.`TimeSpan` +FROM `NullableBasicTypesEntities` AS `n` +WHERE `n`.`Enum` IS NULL +"""); + } + + public override async Task Equality_nullable_enum_to_null_parameter(bool async) + { + await base.Equality_nullable_enum_to_null_parameter(async); + + AssertSql( + """ +SELECT `n`.`Id`, `n`.`Bool`, `n`.`Byte`, `n`.`ByteArray`, `n`.`DateOnly`, `n`.`DateTime`, `n`.`DateTimeOffset`, `n`.`Decimal`, `n`.`Double`, `n`.`Enum`, `n`.`FlagsEnum`, `n`.`Float`, `n`.`Guid`, `n`.`Int`, `n`.`Long`, `n`.`Short`, `n`.`String`, `n`.`TimeOnly`, `n`.`TimeSpan` +FROM `NullableBasicTypesEntities` AS `n` +WHERE `n`.`Enum` IS NULL +"""); + } + + public override async Task Equality_nullable_enum_to_nullable_parameter(bool async) + { + await base.Equality_nullable_enum_to_nullable_parameter(async); + + AssertSql( + """ +@basicEnum='0' (Nullable = true) + +SELECT `n`.`Id`, `n`.`Bool`, `n`.`Byte`, `n`.`ByteArray`, `n`.`DateOnly`, `n`.`DateTime`, `n`.`DateTimeOffset`, `n`.`Decimal`, `n`.`Double`, `n`.`Enum`, `n`.`FlagsEnum`, `n`.`Float`, `n`.`Guid`, `n`.`Int`, `n`.`Long`, `n`.`Short`, `n`.`String`, `n`.`TimeOnly`, `n`.`TimeSpan` +FROM `NullableBasicTypesEntities` AS `n` +WHERE `n`.`Enum` = @basicEnum +"""); + } + + #endregion Equality + + public override async Task Bitwise_and_enum_constant(bool async) + { + await base.Bitwise_and_enum_constant(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`FlagsEnum` BAND 1) > 0 +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`FlagsEnum` BAND 1) = 1 +"""); + } + + public override async Task Bitwise_and_integral_constant(bool async) + { + await base.Bitwise_and_integral_constant(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`FlagsEnum` BAND 8) = 8 +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (CLNG(`b`.`FlagsEnum`) BAND 8) = 8 +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (CINT(`b`.`FlagsEnum`) BAND 8) = 8 +"""); + } + + public override async Task Bitwise_and_nullable_enum_with_constant(bool async) + { + await base.Bitwise_and_nullable_enum_with_constant(async); + + AssertSql( + """ +SELECT `n`.`Id`, `n`.`Bool`, `n`.`Byte`, `n`.`ByteArray`, `n`.`DateOnly`, `n`.`DateTime`, `n`.`DateTimeOffset`, `n`.`Decimal`, `n`.`Double`, `n`.`Enum`, `n`.`FlagsEnum`, `n`.`Float`, `n`.`Guid`, `n`.`Int`, `n`.`Long`, `n`.`Short`, `n`.`String`, `n`.`TimeOnly`, `n`.`TimeSpan` +FROM `NullableBasicTypesEntities` AS `n` +WHERE (`n`.`FlagsEnum` BAND 8) > 0 +"""); + } + + public override async Task Where_bitwise_and_nullable_enum_with_null_constant(bool async) + { + await base.Where_bitwise_and_nullable_enum_with_null_constant(async); + + AssertSql( + """ +SELECT `n`.`Id`, `n`.`Bool`, `n`.`Byte`, `n`.`ByteArray`, `n`.`DateOnly`, `n`.`DateTime`, `n`.`DateTimeOffset`, `n`.`Decimal`, `n`.`Double`, `n`.`Enum`, `n`.`FlagsEnum`, `n`.`Float`, `n`.`Guid`, `n`.`Int`, `n`.`Long`, `n`.`Short`, `n`.`String`, `n`.`TimeOnly`, `n`.`TimeSpan` +FROM `NullableBasicTypesEntities` AS `n` +WHERE (`n`.`FlagsEnum` BAND NULL) > 0 +"""); + } + + public override async Task Where_bitwise_and_nullable_enum_with_non_nullable_parameter(bool async) + { + await base.Where_bitwise_and_nullable_enum_with_non_nullable_parameter(async); + + AssertSql( + """ +@flagsEnum='8' + +SELECT `n`.`Id`, `n`.`Bool`, `n`.`Byte`, `n`.`ByteArray`, `n`.`DateOnly`, `n`.`DateTime`, `n`.`DateTimeOffset`, `n`.`Decimal`, `n`.`Double`, `n`.`Enum`, `n`.`FlagsEnum`, `n`.`Float`, `n`.`Guid`, `n`.`Int`, `n`.`Long`, `n`.`Short`, `n`.`String`, `n`.`TimeOnly`, `n`.`TimeSpan` +FROM `NullableBasicTypesEntities` AS `n` +WHERE (`n`.`FlagsEnum` BAND @flagsEnum) > 0 +"""); + } + + public override async Task Where_bitwise_and_nullable_enum_with_nullable_parameter(bool async) + { + await base.Where_bitwise_and_nullable_enum_with_nullable_parameter(async); + + AssertSql( + """ +@flagsEnum='8' (Nullable = true) + +SELECT `n`.`Id`, `n`.`Bool`, `n`.`Byte`, `n`.`ByteArray`, `n`.`DateOnly`, `n`.`DateTime`, `n`.`DateTimeOffset`, `n`.`Decimal`, `n`.`Double`, `n`.`Enum`, `n`.`FlagsEnum`, `n`.`Float`, `n`.`Guid`, `n`.`Int`, `n`.`Long`, `n`.`Short`, `n`.`String`, `n`.`TimeOnly`, `n`.`TimeSpan` +FROM `NullableBasicTypesEntities` AS `n` +WHERE (`n`.`FlagsEnum` BAND @flagsEnum) > 0 +""", + // + """ +SELECT `n`.`Id`, `n`.`Bool`, `n`.`Byte`, `n`.`ByteArray`, `n`.`DateOnly`, `n`.`DateTime`, `n`.`DateTimeOffset`, `n`.`Decimal`, `n`.`Double`, `n`.`Enum`, `n`.`FlagsEnum`, `n`.`Float`, `n`.`Guid`, `n`.`Int`, `n`.`Long`, `n`.`Short`, `n`.`String`, `n`.`TimeOnly`, `n`.`TimeSpan` +FROM `NullableBasicTypesEntities` AS `n` +WHERE (`n`.`FlagsEnum` BAND NULL) > 0 +"""); + } + + public override async Task Bitwise_or(bool async) + { + await base.Bitwise_or(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`FlagsEnum` BOR 8) > 0 +"""); + } + + public override async Task Bitwise_projects_values_in_select(bool async) + { + await base.Bitwise_projects_values_in_select(async); + + AssertSql( + """ +SELECT TOP 1 CBOOL((`b`.`FlagsEnum` BAND 8) BXOR 8) BXOR TRUE AS `BitwiseTrue`, CBOOL((`b`.`FlagsEnum` BAND 8) BXOR 4) BXOR TRUE AS `BitwiseFalse`, `b`.`FlagsEnum` BAND 8 AS `BitwiseValue` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`FlagsEnum` BAND 8) = 8 +"""); + } + + public override async Task HasFlag(bool async) + { + await base.HasFlag(async); + +AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`FlagsEnum` BAND 8) = 8 +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`FlagsEnum` BAND 12) = 12 +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`FlagsEnum` BAND 8) = 8 +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`FlagsEnum` BAND 8) = 8 +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (8 BAND `b`.`FlagsEnum`) = `b`.`FlagsEnum` +""", + // + """ +SELECT TOP 1 CBOOL((`b`.`FlagsEnum` BAND 8) BXOR 8) BXOR TRUE AS `hasFlagTrue`, CBOOL((`b`.`FlagsEnum` BAND 4) BXOR 4) BXOR TRUE AS `hasFlagFalse` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`FlagsEnum` BAND 8) = 8 +"""); + } + + public override async Task HasFlag_with_non_nullable_parameter(bool async) + { + await base.HasFlag_with_non_nullable_parameter(async); + + AssertSql( + """ +@flagsEnum='8' +@flagsEnum='8' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`FlagsEnum` BAND @flagsEnum) = @flagsEnum +"""); + } + + public override async Task HasFlag_with_nullable_parameter(bool async) + { + await base.HasFlag_with_nullable_parameter(async); + + AssertSql( + """ +@flagsEnum='8' (Nullable = true) +@flagsEnum='8' (Nullable = true) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`FlagsEnum` BAND @flagsEnum) = @flagsEnum +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/GuidTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/GuidTranslationsJetTest.cs new file mode 100644 index 00000000..abb8b58b --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/GuidTranslationsJetTest.cs @@ -0,0 +1,69 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Translations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations; + +public class GuidTranslationsJetTest : GuidTranslationsTestBase +{ + public GuidTranslationsJetTest(BasicTypesQueryJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task New_with_constant(bool async) + { + await base.New_with_constant(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Guid` = {df36f493-463f-4123-83f9-6b135deeb7ba} +"""); + } + + public override async Task New_with_parameter(bool async) + { + await base.New_with_parameter(async); + + AssertSql( + """ +@p='df36f493-463f-4123-83f9-6b135deeb7ba' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Guid` = @p +"""); + } + + public override async Task ToString_projection(bool async) + { + await base.ToString_projection(async); + + AssertSql( + """ +SELECT CONVERT(varchar(36), [b].[Guid]) +FROM [BasicTypesEntities] AS [b] +"""); + } + + public override async Task NewGuid(bool async) + { + await base.NewGuid(async); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/MathTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/MathTranslationsJetTest.cs new file mode 100644 index 00000000..f438c0d4 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/MathTranslationsJetTest.cs @@ -0,0 +1,748 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Translations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations; + +public class MathTranslationsJetTest : MathTranslationsTestBase +{ + public MathTranslationsJetTest(BasicTypesQueryJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Abs_decimal(bool async) + { + await base.Abs_decimal(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ABS(`b`.`Decimal`) = 9.5 +"""); + } + + public override async Task Abs_int(bool async) + { + await base.Abs_int(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ABS(`b`.`Int`) = 9 +"""); + } + + public override async Task Abs_double(bool async) + { + await base.Abs_double(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ABS(`b`.`Double`) = 9.5 +"""); + } + + public override async Task Abs_float(bool async) + { + await base.Abs_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(ABS(`b`.`Float`) IS NULL, NULL, CDBL(ABS(`b`.`Float`))) = 9.5 +"""); + } + + public override async Task Ceiling(bool async) + { + await base.Ceiling(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(FIX(`b`.`Double`) = `b`.`Double`, FIX(`b`.`Double`), FIX(`b`.`Double`) + 1.0) = 9.0 +"""); + } + + public override async Task Ceiling_float(bool async) + { + await base.Ceiling_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(FIX(`b`.`Float`) = `b`.`Float`, FIX(`b`.`Float`), FIX(`b`.`Float`) + 1) = 9 +"""); + } + + public override async Task Floor_decimal(bool async) + { + await base.Floor_decimal(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE FIX(`b`.`Decimal`) = 8.0 +"""); + } + + public override async Task Floor_double(bool async) + { + await base.Floor_double(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE FIX(`b`.`Double`) = 8.0 +"""); + } + + public override async Task Floor_float(bool async) + { + await base.Floor_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE FIX(`b`.`Float`) = 8 +"""); + } + + public override async Task Power(bool async) + { + await base.Power(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CDBL(`b`.`Int`)^2.0 = 64.0 +"""); + } + + public override async Task Power_float(bool async) + { + await base.Power_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Float`^2 > 73 AND `b`.`Float`^2 < 74 +"""); + } + + public override async Task Round_decimal(bool async) + { + await base.Round_decimal(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ROUND(`b`.`Decimal`, 0) = 9.0 +""", + // + """ +SELECT ROUND(`b`.`Decimal`, 0) +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task Round_double(bool async) + { + await base.Round_double(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ROUND(`b`.`Double`, 0) = 9.0 +""", + // + """ +SELECT ROUND(`b`.`Double`, 0) +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task Round_float(bool async) + { + await base.Round_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CSNG(ROUND(`b`.`Float`, 0)) = 9 +""", + // + """ +SELECT CSNG(ROUND(`b`.`Float`, 0)) +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task Round_with_digits_decimal(bool async) + { + await base.Round_with_digits_decimal(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ROUND(`b`.`Decimal`, 1) = 255.1 +"""); + } + + public override async Task Round_with_digits_double(bool async) + { + await base.Round_with_digits_double(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ROUND(`b`.`Double`, 1) = 255.1 +"""); + } + + public override async Task Round_with_digits_float(bool async) + { + await base.Round_with_digits_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ROUND(CDBL(`b`.`Float`), 1) = 255.1 +"""); + } + + public override async Task Truncate_decimal(bool async) + { + await base.Truncate_decimal(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE ROUND([b].[Decimal], 0, 1) = 8.0 +""", + // + """ +SELECT ROUND([b].[Decimal], 0, 1) +FROM [BasicTypesEntities] AS [b] +"""); + } + + public override async Task Truncate_double(bool async) + { + await base.Truncate_double(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE ROUND([b].[Double], 0, 1) = 8.0E0 +""", + // + """ +SELECT ROUND([b].[Double], 0, 1) +FROM [BasicTypesEntities] AS [b] +"""); + } + + public override async Task Truncate_float(bool async) + { + await base.Truncate_float(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CAST(ROUND([b].[Float], 0, 1) AS real) = CAST(8 AS real) +""", + // + """ +SELECT CAST(ROUND([b].[Float], 0, 1) AS real) +FROM [BasicTypesEntities] AS [b] +"""); + } + + public override async Task Truncate_project_and_order_by_it_twice(bool async) + { + await base.Truncate_project_and_order_by_it_twice(async); + + AssertSql( + """ +SELECT ROUND([b].[Double], 0, 1) AS [A] +FROM [BasicTypesEntities] AS [b] +ORDER BY ROUND([b].[Double], 0, 1) +"""); + } + + // issue #16038 + // AssertSql( + // @"SELECT ROUND(CAST([o].[OrderID] AS float), 0, 1) AS [A] + //FROM [Orders] AS [o] + //WHERE [o].[OrderID] < 10250 + //ORDER BY [A]"); + public override async Task Truncate_project_and_order_by_it_twice2(bool async) + { + await base.Truncate_project_and_order_by_it_twice2(async); + + AssertSql( + """ +SELECT ROUND([b].[Double], 0, 1) AS [A] +FROM [BasicTypesEntities] AS [b] +ORDER BY ROUND([b].[Double], 0, 1) DESC +"""); + } + + // issue #16038 + // AssertSql( + // @"SELECT ROUND(CAST([o].[OrderID] AS float), 0, 1) AS [A] + //FROM [Orders] AS [o] + //WHERE [o].[OrderID] < 10250 + //ORDER BY [A] DESC"); + public override async Task Truncate_project_and_order_by_it_twice3(bool async) + { + await base.Truncate_project_and_order_by_it_twice3(async); + + AssertSql( + """ +SELECT ROUND([b].[Double], 0, 1) AS [A] +FROM [BasicTypesEntities] AS [b] +ORDER BY ROUND([b].[Double], 0, 1) DESC +"""); + } + + public override async Task Exp(bool async) + { + await base.Exp(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE EXP(`b`.`Double`) > 1.0 +"""); + } + + public override async Task Exp_float(bool async) + { + await base.Exp_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE EXP(`b`.`Float`) > 1 +"""); + } + + public override async Task Log(bool async) + { + await base.Log(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Double` > 0.0 AND LOG(`b`.`Double`) <> 0.0 +"""); + } + + public override async Task Log_float(bool async) + { + await base.Log_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Float` > 0 AND LOG(`b`.`Float`) <> 0 +"""); + } + + public override async Task Log_with_newBase(bool async) + { + await base.Log_with_newBase(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Double` > 0.0 AND (LOG(`b`.`Double`) / LOG(7.0)) <> 0.0 +"""); + } + + public override async Task Log_with_newBase_float(bool async) + { + await base.Log_with_newBase_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Float` > 0 AND (LOG(`b`.`Float`) / LOG(7)) <> 0 +"""); + } + + public override async Task Log10(bool async) + { + await base.Log10(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Double` > 0.0 AND (LOG(`b`.`Double`) / 2.30258509299405) <> 0.0 +"""); + } + + public override async Task Log10_float(bool async) + { + await base.Log10_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Float` > 0 AND (LOG(`b`.`Float`) / 2.302585) <> 0 +"""); + } + + public override async Task Log2(bool async) + => await AssertTranslationFailed(() => base.Log2(async)); + + public override async Task Sqrt(bool async) + { + await base.Sqrt(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Double` > 0.0 AND SQR(`b`.`Double`) > 0.0 +"""); + } + + public override async Task Sqrt_float(bool async) + { + await base.Sqrt_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Float` > 0 AND SQR(`b`.`Float`) > 0 +"""); + } + + public override async Task Sign(bool async) + { + await base.Sign(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE SGN(`b`.`Double`) > 0.0 +"""); + } + + public override async Task Sign_float(bool async) + { + await base.Sign_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE SGN(`b`.`Float`) > 0 +"""); + } + + public override Task Max(bool async) + => AssertTranslationFailed(() => base.Max(async)); + + public override Task Max_nested(bool async) + => AssertTranslationFailed(() => base.Max_nested(async)); + + public override Task Max_nested_twice(bool async) + => AssertTranslationFailed(() => base.Max_nested_twice(async)); + + public override Task Min(bool async) + => AssertTranslationFailed(() => base.Min(async)); + + public override Task Min_nested(bool async) + => AssertTranslationFailed(() => base.Min_nested(async)); + + public override Task Min_nested_twice(bool async) + => AssertTranslationFailed(() => base.Min_nested_twice(async)); + + public override async Task Degrees(bool async) + { + await base.Degrees(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`Double` * (180.0 / 3.14159265358979)) > 0.0 +"""); + } + + public override async Task Degrees_float(bool async) + { + await base.Degrees_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`Float` * (180 / 3.141593)) > 0 +"""); + } + + public override async Task Radians(bool async) + { + await base.Radians(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`Double` * (3.14159265358979 / 180.0)) > 0.0 +"""); + } + + public override async Task Radians_float(bool async) + { + await base.Radians_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`Float` * (3.141593 / 180)) > 0 +"""); + } + + #region Trigonometry + + public override async Task Acos(bool async) + { + await base.Acos(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Double` >= -1.0 AND `b`.`Double` <= 1.0 AND (1.5707963267949 + ATN(-`b`.`Double` / SQR(-(`b`.`Double` * `b`.`Double`) + 1.0))) > 1.0 +"""); + } + + public override async Task Acos_float(bool async) + { + await base.Acos_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Float` >= -1 AND `b`.`Float` <= 1 AND (1.5707963267949 + ATN(-`b`.`Float` / SQR(-(`b`.`Float` * `b`.`Float`) + 1))) > 0.0 +"""); + } + + public override async Task Acosh(bool async) + => await AssertTranslationFailed(() => base.Acosh(async)); + + public override async Task Asin(bool async) + { + await base.Asin(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE [b].[Double] >= -1.0E0 AND [b].[Double] <= 1.0E0 AND ASIN([b].[Double]) > -1.7976931348623157E+308 +"""); + } + + public override async Task Asin_float(bool async) + { + await base.Asin_float(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE [b].[Float] >= CAST(-1 AS real) AND [b].[Float] <= CAST(1 AS real) AND CAST(ASIN([b].[Float]) AS float) > -1.7976931348623157E+308 +"""); + } + + public override async Task Asinh(bool async) + => await AssertTranslationFailed(() => base.Asinh(async)); + + public override async Task Atan(bool async) + { + await base.Atan(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ATN(`b`.`Double`) > 0.0 +"""); + } + + public override async Task Atan_float(bool async) + { + await base.Atan_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ATN(`b`.`Float`) > 0 +"""); + } + + public override async Task Atanh(bool async) + => await AssertTranslationFailed(() => base.Atanh(async)); + + public override async Task Atan2(bool async) + { + await base.Atan2(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ATN(`b`.`Double` / 1.0) > 0.0 +"""); + } + + public override async Task Atan2_float(bool async) + { + await base.Atan2_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ATN(`b`.`Float` / 1) > 0 +"""); + } + + public override async Task Cos(bool async) + { + await base.Cos(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE COS(`b`.`Double`) > 0.0 +"""); + } + + public override async Task Cos_float(bool async) + { + await base.Cos_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE COS(`b`.`Float`) > 0 +"""); + } + + public override async Task Cosh(bool async) + => await AssertTranslationFailed(() => base.Cosh(async)); + + public override async Task Sin(bool async) + { + await base.Sin(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE SIN(`b`.`Double`) > 0.0 +"""); + } + + public override async Task Sin_float(bool async) + { + await base.Sin_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE SIN(`b`.`Float`) > 0 +"""); + } + + public override async Task Sinh(bool async) + => await AssertTranslationFailed(() => base.Sinh(async)); + + public override async Task Tan(bool async) + { + await base.Tan(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE TAN(`b`.`Double`) > 0.0 +"""); + } + + public override async Task Tan_float(bool async) + { + await base.Tan_float(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE TAN(`b`.`Float`) > 0 +"""); + } + + public override async Task Tanh(bool async) + => await AssertTranslationFailed(() => base.Tanh(async)); + + #endregion Trigonometry + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/MiscellaneousTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/MiscellaneousTranslationsJetTest.cs new file mode 100644 index 00000000..12a50c9d --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/MiscellaneousTranslationsJetTest.cs @@ -0,0 +1,783 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Translations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations; + +public class MiscellaneousTranslationsJetTest : MiscellaneousTranslationsRelationalTestBase +{ + public MiscellaneousTranslationsJetTest(BasicTypesQueryJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + #region Random + + public override async Task Random_on_EF_Functions(bool async) + { + await base.Random_on_EF_Functions(async); + + AssertSql( + """ +SELECT COUNT(*) +FROM `BasicTypesEntities` AS `b` +WHERE Rnd() >= 0.0 AND Rnd() < 1.0 +"""); + } + + public override async Task Random_Shared_Next_with_no_args(bool async) + { + await base.Random_Shared_Next_with_no_args(async); + + AssertSql(); + } + + public override async Task Random_Shared_Next_with_one_arg(bool async) + { + await base.Random_Shared_Next_with_one_arg(async); + + AssertSql(); + } + + public override async Task Random_Shared_Next_with_two_args(bool async) + { + await base.Random_Shared_Next_with_two_args(async); + + AssertSql(); + } + + public override async Task Random_new_Next_with_no_args(bool async) + { + await base.Random_new_Next_with_no_args(async); + + AssertSql(); + } + + public override async Task Random_new_Next_with_one_arg(bool async) + { + await base.Random_new_Next_with_one_arg(async); + + AssertSql(); + } + + public override async Task Random_new_Next_with_two_args(bool async) + { + await base.Random_new_Next_with_two_args(async); + + AssertSql(); + } + + #endregion Random + + #region Convert + + public override async Task Convert_ToBoolean(bool async) + { + await base.Convert_ToBoolean(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bit, [b].[Bool]) = CAST(1 AS bit) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bit, [b].[Byte]) = CAST(1 AS bit) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bit, [b].[Decimal]) = CAST(1 AS bit) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bit, [b].[Double]) = CAST(1 AS bit) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bit, [b].[Float]) = CAST(1 AS bit) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bit, [b].[Short]) = CAST(1 AS bit) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bit, [b].[Int]) = CAST(1 AS bit) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bit, [b].[Long]) = CAST(1 AS bit) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bit, [b].[Int]) = CAST(1 AS bit) +"""); + } + + public override async Task Convert_ToByte(bool async) + { + await base.Convert_ToByte(async); + +AssertSql( +""" +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(tinyint, [b].[Bool]) = CAST(1 AS tinyint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(tinyint, [b].[Byte]) = CAST(8 AS tinyint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE [b].[Decimal] >= 0.0 AND [b].[Decimal] <= 255.0 AND CONVERT(tinyint, [b].[Decimal]) = CAST(12 AS tinyint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE [b].[Double] >= 0.0E0 AND [b].[Double] <= 255.0E0 AND CONVERT(tinyint, [b].[Double]) = CAST(12 AS tinyint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE [b].[Float] >= CAST(0 AS real) AND [b].[Float] <= CAST(255 AS real) AND CONVERT(tinyint, [b].[Float]) = CAST(12 AS tinyint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE [b].[Short] >= CAST(0 AS smallint) AND [b].[Short] <= CAST(255 AS smallint) AND CONVERT(tinyint, [b].[Short]) = CAST(12 AS tinyint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE [b].[Int] >= 0 AND [b].[Int] <= 255 AND CONVERT(tinyint, [b].[Int]) = CAST(12 AS tinyint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE [b].[Long] >= CAST(0 AS bigint) AND [b].[Long] <= CAST(255 AS bigint) AND CONVERT(tinyint, [b].[Long]) = CAST(12 AS tinyint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE [b].[Int] >= 0 AND [b].[Int] <= 255 AND CONVERT(tinyint, CONVERT(nvarchar(max), [b].[Int])) = CAST(12 AS tinyint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE [b].[Int] >= 0 AND [b].[Int] <= 255 AND CONVERT(tinyint, [b].[Int]) = CAST(12 AS tinyint) +"""); + } + + public override async Task Convert_ToDecimal(bool async) + { + await base.Convert_ToDecimal(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(decimal(18, 2), [b].[Bool]) = 1.0 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(decimal(18, 2), [b].[Byte]) = 8.0 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(decimal(18, 2), [b].[Decimal]) = 8.6 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(decimal(18, 2), [b].[Double]) = 8.6 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(decimal(18, 2), [b].[Float]) = 8.6 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(decimal(18, 2), [b].[Short]) = 8.0 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(decimal(18, 2), [b].[Int]) = 8.0 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(decimal(18, 2), [b].[Long]) = 8.0 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(decimal(18, 2), CONVERT(nvarchar(max), [b].[Int])) = 8.0 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(decimal(18, 2), [b].[Int]) = 8.0 +"""); + } + + public override async Task Convert_ToDouble(bool async) + { + await base.Convert_ToDouble(async); + +AssertSql( +""" +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(float, [b].[Bool]) = 1.0E0 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(float, [b].[Byte]) = 8.0E0 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(float, [b].[Decimal]) = 8.5999999999999996E0 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(float, [b].[Double]) > 8.0E0 AND CONVERT(float, [b].[Double]) < 9.0E0 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(float, [b].[Float]) > 8.0E0 AND CONVERT(float, [b].[Float]) < 9.0E0 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(float, [b].[Short]) = 8.0E0 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(float, [b].[Int]) = 8.0E0 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(float, [b].[Long]) = 8.0E0 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(float, CONVERT(nvarchar(max), [b].[Int])) = 8.0E0 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(float, [b].[Int]) = 8.0E0 +"""); + } + + public override async Task Convert_ToInt16(bool async) + { + await base.Convert_ToInt16(async); + +AssertSql( +""" +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(smallint, [b].[Bool]) = CAST(1 AS smallint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(smallint, [b].[Byte]) = CAST(12 AS smallint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(smallint, [b].[Decimal]) = CAST(12 AS smallint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(smallint, [b].[Double]) = CAST(12 AS smallint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(smallint, [b].[Float]) = CAST(12 AS smallint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(smallint, [b].[Short]) = CAST(12 AS smallint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(smallint, [b].[Int]) = CAST(12 AS smallint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(smallint, [b].[Long]) = CAST(12 AS smallint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(smallint, CONVERT(nvarchar(max), [b].[Int])) = CAST(12 AS smallint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(smallint, [b].[Int]) = CAST(12 AS smallint) +"""); + } + + public override async Task Convert_ToInt32(bool async) + { + await base.Convert_ToInt32(async); + +AssertSql( +""" +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(int, [b].[Bool]) = 1 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(int, [b].[Byte]) = 12 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(int, [b].[Decimal]) = 12 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(int, [b].[Double]) = 12 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(int, [b].[Float]) = 12 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(int, [b].[Short]) = 12 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(int, [b].[Int]) = 12 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(int, [b].[Long]) = 12 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(int, CONVERT(nvarchar(max), [b].[Int])) = 12 +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(int, [b].[Int]) = 12 +"""); + } + + public override async Task Convert_ToInt64(bool async) + { + await base.Convert_ToInt64(async); + +AssertSql( +""" +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bigint, [b].[Bool]) = CAST(1 AS bigint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bigint, [b].[Byte]) = CAST(12 AS bigint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bigint, [b].[Decimal]) = CAST(12 AS bigint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bigint, [b].[Double]) = CAST(12 AS bigint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bigint, [b].[Float]) = CAST(12 AS bigint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bigint, [b].[Short]) = CAST(12 AS bigint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bigint, [b].[Int]) = CAST(12 AS bigint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bigint, [b].[Long]) = CAST(12 AS bigint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bigint, CONVERT(nvarchar(max), [b].[Int])) = CAST(12 AS bigint) +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(bigint, [b].[Int]) = CAST(12 AS bigint) +"""); + } + + public override async Task Convert_ToString(bool async) + { + await base.Convert_ToString(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(nvarchar(max), [b].[Bool]) <> N'' +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(nvarchar(max), [b].[Byte]) = N'8' +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(nvarchar(max), [b].[Decimal]) <> N'' +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(nvarchar(max), [b].[Double]) <> N'' +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(nvarchar(max), [b].[Float]) <> N'' +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(nvarchar(max), [b].[Short]) = N'8' +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(nvarchar(max), [b].[Int]) = N'8' +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(nvarchar(max), [b].[Long]) = N'8' +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(nvarchar(max), [b].[String]) = N'Seattle' +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(nvarchar(max), [b].[String]) = N'Seattle' +""", + // + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(nvarchar(max), [b].[DateTime]) LIKE N'%1998%' +"""); + } + + #endregion Convert + + #region Compare + + public override async Task Int_Compare_to_simple_zero(bool async) + { + await base.Int_Compare_to_simple_zero(async); + +AssertSql( + """ +@orderId='8' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` = @orderId +""", + // + """ +@orderId='8' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` <> @orderId +""", + // + """ +@orderId='8' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` > @orderId +""", + // + """ +@orderId='8' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` <= @orderId +""", + // + """ +@orderId='8' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` > @orderId +""", + // + """ +@orderId='8' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` <= @orderId +"""); + } + + public override async Task DateTime_Compare_to_simple_zero(bool async, bool compareTo) + { + await base.DateTime_Compare_to_simple_zero(async, compareTo); + + AssertSql( + """ +@dateTime='1998-05-04T15:30:10.0000000' (DbType = DateTime) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`DateTime` = CDATE(@dateTime) +""", + // + """ +@dateTime='1998-05-04T15:30:10.0000000' (DbType = DateTime) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`DateTime` <> CDATE(@dateTime) +""", + // + """ +@dateTime='1998-05-04T15:30:10.0000000' (DbType = DateTime) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`DateTime` > CDATE(@dateTime) +""", + // + """ +@dateTime='1998-05-04T15:30:10.0000000' (DbType = DateTime) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`DateTime` <= CDATE(@dateTime) +""", + // + """ +@dateTime='1998-05-04T15:30:10.0000000' (DbType = DateTime) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`DateTime` > CDATE(@dateTime) +""", + // + """ +@dateTime='1998-05-04T15:30:10.0000000' (DbType = DateTime) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`DateTime` <= CDATE(@dateTime) +"""); + } + + public override async Task TimeSpan_Compare_to_simple_zero(bool async, bool compareTo) + { + await base.TimeSpan_Compare_to_simple_zero(async, compareTo); + + AssertSql( + """ +@timeSpan='01:02:03' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`TimeSpan` = @timeSpan +""", + // + """ +@timeSpan='01:02:03' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`TimeSpan` <> @timeSpan +""", + // + """ +@timeSpan='01:02:03' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`TimeSpan` > @timeSpan +""", + // + """ +@timeSpan='01:02:03' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`TimeSpan` <= @timeSpan +""", + // + """ +@timeSpan='01:02:03' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`TimeSpan` > @timeSpan +""", + // + """ +@timeSpan='01:02:03' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`TimeSpan` <= @timeSpan +"""); + } + + #endregion Compare + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/ArithmeticOperatorTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/ArithmeticOperatorTranslationsJetTest.cs new file mode 100644 index 00000000..825a265f --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/ArithmeticOperatorTranslationsJetTest.cs @@ -0,0 +1,87 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Translations.Operators; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Operators; + +public class ArithmeticOperatorTranslationsJetTest : ArithmeticOperatorTranslationsTestBase +{ + public ArithmeticOperatorTranslationsJetTest(BasicTypesQueryJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Add(bool async) + { + await base.Add(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`Int` + 2) = 10 +"""); + } + + public override async Task Subtract(bool async) + { + await base.Subtract(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`Int` - 3) = 5 +"""); + } + + public override async Task Multiply(bool async) + { + await base.Multiply(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`Int` * 2) = 16 +"""); + } + + public override async Task Modulo(bool async) + { + await base.Modulo(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`Int` MOD 3) = 2 +"""); + } + + public override async Task Minus(bool async) + { + await base.Minus(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE -`b`.`Int` = -8 +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/BitwiseOperatorTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/BitwiseOperatorTranslationsJetTest.cs new file mode 100644 index 00000000..0b1a38c9 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/BitwiseOperatorTranslationsJetTest.cs @@ -0,0 +1,217 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Translations.Operators; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Operators; + +public class BitwiseOperatorTranslationsJetTest : BitwiseOperatorTranslationsTestBase +{ + public BitwiseOperatorTranslationsJetTest(BasicTypesQueryJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Or(bool async) + { + await base.Or(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (CLNG(`b`.`Int`) BOR `b`.`Long`) = 7 +""", + // + """ +SELECT CLNG(`b`.`Int`) BOR `b`.`Long` +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task Or_over_boolean(bool async) + { + await base.Or_over_boolean(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` = 12 OR `b`.`String` = 'Seattle' +""", + // + """ +SELECT IIF(`b`.`Int` = 12 OR `b`.`String` = 'Seattle', TRUE, FALSE) +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task Or_multiple(bool async) + { + await base.Or_multiple(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (CLNG(`b`.`Int` BOR `b`.`Short`) BOR `b`.`Long`) = 7 +"""); + } + + public override async Task And(bool async) + { + await base.And(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`Int` BAND `b`.`Short`) = 2 +""", + // + """ +SELECT `b`.`Int` BAND `b`.`Short` +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task And_over_boolean(bool async) + { + await base.And_over_boolean(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` = 8 AND `b`.`String` = 'Seattle' +""", + // + """ +SELECT IIF(`b`.`Int` = 8 AND `b`.`String` = 'Seattle', TRUE, FALSE) +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task Xor(bool async) + { + await base.Xor(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE [b].[Int] ^ [b].[Short] = 1 +""", + // + """ +SELECT [b].[Int] ^ [b].[Short] +FROM [BasicTypesEntities] AS [b] +"""); + } + + public override async Task Xor_over_boolean(bool async) + { + await base.Xor_over_boolean(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE ~CAST([b].[Int] ^ [b].[Short] AS bit) ^ CASE + WHEN [b].[String] = N'Seattle' THEN CAST(1 AS bit) + ELSE CAST(0 AS bit) +END = CAST(1 AS bit) +"""); + } + + public override async Task Complement(bool async) + { + await base.Complement(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (BNOT`b`.`Int`) = -9 +"""); + } + + public override async Task And_or_over_boolean(bool async) + { + await base.And_or_over_boolean(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`Int` = 12 AND `b`.`Short` = 12) OR `b`.`String` = 'Seattle' +"""); + } + + public override async Task Or_with_logical_or(bool async) + { + await base.Or_with_logical_or(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` = 12 OR `b`.`Short` = 12 OR `b`.`String` = 'Seattle' +"""); + } + + public override async Task And_with_logical_and(bool async) + { + await base.And_with_logical_and(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` = 8 AND `b`.`Short` = 8 AND `b`.`String` = 'Seattle' +"""); + } + + public override async Task Or_with_logical_and(bool async) + { + await base.Or_with_logical_and(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`Int` = 8 OR `b`.`Short` = 9) AND `b`.`String` = 'Seattle' +"""); + } + + public override async Task And_with_logical_or(bool async) + { + await base.And_with_logical_or(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`Int` = 12 AND `b`.`Short` = 12) OR `b`.`String` = 'Seattle' +"""); + } + + public override Task Left_shift(bool async) + => AssertTranslationFailed(() => base.Left_shift(async)); + + public override Task Right_shift(bool async) + => AssertTranslationFailed(() => base.Right_shift(async)); + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/ComparisonOperatorTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/ComparisonOperatorTranslationsJetTest.cs new file mode 100644 index 00000000..69895304 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/ComparisonOperatorTranslationsJetTest.cs @@ -0,0 +1,99 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Translations.Operators; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Operators; + +public class ComparisonOperatorTranslationsJetTest : ComparisonOperatorTranslationsTestBase +{ + public ComparisonOperatorTranslationsJetTest(BasicTypesQueryJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Equal(bool async) + { + await base.Equal(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` = 8 +"""); + } + + public override async Task NotEqual(bool async) + { + await base.NotEqual(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` <> 8 +"""); + } + + public override async Task GreaterThan(bool async) + { + await base.GreaterThan(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` > 8 +"""); + } + + public override async Task GreaterThanOrEqual(bool async) + { + await base.GreaterThanOrEqual(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` >= 8 +"""); + } + + public override async Task LessThan(bool async) + { + await base.LessThan(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` < 8 +"""); + } + + public override async Task LessThanOrEqual(bool async) + { + await base.LessThanOrEqual(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` <= 8 +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/LogicalOperatorTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/LogicalOperatorTranslationsJetTest.cs new file mode 100644 index 00000000..9337a6cb --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/LogicalOperatorTranslationsJetTest.cs @@ -0,0 +1,99 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Translations.Operators; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Operators; + +public class LogicalOperatorTranslationsJetTest : LogicalOperatorTranslationsTestBase +{ + public LogicalOperatorTranslationsJetTest(BasicTypesQueryJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task And(bool async) + { + await base.And(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` = 8 AND `b`.`String` = 'Seattle' +"""); + } + + public override async Task And_with_bool_property(bool async) + { + await base.And_with_bool_property(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Bool` = TRUE AND `b`.`String` = 'Seattle' +"""); + } + + public override async Task Or(bool async) + { + await base.Or(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` = 999 OR `b`.`String` = 'Seattle' +"""); + } + + public override async Task Or_with_bool_property(bool async) + { + await base.Or_with_bool_property(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Bool` = TRUE OR `b`.`String` = 'Seattle' +"""); + } + + public override async Task Not(bool async) + { + await base.Not(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Int` <> 999 +"""); + } + + public override async Task Not_with_bool_property(bool async) + { + await base.Not_with_bool_property(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`Bool` = FALSE +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/MiscellaneousOperatorTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/MiscellaneousOperatorTranslationsJetTest.cs new file mode 100644 index 00000000..794bdf8b --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/MiscellaneousOperatorTranslationsJetTest.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Translations.Operators; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Operators; + +public class MiscellaneousOperatorTranslationsJetTest : MiscellaneousOperatorTranslationsTestBase +{ + public MiscellaneousOperatorTranslationsJetTest(BasicTypesQueryJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Conditional(bool async) + { + await base.Conditional(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(`b`.`Int` = 8, `b`.`String`, 'Foo') = 'Seattle' +"""); + } + + public override async Task Coalesce(bool async) + { + await base.Coalesce(async); + + AssertSql( + """ +SELECT `n`.`Id`, `n`.`Bool`, `n`.`Byte`, `n`.`ByteArray`, `n`.`DateOnly`, `n`.`DateTime`, `n`.`DateTimeOffset`, `n`.`Decimal`, `n`.`Double`, `n`.`Enum`, `n`.`FlagsEnum`, `n`.`Float`, `n`.`Guid`, `n`.`Int`, `n`.`Long`, `n`.`Short`, `n`.`String`, `n`.`TimeOnly`, `n`.`TimeSpan` +FROM `NullableBasicTypesEntities` AS `n` +WHERE IIF(`n`.`String` IS NULL, 'Unknown', `n`.`String`) = 'Seattle' +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/StringTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/StringTranslationsJetTest.cs new file mode 100644 index 00000000..7b4d05fb --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/StringTranslationsJetTest.cs @@ -0,0 +1,1631 @@ +using Microsoft.EntityFrameworkCore.Query.Translations; +using Microsoft.EntityFrameworkCore.TestModels.BasicTypesModel; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System; +using System.Linq; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations; + +public class StringTranslationsJetTest : StringTranslationsRelationalTestBase +{ + public StringTranslationsJetTest(BasicTypesQueryJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + protected override bool IsCaseSensitive + => false; + + #region Equals + + public override async Task Equals(bool async) + { + await base.Equals(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` = 'seattle' +"""); + } + + public override async Task Equals_with_OrdinalIgnoreCase(bool async) + { + await base.Equals_with_OrdinalIgnoreCase(async); + + AssertSql(); + } + + public override async Task Equals_with_Ordinal(bool async) + { + await base.Equals_with_Ordinal(async); + + AssertSql(); + } + + public override async Task Static_Equals(bool async) + { + await base.Static_Equals(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` = 'seattle' +"""); + } + + public override async Task Static_Equals_with_OrdinalIgnoreCase(bool async) + { + await base.Static_Equals_with_OrdinalIgnoreCase(async); + + AssertSql(); + } + + public override async Task Static_Equals_with_Ordinal(bool async) + { + await base.Static_Equals_with_Ordinal(async); + + AssertSql(); + } + + #endregion Equals + + #region Miscellaneous + + public override async Task Length(bool async) + { + await base.Length(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) = 7 +"""); + } + + public override async Task ToUpper(bool async) + { + await base.ToUpper(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE UCASE(`b`.`String`) = 'SEATTLE' +""", + // + """ +SELECT UCASE(`b`.`String`) +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task ToLower(bool async) + { + await base.ToLower(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE LCASE(`b`.`String`) = 'seattle' +""", + // + """ +SELECT LCASE(`b`.`String`) +FROM `BasicTypesEntities` AS `b` +"""); + } + + #endregion Miscellaneous + + #region IndexOf + + public override async Task IndexOf(bool async) + { + await base.IndexOf(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (INSTR(1, `b`.`String`, 'Eattl', 1) - 1) <> -1 +"""); + } + + public override async Task IndexOf_Char(bool async) + { + await base.IndexOf_Char(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (INSTR(1, `b`.`String`, 'e', 1) - 1) <> -1 +"""); + } + + public override async Task IndexOf_with_empty_string(bool async) + { + await base.IndexOf_with_empty_string(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task IndexOf_with_one_parameter_arg(bool async) + { + await base.IndexOf_with_one_parameter_arg(async); + + AssertSql( + """ +@pattern='Eattl' (Size = 255) +@pattern='Eattl' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (INSTR(1, `b`.`String`, @pattern, 1) - IIF(@pattern = '', 0, 1)) = 1 +"""); + + } + + public override async Task IndexOf_with_one_parameter_arg_char(bool async) + { + await base.IndexOf_with_one_parameter_arg_char(async); + + AssertSql( + """ +@pattern='e' (Size = 1) (DbType = String) +@pattern='e' (Size = 1) (DbType = String) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (INSTR(1, `b`.`String`, @pattern, 1) - IIF(@pattern = '', 0, 1)) = 1 +"""); + + } + + public override async Task IndexOf_with_constant_starting_position(bool async) + { + await base.IndexOf_with_constant_starting_position(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) > 2 AND (INSTR(3, `b`.`String`, 'e', 1) - 1) = 6 +"""); + } + + public override async Task IndexOf_with_constant_starting_position_char(bool async) + { + await base.IndexOf_with_constant_starting_position_char(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) > 2 AND (INSTR(3, `b`.`String`, 'e', 1) - 1) = 6 +"""); + } + + public override async Task IndexOf_with_parameter_starting_position(bool async) + { + await base.IndexOf_with_parameter_starting_position(async); + + AssertSql( + """ +@start='2' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) > 2 AND (INSTR(@start + 1, `b`.`String`, 'E', 1) - 1) = 6 +"""); + } + + public override async Task IndexOf_with_parameter_starting_position_char(bool async) + { + await base.IndexOf_with_parameter_starting_position_char(async); + + AssertSql( + """ +@start='2' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) > 2 AND (INSTR(@start + 1, `b`.`String`, 'e', 1) - 1) = 6 +"""); + } + + public override async Task IndexOf_after_ToString(bool async) + { + await base.IndexOf_after_ToString(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (INSTR(1, (`b`.`Int` & ''), '55', 1) - 1) = 1 +"""); + } + + public override async Task IndexOf_over_ToString(bool async) + { + await base.IndexOf_over_ToString(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (INSTR(1, '12559', (`b`.`Int` & ''), 1) - IIF((`b`.`Int` & '') = '', 0, 1)) = 1 +"""); + } + + #endregion IndexOf + + #region Replace + + public override async Task Replace(bool async) + { + await base.Replace(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE REPLACE(`b`.`String`, 'sea', 'rea') = 'reattle' +"""); + } + + public override async Task Replace_Char(bool async) + { + await base.Replace_Char(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE REPLACE(`b`.`String`, 'S', 'R') = 'Reattle' +"""); + } + + public override async Task Replace_with_empty_string(bool async) + { + await base.Replace_with_empty_string(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <> '' AND REPLACE(`b`.`String`, `b`.`String`, '') = '' +"""); + } + + public override async Task Replace_using_property_arguments(bool async) + { + await base.Replace_using_property_arguments(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <> '' AND REPLACE(`b`.`String`, `b`.`String`, (`b`.`Int` & '')) = (`b`.`Int` & '') +"""); + } + + #endregion Replace + + #region Substring + + public override async Task Substring(bool async) + { + await base.Substring(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) >= 3 AND MID(`b`.`String`, 1 + 1, 2) = 'ea' +"""); + } + + public override async Task Substring_with_one_arg_with_zero_startIndex(bool async) + { + await base.Substring_with_one_arg_with_zero_startIndex(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE MID(`b`.`String`, 0 + 1, LEN(`b`.`String`)) = 'Seattle' +"""); + } + + public override async Task Substring_with_one_arg_with_constant(bool async) + { + await base.Substring_with_one_arg_with_constant(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) >= 1 AND MID(`b`.`String`, 1 + 1, LEN(`b`.`String`)) = 'eattle' +"""); + } + + public override async Task Substring_with_one_arg_with_parameter(bool async) + { + await base.Substring_with_one_arg_with_parameter(async); + + AssertSql( + """ +@start='2' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) >= 2 AND MID(`b`.`String`, @start + 1, LEN(`b`.`String`)) = 'attle' +"""); + } + + public override async Task Substring_with_two_args_with_zero_startIndex(bool async) + { + await base.Substring_with_two_args_with_zero_startIndex(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) >= 3 AND MID(`b`.`String`, 0 + 1, 3) = 'Sea' +"""); + } + + public override async Task Substring_with_two_args_with_zero_length(bool async) + { + await base.Substring_with_two_args_with_zero_length(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) >= 2 AND MID(`b`.`String`, 2 + 1, 0) = '' +"""); + } + + public override async Task Substring_with_two_args_with_parameter(bool async) + { + await base.Substring_with_two_args_with_parameter(async); + + AssertSql( + """ +@start='2' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(LEN(`b`.`String`) IS NULL, NULL, CLNG(LEN(`b`.`String`))) >= 5 AND MID(`b`.`String`, @start + 1, 3) = 'att' +"""); + } + + public override async Task Substring_with_two_args_with_IndexOf(bool async) + { + await base.Substring_with_two_args_with_IndexOf(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE [b].[String] LIKE N'%a%' AND SUBSTRING([b].[String], (CAST(CHARINDEX(N'a', [b].[String]) AS int) - 1) + 1, 3) = N'att' +"""); + } + + #endregion Substring + + #region IsNullOrEmpty/Whitespace + + public override async Task IsNullOrEmpty(bool async) + { + await base.IsNullOrEmpty(async); + + AssertSql( + """ +SELECT `n`.`Id`, `n`.`Bool`, `n`.`Byte`, `n`.`ByteArray`, `n`.`DateOnly`, `n`.`DateTime`, `n`.`DateTimeOffset`, `n`.`Decimal`, `n`.`Double`, `n`.`Enum`, `n`.`FlagsEnum`, `n`.`Float`, `n`.`Guid`, `n`.`Int`, `n`.`Long`, `n`.`Short`, `n`.`String`, `n`.`TimeOnly`, `n`.`TimeSpan` +FROM `NullableBasicTypesEntities` AS `n` +WHERE `n`.`String` IS NULL OR (`n`.`String` LIKE '') +""", + // + """ +SELECT IIF(`n`.`String` IS NULL OR (`n`.`String` LIKE ''), TRUE, FALSE) +FROM `NullableBasicTypesEntities` AS `n` +"""); + } + + public override async Task IsNullOrEmpty_negated(bool async) + { + await base.IsNullOrEmpty_negated(async); + + AssertSql( + """ +SELECT `n`.`Id`, `n`.`Bool`, `n`.`Byte`, `n`.`ByteArray`, `n`.`DateOnly`, `n`.`DateTime`, `n`.`DateTimeOffset`, `n`.`Decimal`, `n`.`Double`, `n`.`Enum`, `n`.`FlagsEnum`, `n`.`Float`, `n`.`Guid`, `n`.`Int`, `n`.`Long`, `n`.`Short`, `n`.`String`, `n`.`TimeOnly`, `n`.`TimeSpan` +FROM `NullableBasicTypesEntities` AS `n` +WHERE `n`.`String` IS NOT NULL AND `n`.`String` NOT LIKE '' +""", + // + """ +SELECT IIF(`n`.`String` IS NOT NULL AND `n`.`String` NOT LIKE '', TRUE, FALSE) +FROM `NullableBasicTypesEntities` AS `n` +"""); + } + + public override async Task IsNullOrWhiteSpace(bool async) + { + await base.IsNullOrWhiteSpace(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` = '' +"""); + } + + #endregion IsNullOrEmpty/Whitespace + + #region StartsWith + + public override async Task StartsWith_Literal(bool async) + { + await base.StartsWith_Literal(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` LIKE 'se%' +"""); + } + + public override async Task StartsWith_Literal_Char(bool async) + { + await base.StartsWith_Literal_Char(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` LIKE 'S%' +"""); + } + + public override async Task StartsWith_Parameter(bool async) + { + await base.StartsWith_Parameter(async); + + AssertSql( + """ +@pattern_startswith='se%' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` LIKE @pattern_startswith +"""); + } + + public override async Task StartsWith_Parameter_Char(bool async) + { + await base.StartsWith_Parameter_Char(async); + + AssertSql( + """ +@pattern_startswith='S%' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` LIKE @pattern_startswith +"""); + } + + public override async Task StartsWith_Column(bool async) + { + await base.StartsWith_Column(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE LEFT(`b`.`String`, IIF(LEN(`b`.`String`) IS NULL, 0, LEN(`b`.`String`))) = `b`.`String` +"""); + } + + public override async Task StartsWith_with_StringComparison_Ordinal(bool async) + { + await base.StartsWith_with_StringComparison_Ordinal(async); + + AssertSql(); + } + + public override async Task StartsWith_with_StringComparison_OrdinalIgnoreCase(bool async) + { + await base.StartsWith_with_StringComparison_OrdinalIgnoreCase(async); + + AssertSql(); + } + + public override async Task StartsWith_with_StringComparison_unsupported(bool async) + { + await base.StartsWith_with_StringComparison_unsupported(async); + + AssertSql(); + } + + #endregion StartsWith + + #region EndsWith + + public override async Task EndsWith_Literal(bool async) + { + await base.EndsWith_Literal(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` LIKE '%Le' +"""); + } + + public override async Task EndsWith_Literal_Char(bool async) + { + await base.EndsWith_Literal_Char(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` LIKE '%e' +"""); + } + + public override async Task EndsWith_Parameter(bool async) + { + await base.EndsWith_Parameter(async); + + AssertSql( + """ +@pattern_endswith='%LE' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` LIKE @pattern_endswith +"""); + } + + public override async Task EndsWith_Parameter_Char(bool async) + { + await base.EndsWith_Parameter_Char(async); + + AssertSql( + """ +@pattern_endswith='%e' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` LIKE @pattern_endswith +"""); + } + + public override async Task EndsWith_Column(bool async) + { + // SQL Server trims trailing whitespace for length calculations, making our EndsWith() column translation not work reliably in that + // case + await AssertQuery( + async, + ss => ss.Set().Where(b => b.String == "Seattle" && b.String.EndsWith(b.String))); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` = 'Seattle' AND RIGHT(`b`.`String`, IIF(LEN(`b`.`String`) IS NULL, 0, LEN(`b`.`String`))) = `b`.`String` +"""); + } + + public override async Task EndsWith_with_StringComparison_Ordinal(bool async) + { + await base.EndsWith_with_StringComparison_Ordinal(async); + + AssertSql(); + } + + public override async Task EndsWith_with_StringComparison_OrdinalIgnoreCase(bool async) + { + await base.EndsWith_with_StringComparison_OrdinalIgnoreCase(async); + + AssertSql(); + } + + public override async Task EndsWith_with_StringComparison_unsupported(bool async) + { + await base.EndsWith_with_StringComparison_unsupported(async); + + AssertSql(); + } + + #endregion EndsWith + + #region Contains + + public override async Task Contains_Literal(bool async) + { + await AssertQuery( + async, + ss => ss.Set().Where(c => c.String.Contains("eattl")), // SQL Server is case-insensitive by default + ss => ss.Set().Where(c => c.String.Contains("eattl", StringComparison.OrdinalIgnoreCase))); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` LIKE '%eattl%' +"""); + } + + public override async Task Contains_Literal_Char(bool async) + { + await AssertQuery( + async, + ss => ss.Set().Where(c => c.String.Contains('e'))); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` LIKE '%e%' +"""); + } + + public override async Task Contains_Column(bool async) + { + await base.Contains_Column(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE INSTR(1, `b`.`String`, `b`.`String`, 1) > 0 OR (`b`.`String` LIKE '') +""", + // + """ +SELECT IIF(INSTR(1, `b`.`String`, `b`.`String`, 1) > 0 OR (`b`.`String` LIKE ''), TRUE, FALSE) +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task Contains_negated(bool async) + { + await base.Contains_negated(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` NOT LIKE '%Eattle%' +""", + // + """ +SELECT IIF(`b`.`String` NOT LIKE '%Eattle%', TRUE, FALSE) +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task Contains_with_StringComparison_Ordinal(bool async) + { + await base.Contains_with_StringComparison_Ordinal(async); + + AssertSql(); + } + + public override async Task Contains_with_StringComparison_OrdinalIgnoreCase(bool async) + { + await base.Contains_with_StringComparison_OrdinalIgnoreCase(async); + + AssertSql(); + } + + public override async Task Contains_with_StringComparison_unsupported(bool async) + { + await base.Contains_with_StringComparison_unsupported(async); + + AssertSql(); + } + + public override async Task Contains_constant_with_whitespace(bool async) + { + await base.Contains_constant_with_whitespace(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` LIKE '% %' +"""); + } + + public override async Task Contains_parameter_with_whitespace(bool async) + { + await base.Contains_parameter_with_whitespace(async); + + AssertSql( + """ +@pattern_contains='% %' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` LIKE @pattern_contains +"""); + } + + #endregion Contains + + #region TrimStart + + public override async Task TrimStart_without_arguments(bool async) + { + await base.TrimStart_without_arguments(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE LTRIM(`b`.`String`) = 'Boston ' +"""); + } + + public override Task TrimStart_with_char_argument(bool async) + => AssertTranslationFailed(() => base.TrimStart_with_char_argument(async)); + + public override Task TrimStart_with_char_array_argument(bool async) + => AssertTranslationFailed(() => base.TrimStart_with_char_array_argument(async)); + + #endregion TrimStart + + #region TrimEnd + + public override async Task TrimEnd_without_arguments(bool async) + { + await base.TrimEnd_without_arguments(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE RTRIM(`b`.`String`) = ' Boston' +"""); + } + + public override Task TrimEnd_with_char_argument(bool async) + => AssertTranslationFailed(() => base.TrimEnd_with_char_argument(async)); + + public override Task TrimEnd_with_char_array_argument(bool async) + => AssertTranslationFailed(() => base.TrimEnd_with_char_array_argument(async)); + + #endregion TrimEnd + + #region Trim + + public override async Task Trim_without_argument_in_predicate(bool async) + { + await base.Trim_without_argument_in_predicate(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE TRIM(`b`.`String`) = 'Boston' +"""); + } + + public override async Task Trim_with_char_argument_in_predicate(bool async) + { + // String.Trim with parameters. Issue #22927. + await AssertTranslationFailed(() => base.Trim_with_char_argument_in_predicate(async)); + + AssertSql(); + } + + public override async Task Trim_with_char_array_argument_in_predicate(bool async) + { + // String.Trim with parameters. Issue #22927. + await AssertTranslationFailed(() => base.Trim_with_char_array_argument_in_predicate(async)); + + AssertSql(); + } + + #endregion Trim + + #region Compare + + public override async Task Compare_simple_zero(bool async) + { + await base.Compare_simple_zero(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` = 'seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <> 'seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` > 'seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <= 'seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` > 'seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <= 'seattle' +"""); + } + + public override async Task Compare_simple_one(bool async) + { + await base.Compare_simple_one(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` > 'Seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` < 'Seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <= 'Seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <= 'Seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` >= 'Seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` >= 'Seattle' +"""); + } + + public override async Task Compare_with_parameter(bool async) + { + await base.Compare_with_parameter(async); + + AssertSql( + """ +@basicTypeEntity_String='Seattle' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` > @basicTypeEntity_String +""", + // + """ +@basicTypeEntity_String='Seattle' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` < @basicTypeEntity_String +""", + // + """ +@basicTypeEntity_String='Seattle' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <= @basicTypeEntity_String +""", + // + """ +@basicTypeEntity_String='Seattle' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <= @basicTypeEntity_String +""", + // + """ +@basicTypeEntity_String='Seattle' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` >= @basicTypeEntity_String +""", + // + """ +@basicTypeEntity_String='Seattle' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` >= @basicTypeEntity_String +"""); + } + + public override async Task Compare_simple_more_than_one(bool async) + { + await base.Compare_simple_more_than_one(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(`b`.`String` = 'Seattle', 0, IIF(`b`.`String` > 'Seattle', 1, IIF(`b`.`String` < 'Seattle', -1, NULL))) = 42 +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(`b`.`String` = 'Seattle', 0, IIF(`b`.`String` > 'Seattle', 1, IIF(`b`.`String` < 'Seattle', -1, NULL))) > 42 +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE 42 > IIF(`b`.`String` = 'Seattle', 0, IIF(`b`.`String` > 'Seattle', 1, IIF(`b`.`String` < 'Seattle', -1, NULL))) +"""); + } + + public override async Task Compare_nested(bool async) + { + await base.Compare_nested(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` = ('M' & `b`.`String`) +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <> MID(`b`.`String`, 0 + 1, 0) +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` > REPLACE('Seattle', 'Sea', `b`.`String`) +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <= ('M' & `b`.`String`) +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` > MID(`b`.`String`, 0 + 1, 0) +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` < REPLACE('Seattle', 'Sea', `b`.`String`) +"""); + } + + public override async Task Compare_multi_predicate(bool async) + { + await base.Compare_multi_predicate(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` >= 'Seattle' AND `b`.`String` < 'Toronto' +"""); + } + + public override async Task CompareTo_simple_zero(bool async) + { + await base.CompareTo_simple_zero(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` = 'Seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <> 'Seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` > 'Seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <= 'Seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` > 'Seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <= 'Seattle' +"""); + } + + public override async Task CompareTo_simple_one(bool async) + { + await base.CompareTo_simple_one(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` > 'Seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` < 'Seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <= 'Seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <= 'Seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` >= 'Seattle' +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` >= 'Seattle' +"""); + } + + public override async Task CompareTo_with_parameter(bool async) + { + await base.CompareTo_with_parameter(async); + + AssertSql( + """ +@basicTypesEntity_String='Seattle' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` > @basicTypesEntity_String +""", + // + """ +@basicTypesEntity_String='Seattle' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` < @basicTypesEntity_String +""", + // + """ +@basicTypesEntity_String='Seattle' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <= @basicTypesEntity_String +""", + // + """ +@basicTypesEntity_String='Seattle' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <= @basicTypesEntity_String +""", + // + """ +@basicTypesEntity_String='Seattle' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` >= @basicTypesEntity_String +""", + // + """ +@basicTypesEntity_String='Seattle' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` >= @basicTypesEntity_String +"""); + } + + public override async Task CompareTo_simple_more_than_one(bool async) + { + await base.CompareTo_simple_more_than_one(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(`b`.`String` = 'Seattle', 0, IIF(`b`.`String` > 'Seattle', 1, IIF(`b`.`String` < 'Seattle', -1, NULL))) = 42 +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(`b`.`String` = 'Seattle', 0, IIF(`b`.`String` > 'Seattle', 1, IIF(`b`.`String` < 'Seattle', -1, NULL))) > 42 +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE 42 > IIF(`b`.`String` = 'Seattle', 0, IIF(`b`.`String` > 'Seattle', 1, IIF(`b`.`String` < 'Seattle', -1, NULL))) +"""); + } + + public override async Task CompareTo_nested(bool async) + { + await base.CompareTo_nested(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` = ('M' & `b`.`String`) +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <> MID(`b`.`String`, 0 + 1, 0) +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` > REPLACE('Seattle', 'Sea', `b`.`String`) +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` <= ('M' & `b`.`String`) +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` > MID(`b`.`String`, 0 + 1, 0) +""", + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` < REPLACE('Seattle', 'Sea', `b`.`String`) +"""); + } + + public override async Task Compare_to_multi_predicate(bool async) + { + await base.Compare_to_multi_predicate(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`String` >= 'Seattle' AND `b`.`String` < 'Toronto' +"""); + } + + #endregion Compare + + #region Join + + public override async Task Join_over_non_nullable_column(bool async) + { + await base.Join_over_non_nullable_column(async); + + AssertSql( + """ +SELECT `b1`.`Int`, `b0`.`String`, `b0`.`Id` +FROM ( + SELECT `b`.`Int` + FROM `BasicTypesEntities` AS `b` + GROUP BY `b`.`Int` +) AS `b1` +LEFT JOIN `BasicTypesEntities` AS `b0` ON `b1`.`Int` = `b0`.`Int` +ORDER BY `b1`.`Int` +"""); + } + + public override async Task Join_over_nullable_column(bool async) + { + await base.Join_over_nullable_column(async); + + AssertSql( + """ +SELECT `n3`.`Key`, `n1`.`String`, `n1`.`Id` +FROM ( + SELECT `n0`.`Key` + FROM ( + SELECT IIF(`n`.`Int` IS NULL, 0, `n`.`Int`) AS `Key` + FROM `NullableBasicTypesEntities` AS `n` + ) AS `n0` + GROUP BY `n0`.`Key` +) AS `n3` +LEFT JOIN ( + SELECT `n2`.`Id`, `n2`.`String`, IIF(`n2`.`Int` IS NULL, 0, `n2`.`Int`) AS `Key` + FROM `NullableBasicTypesEntities` AS `n2` +) AS `n1` ON `n3`.`Key` = `n1`.`Key` +ORDER BY `n3`.`Key` +"""); + } + + public override async Task Join_with_predicate(bool async) + { + await base.Join_with_predicate(async); + + AssertSql( + """ +SELECT `b1`.`Int`, `b2`.`String`, `b2`.`Id` +FROM ( + SELECT `b`.`Int` + FROM `BasicTypesEntities` AS `b` + GROUP BY `b`.`Int` +) AS `b1` +LEFT JOIN ( + SELECT `b0`.`String`, `b0`.`Id`, `b0`.`Int` + FROM `BasicTypesEntities` AS `b0` + WHERE IIF(LEN(`b0`.`String`) IS NULL, NULL, CLNG(LEN(`b0`.`String`))) > 6 +) AS `b2` ON `b1`.`Int` = `b2`.`Int` +ORDER BY `b1`.`Int` +"""); + } + + public override async Task Join_with_ordering(bool async) + { + await base.Join_with_ordering(async); + + AssertSql( + """ +SELECT `b1`.`Int`, `b0`.`String`, `b0`.`Id` +FROM ( + SELECT `b`.`Int` + FROM `BasicTypesEntities` AS `b` + GROUP BY `b`.`Int` +) AS `b1` +LEFT JOIN `BasicTypesEntities` AS `b0` ON `b1`.`Int` = `b0`.`Int` +ORDER BY `b1`.`Int`, `b0`.`Id` DESC +"""); + } + + public override async Task Join_non_aggregate(bool async) + { + await base.Join_non_aggregate(async); + + AssertSql( + """ +@foo='foo' (Size = 4000) + +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONCAT_WS(N'|', [b].[String], @foo, N'', N'bar') = N'Seattle|foo||bar' +"""); + } + + #endregion Join + + #region Concatenation + + public override async Task Concat_operator(bool async) + { + await base.Concat_operator(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`String` & 'Boston') = 'SeattleBoston' +"""); + } + + public override async Task Concat_aggregate(bool async) + { + await base.Concat_aggregate(async); + + AssertSql( + """ +SELECT `b1`.`Int`, `b0`.`String`, `b0`.`Id` +FROM ( + SELECT `b`.`Int` + FROM `BasicTypesEntities` AS `b` + GROUP BY `b`.`Int` +) AS `b1` +LEFT JOIN `BasicTypesEntities` AS `b0` ON `b1`.`Int` = `b0`.`Int` +ORDER BY `b1`.`Int` +"""); + } + + public override async Task Concat_string_int_comparison1(bool async) + { + await base.Concat_string_int_comparison1(async); + + AssertSql( + """ +@i='10' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`String` & (@i & '')) = 'Seattle10' +"""); + } + + public override async Task Concat_string_int_comparison2(bool async) + { + await base.Concat_string_int_comparison2(async); + + AssertSql( + """ +@i='10' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ((@i & '') & `b`.`String`) = '10Seattle' +"""); + } + + public override async Task Concat_string_int_comparison3(bool async) + { + await base.Concat_string_int_comparison3(async); + + AssertSql( + """ +@p='30' +@j='21' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ((((@p & '') & `b`.`String`) & (@j & '')) & (42 & '')) = '30Seattle2142' +"""); + } + + public override async Task Concat_string_int_comparison4(bool async) + { + await base.Concat_string_int_comparison4(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ((`b`.`Int` & '') & `b`.`String`) = '8Seattle' +"""); + } + + public override async Task Concat_string_string_comparison(bool async) + { + await base.Concat_string_string_comparison(async); + + AssertSql( + """ +@i='A' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (@i & `b`.`String`) = 'ASeattle' +"""); + } + + public override async Task Concat_method_comparison(bool async) + { + await base.Concat_method_comparison(async); + + AssertSql( + """ +@i='A' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (@i & `b`.`String`) = 'ASeattle' +"""); + } + + public override async Task Concat_method_comparison_2(bool async) + { + await base.Concat_method_comparison_2(async); + + AssertSql( + """ +@i='A' (Size = 255) +@j='B' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (@i & (@j & `b`.`String`)) = 'ABSeattle' +"""); + } + + public override async Task Concat_method_comparison_3(bool async) + { + await base.Concat_method_comparison_3(async); + + AssertSql( + """ +@i='A' (Size = 255) +@j='B' (Size = 255) +@k='C' (Size = 255) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (@i & (@j & (@k & `b`.`String`))) = 'ABCSeattle' +"""); + } + + #endregion Concatenation + + #region LINQ Operators + + public override async Task FirstOrDefault(bool async) + { + await base.FirstOrDefault(async); + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE MID(`b`.`String`, 1, 1) = 'S' +"""); + } + + public override async Task LastOrDefault(bool async) + { + await base.LastOrDefault(async); + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE MID(`b`.`String`, IIF(LEN(`b`.`String`) = 0, 1, LEN(`b`.`String`)), 1) = 'e' +"""); + } + + #endregion LINQ Operators + + #region Like + + public override async Task Where_Like_and_comparison(bool async) + { + await base.Where_Like_and_comparison(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`String` LIKE 'S%') AND `b`.`Int` = 8 +"""); + } + + public override async Task Where_Like_or_comparison(bool async) + { + await base.Where_Like_or_comparison(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`String` LIKE 'S%') OR `b`.`Int` = 2147483647 +"""); + } + + public override async Task Like_with_non_string_column_using_ToString(bool async) + { + await base.Like_with_non_string_column_using_ToString(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`Int` & '') LIKE '%5%' +"""); + } + + public override async Task Like_with_non_string_column_using_double_cast(bool async) + { + await base.Like_with_non_string_column_using_double_cast(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`Int` & '') LIKE '%5%' +"""); + } + + #endregion Like + + #region Regex + + public override Task Regex_IsMatch(bool async) + => AssertTranslationFailed(() => base.Regex_IsMatch(async)); + + public override Task Regex_IsMatch_constant_input(bool async) + => AssertTranslationFailed(() => base.Regex_IsMatch_constant_input(async)); + + #endregion Regex + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); + + protected override void ClearLog() + => Fixture.TestSqlLoggerFactory.Clear(); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsJetTest.cs new file mode 100644 index 00000000..0f1bef13 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsJetTest.cs @@ -0,0 +1,232 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Translations.Temporal; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal; + +public class DateOnlyTranslationsJetTest : DateOnlyTranslationsTestBase +{ + public DateOnlyTranslationsJetTest(BasicTypesQueryJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Year(bool async) + { + await base.Year(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('yyyy', `b`.`DateOnly`) = 1990 +"""); + } + + public override async Task Month(bool async) + { + await base.Month(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('m', `b`.`DateOnly`) = 11 +"""); + } + + public override async Task Day(bool async) + { + await base.Day(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('d', `b`.`DateOnly`) = 10 +"""); + } + + public override async Task DayOfYear(bool async) + { + await base.DayOfYear(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('y', `b`.`DateOnly`) = 314 +"""); + } + + public override async Task DayOfWeek(bool async) + { + await AssertTranslationFailed(() => base.DayOfWeek(async)); + + AssertSql(); + } + + /*public override async Task DayNumber(bool async) + { + await base.DayNumber(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATEDIFF(day, '0001-01-01', [b].[DateOnly]) = 726780 +"""); + }*/ + + public override async Task AddYears(bool async) + { + await base.AddYears(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEADD('yyyy', CLNG(3), `b`.`DateOnly`) = #1993-11-10# +"""); + } + + public override async Task AddMonths(bool async) + { + await base.AddMonths(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEADD('m', CLNG(3), `b`.`DateOnly`) = #1991-02-10# +"""); + } + + public override async Task AddDays(bool async) + { + await base.AddDays(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEADD('d', CLNG(3), `b`.`DateOnly`) = #1990-11-13# +"""); + } + + /*public override async Task DayNumber_subtraction(bool async) + { + await base.DayNumber_subtraction(async); + + AssertSql( + """ +@DayNumber='726775' + +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATEDIFF(day, '0001-01-01', [b].[DateOnly]) - @DayNumber = 5 +"""); + }*/ + + public override async Task FromDateTime(bool async) + { + await base.FromDateTime(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CAST([b].[DateTime] AS date) = '1998-05-04' +"""); + } + + public override async Task FromDateTime_compared_to_property(bool async) + { + await base.FromDateTime_compared_to_property(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`DateTime` = `b`.`DateOnly` +"""); + } + + public override async Task FromDateTime_compared_to_constant_and_parameter(bool async) + { + await base.FromDateTime_compared_to_constant_and_parameter(async); + + AssertSql( + """ +@dateOnly='10/11/0002' (DbType = Date) + +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CAST([b].[DateTime] AS date) IN (@dateOnly, '1998-05-04') +"""); + } + + public override async Task ToDateTime_property_with_constant_TimeOnly(bool async) + { + await base.ToDateTime_property_with_constant_TimeOnly(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATETIME2FROMPARTS(DATEPART(year, [b].[DateOnly]), DATEPART(month, [b].[DateOnly]), DATEPART(day, [b].[DateOnly]), 21, 5, 19, 9405000, 7) = '2020-01-01T21:05:19.9405000' +"""); + } + + public override async Task ToDateTime_property_with_property_TimeOnly(bool async) + { + await base.ToDateTime_property_with_property_TimeOnly(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATETIME2FROMPARTS(DATEPART(year, [b].[DateOnly]), DATEPART(month, [b].[DateOnly]), DATEPART(day, [b].[DateOnly]), DATEPART(hour, [b].[TimeOnly]), DATEPART(minute, [b].[TimeOnly]), DATEPART(second, [b].[TimeOnly]), DATEPART(nanosecond, [b].[TimeOnly]) / 100, 7) = '2020-01-01T15:30:10.0000000' +"""); + } + + public override async Task ToDateTime_constant_DateTime_with_property_TimeOnly(bool async) + { + await base.ToDateTime_constant_DateTime_with_property_TimeOnly(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATETIME2FROMPARTS(1990, 11, 10, DATEPART(hour, [b].[TimeOnly]), DATEPART(minute, [b].[TimeOnly]), DATEPART(second, [b].[TimeOnly]), DATEPART(nanosecond, [b].[TimeOnly]) / 100, 7) = '1990-11-10T15:30:10.0000000' +"""); + } + + public override async Task ToDateTime_with_complex_DateTime(bool async) + { + await AssertTranslationFailed(() => base.ToDateTime_with_complex_DateTime(async)); + + AssertSql(); + } + + public override async Task ToDateTime_with_complex_TimeOnly(bool async) + { + await AssertTranslationFailed(() => base.ToDateTime_with_complex_TimeOnly(async)); + + AssertSql(); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateTimeOffsetTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateTimeOffsetTranslationsJetTest.cs new file mode 100644 index 00000000..d471bc39 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateTimeOffsetTranslationsJetTest.cs @@ -0,0 +1,313 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Translations.Temporal; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal; + +public class DateTimeOffsetTranslationsJetTest : DateTimeOffsetTranslationsTestBase +{ + public DateTimeOffsetTranslationsJetTest(BasicTypesQueryJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Now(bool async) + { + await base.Now(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`DateTimeOffset` <> NOW() +"""); + } + + public override async Task UtcNow(bool async) + { + await base.UtcNow(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`DateTimeOffset` <> DATEADD('n', -480.0, NOW()) +"""); + } + + public override async Task Date(bool async) + { + await base.Date(async); + + AssertSql( + """ +@Date='0001-01-01T00:00:00.0000000' + +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE CONVERT(date, [b].[DateTimeOffset]) > @Date +"""); + } + + public override async Task Year(bool async) + { + await base.Year(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('yyyy', `b`.`DateTimeOffset`) = 1998 +"""); + } + + public override async Task Month(bool async) + { + await base.Month(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('m', `b`.`DateTimeOffset`) = 5 +"""); + } + + public override async Task DayOfYear(bool async) + { + await base.DayOfYear(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('y', `b`.`DateTimeOffset`) = 124 +"""); + } + + public override async Task Day(bool async) + { + await base.Day(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('d', `b`.`DateTimeOffset`) = 4 +"""); + } + + public override async Task Hour(bool async) + { + await base.Hour(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATEPART(hour, [b].[DateTimeOffset]) = 15 +"""); + } + + public override async Task Minute(bool async) + { + await base.Minute(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATEPART(minute, [b].[DateTimeOffset]) = 30 +"""); + } + + public override async Task Second(bool async) + { + await base.Second(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('s', `b`.`DateTimeOffset`) = 10 +"""); + } + + public override async Task Millisecond(bool async) + { + await base.Millisecond(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATEPART(millisecond, [b].[DateTimeOffset]) = 123 +"""); + } + + public override async Task Microsecond(bool async) + { + await base.Microsecond(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATEPART(microsecond, [b].[DateTimeOffset]) % 1000 = 456 +"""); + } + + public override async Task Nanosecond(bool async) + { + await base.Nanosecond(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATEPART(nanosecond, [b].[DateTimeOffset]) % 1000 = 400 +"""); + } + + public override async Task TimeOfDay(bool async) + { + await base.TimeOfDay(async); + + AssertSql( + """ +SELECT CONVERT(time, [b].[DateTimeOffset]) +FROM [BasicTypesEntities] AS [b] +"""); + } + + public override async Task AddYears(bool async) + { + await base.AddYears(async); + + AssertSql( + """ +SELECT DATEADD('yyyy', 1, `b`.`DateTimeOffset`) +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task AddMonths(bool async) + { + await base.AddMonths(async); + + AssertSql( + """ +SELECT DATEADD('m', 1, `b`.`DateTimeOffset`) +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task AddDays(bool async) + { + await base.AddDays(async); + + AssertSql( + """ +SELECT DATEADD('d', 1.0, `b`.`DateTimeOffset`) +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task AddHours(bool async) + { + await base.AddHours(async); + + AssertSql( + """ +SELECT DATEADD('h', 1.0, `b`.`DateTimeOffset`) +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task AddMinutes(bool async) + { + await base.AddMinutes(async); + + AssertSql( + """ +SELECT DATEADD('n', 1.0, `b`.`DateTimeOffset`) +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task AddSeconds(bool async) + { + await base.AddSeconds(async); + + AssertSql( + """ +SELECT DATEADD('s', 1.0, `b`.`DateTimeOffset`) +FROM `BasicTypesEntities` AS `b` +"""); + } + + public override async Task AddMilliseconds(bool async) + { + await base.AddMilliseconds(async); + + AssertSql( + """ +SELECT DATEADD(millisecond, CAST(300.0E0 AS int), [b].[DateTimeOffset]) +FROM [BasicTypesEntities] AS [b] +"""); + } + + public override async Task ToUnixTimeMilliseconds(bool async) + { + await base.ToUnixTimeMilliseconds(async); + + AssertSql( + """ +@unixEpochMilliseconds='894295810000' + +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATEDIFF_BIG(millisecond, '1970-01-01T00:00:00.0000000+00:00', [b].[DateTimeOffset]) = @unixEpochMilliseconds +"""); + } + + public override async Task ToUnixTimeSecond(bool async) + { + await base.ToUnixTimeSecond(async); + + AssertSql( + """ +@unixEpochSeconds='894295810' (DbType = Decimal) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEDIFF('s', CDATE('1970-01-01 00:00:00'), `b`.`DateTimeOffset`) = @unixEpochSeconds +"""); + } + + public override async Task Milliseconds_parameter_and_constant(bool async) + { + await base.Milliseconds_parameter_and_constant(async); + + AssertSql( + """ +SELECT COUNT(*) +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`DateTimeOffset` = CDATE('1902-01-02 08:30:00') +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateTimeTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateTimeTranslationsJetTest.cs new file mode 100644 index 00000000..86b9c114 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateTimeTranslationsJetTest.cs @@ -0,0 +1,256 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Translations.Temporal; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal; + +public class DateTimeTranslationsJetTest : DateTimeTranslationsTestBase +{ + public DateTimeTranslationsJetTest(BasicTypesQueryJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Now(bool async) + { + await base.Now(async); + + AssertSql( + """ +@myDatetime='2015-04-10T00:00:00.0000000' (DbType = DateTime) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE NOW() <> CDATE(@myDatetime) +"""); + } + + public override async Task UtcNow(bool async) + { + await base.UtcNow(async); + + AssertSql( + """ +@myDatetime='2015-04-10T00:00:00.0000000' (DbType = DateTime) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEADD('n', -480.0, NOW()) <> CDATE(@myDatetime) +"""); + } + + public override async Task Today(bool async) + { + await base.Today(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`DateTime` = DATEVALUE(DATE()) +"""); + } + + public override async Task Date(bool async) + { + await base.Date(async); + + AssertSql( + """ +@myDatetime='1998-05-04T00:00:00.0000000' (DbType = DateTime) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEVALUE(`b`.`DateTime`) = CDATE(@myDatetime) +"""); + } + + public override async Task AddYear(bool async) + { + await base.AddYear(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('yyyy', DATEADD('yyyy', 1, `b`.`DateTime`)) = 1999 +"""); + } + + public override async Task Year(bool async) + { + await base.Year(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('yyyy', `b`.`DateTime`) = 1998 +"""); + } + + public override async Task Month(bool async) + { + await base.Month(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('m', `b`.`DateTime`) = 5 +"""); + } + + public override async Task DayOfYear(bool async) + { + await base.DayOfYear(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('y', `b`.`DateTime`) = 124 +"""); + } + + public override async Task Day(bool async) + { + await base.Day(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('d', `b`.`DateTime`) = 4 +"""); + } + + public override async Task Hour(bool async) + { + await base.Hour(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('h', `b`.`DateTime`) = 15 +"""); + } + + public override async Task Minute(bool async) + { + await base.Minute(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('n', `b`.`DateTime`) = 30 +"""); + } + + public override async Task Second(bool async) + { + await base.Second(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('s', `b`.`DateTime`) = 10 +"""); + } + + public override async Task Millisecond(bool async) + { + await base.Millisecond(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATEPART(millisecond, [b].[DateTime]) = 123 +"""); + } + + public override async Task TimeOfDay(bool async) + { + await base.TimeOfDay(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE TIMEVALUE(`b`.`DateTime`) = TIMEVALUE('00:00:00') +"""); + } + + public override Task subtract_and_TotalDays(bool async) + => AssertTranslationFailed(() => base.subtract_and_TotalDays(async)); + + public override async Task Parse_with_constant(bool async) + { + await base.Parse_with_constant(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE [b].[DateTime] = '1998-05-04T15:30:10.0000000' +"""); + } + + public override async Task Parse_with_parameter(bool async) + { + await base.Parse_with_parameter(async); + + AssertSql( + """ +@Parse='1998-05-04T15:30:10.0000000' + +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE [b].[DateTime] = @Parse +"""); + } + + public override async Task New_with_constant(bool async) + { + await base.New_with_constant(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`DateTime` = #1998-05-04 15:30:10# +"""); + } + + public override async Task New_with_parameters(bool async) + { + await base.New_with_parameters(async); + + AssertSql( + """ +@p='1998-05-04T15:30:10.0000000' (DbType = DateTime) + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE `b`.`DateTime` = CDATE(@p) +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/TimeOnlyTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/TimeOnlyTranslationsJetTest.cs new file mode 100644 index 00000000..9561b312 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/TimeOnlyTranslationsJetTest.cs @@ -0,0 +1,225 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Translations.Temporal; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal; + +public class TimeOnlyTranslationsJetTest : TimeOnlyTranslationsTestBase +{ + public TimeOnlyTranslationsJetTest(BasicTypesQueryJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Hour(bool async) + { + await base.Hour(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('h', `b`.`TimeOnly`) = 15 +"""); + } + + public override async Task Minute(bool async) + { + await base.Minute(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('n', `b`.`TimeOnly`) = 30 +"""); + } + + public override async Task Second(bool async) + { + await base.Second(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('s', `b`.`TimeOnly`) = 10 +"""); + } + + public override async Task Millisecond(bool async) + { + await base.Millisecond(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATEPART(millisecond, [b].[TimeOnly]) = 123 +"""); + } + + public override async Task Microsecond(bool async) + { + await base.Microsecond(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATEPART(microsecond, [b].[TimeOnly]) % 1000 = 456 +"""); + } + + public override async Task Nanosecond(bool async) + { + await base.Nanosecond(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATEPART(nanosecond, [b].[TimeOnly]) % 1000 = 400 +"""); + } + + public override async Task AddHours(bool async) + { + await base.AddHours(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE TIMEVALUE(DATEADD('h', CLNG(3.0), `b`.`TimeOnly`)) = TIMEVALUE('18:30:10') +"""); + } + + public override async Task AddMinutes(bool async) + { + await base.AddMinutes(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE TIMEVALUE(DATEADD('n', CLNG(3.0), `b`.`TimeOnly`)) = TIMEVALUE('15:33:10') +"""); + } + + public override async Task Add_TimeSpan(bool async) + { + await AssertTranslationFailed(() => base.Add_TimeSpan(async)); + + AssertSql(); + } + + public override async Task IsBetween(bool async) + { + await base.IsBetween(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (IIF(`b`.`TimeOnly` >= TIMEVALUE('14:00:00'), TRUE, FALSE) BAND IIF(`b`.`TimeOnly` < TIMEVALUE('16:00:00'), TRUE, FALSE)) = TRUE +"""); + } + + public override async Task Subtract(bool async) + { + await AssertTranslationFailed(() => base.Subtract(async)); + + AssertSql(); + } + + public override async Task FromDateTime_compared_to_property(bool async) + { + await base.FromDateTime_compared_to_property(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE TIMEVALUE(`b`.`DateTime`) = `b`.`TimeOnly` +"""); + } + + public override async Task FromDateTime_compared_to_parameter(bool async) + { + await base.FromDateTime_compared_to_parameter(async); + + AssertSql( + """ +@time='15:30:10' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE TIMEVALUE(`b`.`DateTime`) = TIMEVALUE(@time) +"""); + } + + public override async Task FromDateTime_compared_to_constant(bool async) + { + await base.FromDateTime_compared_to_constant(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE TIMEVALUE(`b`.`DateTime`) = TIMEVALUE('15:30:10') +"""); + } + + public override async Task FromTimeSpan_compared_to_property(bool async) + { + await base.FromTimeSpan_compared_to_property(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE TIMEVALUE(`b`.`TimeSpan`) < `b`.`TimeOnly` +"""); + } + + public override async Task FromTimeSpan_compared_to_parameter(bool async) + { + await base.FromTimeSpan_compared_to_parameter(async); + + AssertSql( + """ +@time='01:02:03' + +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE TIMEVALUE(`b`.`TimeSpan`) = TIMEVALUE(@time) +"""); + } + + public override async Task Order_by_FromTimeSpan(bool async) + { + await base.Order_by_FromTimeSpan(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +ORDER BY CAST([b].[TimeSpan] AS time) +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/TimeSpanTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/TimeSpanTranslationsJetTest.cs new file mode 100644 index 00000000..f5853f2d --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/TimeSpanTranslationsJetTest.cs @@ -0,0 +1,99 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Translations.Temporal; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Translations.Temporal; + +public class TimeSpanTranslationsJetTest : TimeSpanTranslationsTestBase +{ + public TimeSpanTranslationsJetTest(BasicTypesQueryJetFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.Clear(); + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + } + + public override async Task Hours(bool async) + { + await base.Hours(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('h', `b`.`TimeSpan`) = 3 +"""); + } + + public override async Task Minutes(bool async) + { + await base.Minutes(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('n', `b`.`TimeSpan`) = 4 +"""); + } + + public override async Task Seconds(bool async) + { + await base.Seconds(async); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEPART('s', `b`.`TimeSpan`) = 5 +"""); + } + + public override async Task Milliseconds(bool async) + { + await base.Milliseconds(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATEPART(millisecond, [b].[TimeSpan]) = 678 +"""); + } + + public override async Task Microseconds(bool async) + { + await base.Microseconds(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATEPART(microsecond, [b].[TimeSpan]) % 1000 = 912 +"""); + } + + public override async Task Nanoseconds(bool async) + { + await base.Nanoseconds(async); + + AssertSql( + """ +SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] +FROM [BasicTypesEntities] AS [b] +WHERE DATEPART(nanosecond, [b].[TimeSpan]) % 1000 = 400 +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.Jet.FunctionalTests/SequentialGuidEndToEndTest.cs b/test/EFCore.Jet.FunctionalTests/SequentialGuidEndToEndTest.cs index 7c5b02f6..b7eb67c5 100644 --- a/test/EFCore.Jet.FunctionalTests/SequentialGuidEndToEndTest.cs +++ b/test/EFCore.Jet.FunctionalTests/SequentialGuidEndToEndTest.cs @@ -115,11 +115,8 @@ private class Pegasus public async Task InitializeAsync() => TestStore = await JetTestStore.CreateInitializedAsync("SequentialGuidEndToEndTest"); - public Task DisposeAsync() - { - TestStore.Dispose(); - return Task.CompletedTask; - } + public async Task DisposeAsync() + => await TestStore.DisposeAsync(); [ConditionalFact] public void CustomUuid7Test() diff --git a/test/EFCore.Jet.FunctionalTests/TPTTableSplittingJetTest.cs b/test/EFCore.Jet.FunctionalTests/TPTTableSplittingJetTest.cs index 70f627dd..033210b1 100644 --- a/test/EFCore.Jet.FunctionalTests/TPTTableSplittingJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/TPTTableSplittingJetTest.cs @@ -9,7 +9,7 @@ namespace EntityFrameworkCore.Jet.FunctionalTests; -public class TPTTableSplittingJetTest(ITestOutputHelper testOutputHelper) : TPTTableSplittingTestBase(testOutputHelper) +public class TPTTableSplittingJetTest(NonSharedFixture fixture, ITestOutputHelper testOutputHelper) : TPTTableSplittingTestBase(fixture, testOutputHelper) { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; diff --git a/test/EFCore.Jet.FunctionalTests/TableSplittingJetTest.cs b/test/EFCore.Jet.FunctionalTests/TableSplittingJetTest.cs index 2f7bd570..916b11cb 100644 --- a/test/EFCore.Jet.FunctionalTests/TableSplittingJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/TableSplittingJetTest.cs @@ -9,7 +9,7 @@ namespace EntityFrameworkCore.Jet.FunctionalTests { - public class TableSplittingJetTest(ITestOutputHelper testOutputHelper) : TableSplittingTestBase(testOutputHelper) + public class TableSplittingJetTest(NonSharedFixture fixture,ITestOutputHelper testOutputHelper) : TableSplittingTestBase(fixture, testOutputHelper) { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; @@ -181,12 +181,14 @@ public override async Task ExecuteUpdate_works_for_table_sharing(bool async) await base.ExecuteUpdate_works_for_table_sharing(async); AssertSql( -""" + """ +@p='1' + UPDATE `Vehicles` AS `v` -SET `v`.`SeatingCapacity` = 1 +SET `v`.`SeatingCapacity` = @p """, -// -""" + // + """ SELECT IIF(NOT EXISTS ( SELECT 1 FROM `Vehicles` AS `v` diff --git a/test/EFCore.Jet.FunctionalTests/TestUtilities/JetTestStore.cs b/test/EFCore.Jet.FunctionalTests/TestUtilities/JetTestStore.cs index 91a881a1..b6be6ae3 100644 --- a/test/EFCore.Jet.FunctionalTests/TestUtilities/JetTestStore.cs +++ b/test/EFCore.Jet.FunctionalTests/TestUtilities/JetTestStore.cs @@ -385,9 +385,9 @@ private static DbCommand CreateCommand( return command; } - public override void Dispose() + public override async ValueTask DisposeAsync() { - base.Dispose(); + await base.DisposeAsync(); // Clean up the database using a local file, as it might get deleted later diff --git a/test/EFCore.Jet.FunctionalTests/TestUtilities/TestRelationalCommandBuilderFactory.cs b/test/EFCore.Jet.FunctionalTests/TestUtilities/TestRelationalCommandBuilderFactory.cs index 04fadb7a..96763a0d 100644 --- a/test/EFCore.Jet.FunctionalTests/TestUtilities/TestRelationalCommandBuilderFactory.cs +++ b/test/EFCore.Jet.FunctionalTests/TestUtilities/TestRelationalCommandBuilderFactory.cs @@ -53,9 +53,17 @@ public IRelationalCommand Build() => new TestRelationalCommand( Dependencies, Instance.ToString(), + Instance.ToString(), Parameters); - public IRelationalCommandBuilder Append(string value) + public IRelationalCommandBuilder Append(string value, bool redact = false) + { + Instance.Append(value); + + return this; + } + + public IRelationalCommandBuilder Append(FormattableString value, bool redact = false) { Instance.Append(value); @@ -89,14 +97,17 @@ public IRelationalCommandBuilder DecrementIndent() private class TestRelationalCommand( RelationalCommandBuilderDependencies dependencies, string commandText, + string logCommandText, IReadOnlyList parameters) : IRelationalCommand { - private readonly RelationalCommand _realRelationalCommand = new(dependencies, commandText, parameters); + private readonly RelationalCommand _realRelationalCommand = new(dependencies, commandText,logCommandText, parameters); private readonly Func _createExceptionFunc = TestEnvironment.DataAccessProviderType == DataAccessProviderType.OleDb ? number => OleDbExceptionFactory.CreateException(number) : number => OdbcExceptionFactory.CreateException(number); public string CommandText => _realRelationalCommand.CommandText; + public string LogCommandText + => _realRelationalCommand.LogCommandText; public IReadOnlyList Parameters => _realRelationalCommand.Parameters; diff --git a/test/EFCore.Jet.FunctionalTests/Update/MismatchedKeyTypesJetTest.cs b/test/EFCore.Jet.FunctionalTests/Update/MismatchedKeyTypesJetTest.cs index d769ce70..82b0a7b5 100644 --- a/test/EFCore.Jet.FunctionalTests/Update/MismatchedKeyTypesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Update/MismatchedKeyTypesJetTest.cs @@ -821,10 +821,12 @@ public async Task InitializeAsync() await SeedAsync(); } - public Task DisposeAsync() + public async Task DisposeAsync() { - Store.Dispose(); - return Task.CompletedTask; + if (Store != null) + { + await Store.DisposeAsync(); + } } } diff --git a/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs b/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs index b914e1f3..e0cc90b9 100644 --- a/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs @@ -14,7 +14,7 @@ #nullable disable namespace EntityFrameworkCore.Jet.FunctionalTests.Update; -public class NonSharedModelUpdatesJetTest : NonSharedModelUpdatesTestBase +public class NonSharedModelUpdatesJetTest(NonSharedFixture fixture) : NonSharedModelUpdatesTestBase(fixture) { public override async Task Principal_and_dependent_roundtrips_with_cycle_breaking(bool async) { diff --git a/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs b/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs index 7da9ce81..0efd082d 100644 --- a/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs @@ -1,17 +1,18 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.TestUtilities; using Microsoft.EntityFrameworkCore.Update; +using System; +using System.Threading.Tasks; using Xunit; namespace EntityFrameworkCore.Jet.FunctionalTests.Update; -public class StoredProcedureUpdateJetTest : StoredProcedureUpdateTestBase +public class StoredProcedureUpdateJetTest(NonSharedFixture fixture) : StoredProcedureUpdateTestBase(fixture) { public override async Task Insert_with_output_parameter(bool async) { diff --git a/test/EFCore.Jet.FunctionalTests/test.runsettings b/test/EFCore.Jet.FunctionalTests/test.runsettings index 520de917..e5200813 100644 --- a/test/EFCore.Jet.FunctionalTests/test.runsettings +++ b/test/EFCore.Jet.FunctionalTests/test.runsettings @@ -4,7 +4,7 @@ - 0 + 1 \ No newline at end of file diff --git a/test/EFCore.Jet.IntegrationTests/EFCore.Jet.IntegrationTests.csproj b/test/EFCore.Jet.IntegrationTests/EFCore.Jet.IntegrationTests.csproj index 00803971..49073d9d 100644 --- a/test/EFCore.Jet.IntegrationTests/EFCore.Jet.IntegrationTests.csproj +++ b/test/EFCore.Jet.IntegrationTests/EFCore.Jet.IntegrationTests.csproj @@ -75,7 +75,6 @@ - From fc8873f53e994d56103c8121c3db325069777389 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Tue, 15 Jul 2025 20:30:17 +0800 Subject: [PATCH 02/35] more test work --- ...rchConditionConvertingExpressionVisitor.cs | 9 +- .../NorthwindBulkUpdatesJetTest.cs | 47 ++-- .../Query/GearsOfWarQueryJetTest.cs | 12 +- .../NorthwindEFPropertyIncludeQueryJetTest.cs | 12 +- .../NorthwindIncludeNoTrackingQueryJetTest.cs | 12 +- .../Query/NorthwindIncludeQueryJetTest.cs | 12 +- .../Query/NorthwindJoinQueryJetTest.cs | 6 +- .../NorthwindStringIncludeQueryJetTest.cs | 12 +- .../Query/PrecompiledQueryJetTest.cs | 13 +- .../Query/PrimitiveCollectionsQueryJetTest.cs | 18 +- .../OwnedNoTrackingProjectionJetTest.cs | 6 +- ...nedReferenceNoTrackingProjectionJetTest.cs | 20 +- .../OwnedReferenceProjectionJetTest.cs | 14 +- ...bleSplittingNoTrackingProjectionJetTest.cs | 76 +++--- ...ingReferenceProjectionNoTrackingJetTest.cs | 250 +++++++++--------- .../Query/TPCGearsOfWarQueryJetTest.cs | 22 +- .../Query/TPTGearsOfWarQueryJetTest.cs | 12 +- 17 files changed, 279 insertions(+), 274 deletions(-) diff --git a/src/EFCore.Jet/Query/Internal/SearchConditionConvertingExpressionVisitor.cs b/src/EFCore.Jet/Query/Internal/SearchConditionConvertingExpressionVisitor.cs index be2a3cdc..37319783 100644 --- a/src/EFCore.Jet/Query/Internal/SearchConditionConvertingExpressionVisitor.cs +++ b/src/EFCore.Jet/Query/Internal/SearchConditionConvertingExpressionVisitor.cs @@ -405,7 +405,14 @@ protected override Expression VisitSqlFunction(SqlFunctionExpression sqlFunction protected override Expression VisitRightJoin(RightJoinExpression rightJoinExpression) { - throw new NotImplementedException(); + var parentSearchCondition = _isSearchCondition; + _isSearchCondition = false; + var table = (TableExpressionBase)Visit(rightJoinExpression.Table); + _isSearchCondition = true; + var joinPredicate = (SqlExpression)Visit(rightJoinExpression.JoinPredicate); + _isSearchCondition = parentSearchCondition; + + return rightJoinExpression.Update(table, joinPredicate); } /// diff --git a/test/EFCore.Jet.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesJetTest.cs b/test/EFCore.Jet.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesJetTest.cs index 08312b27..1eaa7a40 100644 --- a/test/EFCore.Jet.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesJetTest.cs @@ -671,19 +671,25 @@ public override async Task Delete_with_RightJoin(bool async) AssertSql( """ -@p='0' -@p0='100' - -DELETE FROM [o] -FROM [Order Details] AS [o] -RIGHT JOIN ( - SELECT [o0].[OrderID] - FROM [Orders] AS [o0] - WHERE [o0].[OrderID] < 10300 - ORDER BY [o0].[OrderID] - OFFSET @p ROWS FETCH NEXT @p0 ROWS ONLY -) AS [o1] ON [o].[OrderID] = [o1].[OrderID] -WHERE [o].[OrderID] < 10276 +DELETE FROM `Order Details` AS `o` +WHERE EXISTS ( + SELECT 1 + FROM `Order Details` AS `o0` + RIGHT JOIN ( + SELECT `o4`.`OrderID` + FROM ( + SELECT TOP @p0 `o3`.`OrderID` + FROM ( + SELECT TOP @p + @p0 `o2`.`OrderID` + FROM `Orders` AS `o2` + WHERE `o2`.`OrderID` < 10300 + ORDER BY `o2`.`OrderID` + ) AS `o3` + ORDER BY `o3`.`OrderID` DESC + ) AS `o4` + ORDER BY `o4`.`OrderID` + ) AS `o1` ON `o0`.`OrderID` = `o1`.`OrderID` + WHERE `o0`.`OrderID` < 10276 AND `o0`.`OrderID` = `o`.`OrderID` AND `o0`.`ProductID` = `o`.`ProductID`) """); } @@ -1386,15 +1392,14 @@ public override async Task Update_with_RightJoin(bool async) """ @p='2020-01-01T00:00:00.0000000Z' (Nullable = true) (DbType = DateTime) -UPDATE [o] -SET [o].[OrderDate] = @p -FROM [Orders] AS [o] +UPDATE `Orders` AS `o` RIGHT JOIN ( - SELECT [c].[CustomerID] - FROM [Customers] AS [c] - WHERE [c].[CustomerID] LIKE N'F%' -) AS [c0] ON [o].[CustomerID] = [c0].[CustomerID] -WHERE [o].[OrderID] < 10300 + SELECT `c`.`CustomerID` + FROM `Customers` AS `c` + WHERE `c`.`CustomerID` LIKE 'F%' +) AS `c0` ON `o`.`CustomerID` = `c0`.`CustomerID` +SET `o`.`OrderDate` = CDATE(@p) +WHERE `o`.`OrderID` < 10300 """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs index 61ca39e9..ed687f0c 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs @@ -4174,12 +4174,12 @@ public override async Task Correlated_collections_on_RightJoin_with_predicate(bo AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [t].[Id], [w].[Name], [w].[Id] -FROM [Gears] AS [g] -RIGHT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] -LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] -WHERE [g].[HasSoulPatch] = CAST(0 AS bit) -ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id] +SELECT `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Name`, `w`.`Id` +FROM (`Gears` AS `g` +RIGHT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName`) +LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` +WHERE `g`.`HasSoulPatch` = FALSE +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs index a906c306..336bd52d 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs @@ -509,12 +509,12 @@ public override async Task Include_collection_with_right_join_clause_with_filter AssertSql( """ -SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] -FROM [Customers] AS [c] -RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] -LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [o].[OrderID] +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`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` +FROM (`Customers` AS `c` +RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) +LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` +WHERE `c`.`CustomerID` LIKE 'F%' +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs index 0d79a3b8..4cbc29f5 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs @@ -1870,12 +1870,12 @@ public override async Task Include_collection_with_right_join_clause_with_filter AssertSql( """ -SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] -FROM [Customers] AS [c] -RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] -LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [o].[OrderID] +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`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` +FROM (`Customers` AS `c` +RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) +LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` +WHERE `c`.`CustomerID` LIKE 'F%' +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs index b58f19c7..ffe071b0 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs @@ -569,12 +569,12 @@ public override async Task Include_collection_with_right_join_clause_with_filter AssertSql( """ -SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] -FROM [Customers] AS [c] -RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] -LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [o].[OrderID] +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`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` +FROM (`Customers` AS `c` +RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) +LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` +WHERE `c`.`CustomerID` LIKE 'F%' +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindJoinQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindJoinQueryJetTest.cs index ada8d713..426d97f2 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindJoinQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindJoinQueryJetTest.cs @@ -251,9 +251,9 @@ public override async Task RightJoin(bool async) AssertSql( """ -SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] -FROM [Customers] AS [c] -RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Customers` AS `c` +RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs index aaaef68f..7b0aac5a 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs @@ -511,12 +511,12 @@ public override async Task Include_collection_with_right_join_clause_with_filter AssertSql( """ -SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] -FROM [Customers] AS [c] -RIGHT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] -LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [o].[OrderID] +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`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` +FROM (`Customers` AS `c` +RIGHT JOIN `Orders` AS `o` ON `c`.`CustomerID` = `o`.`CustomerID`) +LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` +WHERE `c`.`CustomerID` LIKE 'F%' +ORDER BY `c`.`CustomerID`, `o`.`OrderID` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/PrecompiledQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/PrecompiledQueryJetTest.cs index 5be03c7f..9aa86121 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/PrecompiledQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/PrecompiledQueryJetTest.cs @@ -1348,18 +1348,17 @@ public override async Task Terminating_ExecuteUpdate_with_lambda() AssertSql( """ -@suffix='Suffix' (Size = 4000) +@suffix='Suffix' (Size = 255) -UPDATE [b] -SET [b].[Name] = COALESCE([b].[Name], N'') + @suffix -FROM [Blogs] AS [b] -WHERE [b].[Id] > 8 +UPDATE `Blogs` AS `b` +SET `b`.`Name` = IIF(`b`.`Name` IS NULL, '', `b`.`Name`) & @suffix +WHERE `b`.`Id` > 8 """, // """ SELECT COUNT(*) -FROM [Blogs] AS [b] -WHERE [b].[Id] = 9 AND [b].[Name] = N'Blog2Suffix' +FROM `Blogs` AS `b` +WHERE `b`.`Id` = 9 AND `b`.`Name` = 'Blog2Suffix' """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs index 25a313ee..f4de25c7 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs @@ -1179,21 +1179,15 @@ public override async Task Parameter_collection_of_structs_Contains_nullable_str AssertSql( """ -@values1='22' -@values2='33' - -SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] -FROM [PrimitiveCollectionsEntity] AS [p] -WHERE [p].[NullableWrappedId] IN (@values1, @values2) +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`NullableWrappedId` IN (22, 33) """, // """ -@values1='11' -@values2='44' - -SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] -FROM [PrimitiveCollectionsEntity] AS [p] -WHERE [p].[NullableWrappedId] NOT IN (@values1, @values2) OR [p].[NullableWrappedId] IS NULL +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`NullableWrappedId` NOT IN (11, 44) OR `p`.`NullableWrappedId` IS NULL """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedNoTrackingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedNoTrackingProjectionJetTest.cs index 021bcf6f..54111718 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedNoTrackingProjectionJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedNoTrackingProjectionJetTest.cs @@ -25,10 +25,10 @@ public override async Task Select_trunk_collection(bool async) AssertSql( """ -SELECT `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`Name1`, `s0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s0`.`Name2`, `s0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` +SELECT `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`Name1`, `s0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s0`.`Name2`, `s0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` FROM `RootEntities` AS `r` LEFT JOIN ( - SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r3`.`Id1` AS `Id11`, `r3`.`Name` AS `Name1`, `r0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_Name`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r4`.`Id1` AS `Id12`, `r4`.`Name` AS `Name2`, `r0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` + SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r3`.`Id1` AS `Id11`, `r3`.`Name` AS `Name1`, `r0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_Name`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r4`.`Id1` AS `Id12`, `r4`.`Name` AS `Name2`, `r0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` FROM ((`Root_CollectionTrunk` AS `r0` LEFT JOIN ( SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityId1`, `r2`.`Id1` AS `Id10`, `r2`.`Name` AS `Name0`, `r1`.`OptionalReferenceLeaf_Name`, `r1`.`RequiredReferenceLeaf_Name` @@ -38,7 +38,7 @@ LEFT JOIN ( LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf` AS `r3` ON IIF(`r0`.`OptionalReferenceBranch_Name` IS NOT NULL, `r0`.`RelationshipsRootEntityId`, NULL) = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND IIF(`r0`.`OptionalReferenceBranch_Name` IS NOT NULL, `r0`.`Id1`, NULL) = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r0`.`Id1` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` ) AS `s0` ON `r`.`Id` = `s0`.`RelationshipsRootEntityId` -ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11` +ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedReferenceNoTrackingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedReferenceNoTrackingProjectionJetTest.cs index e6ca6ca1..deccdcf7 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedReferenceNoTrackingProjectionJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedReferenceNoTrackingProjectionJetTest.cs @@ -25,10 +25,10 @@ public override async Task Select_root(bool async) AssertSql( """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`Name1`, `s0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s0`.`Name2`, `s0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r7`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `r8`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`OptionalReferenceLeaf_Name`, `s2`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~` +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`Name1`, `s0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s0`.`Name2`, `s0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r7`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `r8`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`OptionalReferenceLeaf_Name`, `s2`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~` FROM ((((((`RootEntities` AS `r` LEFT JOIN ( - SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r3`.`Id1` AS `Id11`, `r3`.`Name` AS `Name1`, `r0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_Name`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r4`.`Id1` AS `Id12`, `r4`.`Name` AS `Name2`, `r0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` + SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r3`.`Id1` AS `Id11`, `r3`.`Name` AS `Name1`, `r0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_Name`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r4`.`Id1` AS `Id12`, `r4`.`Name` AS `Name2`, `r0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` FROM ((`Root_CollectionTrunk` AS `r0` LEFT JOIN ( SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityId1`, `r2`.`Id1` AS `Id10`, `r2`.`Name` AS `Name0`, `r1`.`OptionalReferenceLeaf_Name`, `r1`.`RequiredReferenceLeaf_Name` @@ -52,7 +52,7 @@ LEFT JOIN ( ) AS `s2` ON `r`.`Id` = `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r11` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r12` ON `r`.`Id` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` -ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` """); } @@ -152,10 +152,10 @@ public override async Task Select_root_duplicated(bool async) AssertSql( """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`Name1`, `s0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s0`.`Name2`, `s0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r7`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `r8`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`OptionalReferenceLeaf_Name`, `s2`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `s4`.`RelationshipsRootEntityId`, `s4`.`Id1`, `s4`.`Name`, `s4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s4`.`RelationshipsTrunkEntityId1`, `s4`.`Id10`, `s4`.`Name0`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s4`.`RelationshipsBranchEntityId1`, `s4`.`Id100`, `s4`.`Name00`, `s4`.`OptionalReferenceLeaf_Name`, `s4`.`RequiredReferenceLeaf_Name`, `s4`.`OptionalReferenceBranch_Name`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s4`.`Id11`, `s4`.`Name1`, `s4`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s4`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s4`.`RequiredReferenceBranch_Name`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s4`.`Id12`, `s4`.`Name2`, `s4`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s4`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `s5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s5`.`Id1`, `s5`.`Name`, `s5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s5`.`RelationshipsBranchEntityId1`, `s5`.`Id10`, `s5`.`Name0`, `s5`.`OptionalReferenceLeaf_Name`, `s5`.`RequiredReferenceLeaf_Name`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r20`.`Id1`, `r20`.`Name`, `r21`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r21`.`Id1`, `r21`.`Name`, `s6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s6`.`Id1`, `s6`.`Name`, `s6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s6`.`RelationshipsBranchEntityId1`, `s6`.`Id10`, `s6`.`Name0`, `s6`.`OptionalReferenceLeaf_Name`, `s6`.`RequiredReferenceLeaf_Name`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r24`.`Id1`, `r24`.`Name`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r25`.`Id1`, `r25`.`Name` +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`Name1`, `s0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s0`.`Name2`, `s0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r7`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `r8`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`OptionalReferenceLeaf_Name`, `s2`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `s4`.`RelationshipsRootEntityId`, `s4`.`Id1`, `s4`.`Name`, `s4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s4`.`RelationshipsTrunkEntityId1`, `s4`.`Id10`, `s4`.`Name0`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s4`.`RelationshipsBranchEntityId1`, `s4`.`Id100`, `s4`.`Name00`, `s4`.`OptionalReferenceLeaf_Name`, `s4`.`RequiredReferenceLeaf_Name`, `s4`.`OptionalReferenceBranch_Name`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s4`.`Id11`, `s4`.`Name1`, `s4`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s4`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s4`.`RequiredReferenceBranch_Name`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s4`.`Id12`, `s4`.`Name2`, `s4`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s4`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `s5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s5`.`Id1`, `s5`.`Name`, `s5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s5`.`RelationshipsBranchEntityId1`, `s5`.`Id10`, `s5`.`Name0`, `s5`.`OptionalReferenceLeaf_Name`, `s5`.`RequiredReferenceLeaf_Name`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r20`.`Id1`, `r20`.`Name`, `r21`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r21`.`Id1`, `r21`.`Name`, `s6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s6`.`Id1`, `s6`.`Name`, `s6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s6`.`RelationshipsBranchEntityId1`, `s6`.`Id10`, `s6`.`Name0`, `s6`.`OptionalReferenceLeaf_Name`, `s6`.`RequiredReferenceLeaf_Name`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r24`.`Id1`, `r24`.`Name`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r25`.`Id1`, `r25`.`Name` FROM (((((((((((((`RootEntities` AS `r` LEFT JOIN ( - SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r3`.`Id1` AS `Id11`, `r3`.`Name` AS `Name1`, `r0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_Name`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r4`.`Id1` AS `Id12`, `r4`.`Name` AS `Name2`, `r0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` + SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r3`.`Id1` AS `Id11`, `r3`.`Name` AS `Name1`, `r0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_Name`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r4`.`Id1` AS `Id12`, `r4`.`Name` AS `Name2`, `r0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` FROM ((`Root_CollectionTrunk` AS `r0` LEFT JOIN ( SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityId1`, `r2`.`Id1` AS `Id10`, `r2`.`Name` AS `Name0`, `r1`.`OptionalReferenceLeaf_Name`, `r1`.`RequiredReferenceLeaf_Name` @@ -180,7 +180,7 @@ LEFT JOIN ( LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r11` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r12` ON `r`.`Id` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN ( - SELECT `r13`.`RelationshipsRootEntityId`, `r13`.`Id1`, `r13`.`Name`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`RelationshipsTrunkEntityId1`, `s3`.`Id1` AS `Id10`, `s3`.`Name` AS `Name0`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`Id10` AS `Id100`, `s3`.`Name0` AS `Name00`, `s3`.`OptionalReferenceLeaf_Name`, `s3`.`RequiredReferenceLeaf_Name`, `r13`.`OptionalReferenceBranch_Name`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r16`.`Id1` AS `Id11`, `r16`.`Name` AS `Name1`, `r13`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r13`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r13`.`RequiredReferenceBranch_Name`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r17`.`Id1` AS `Id12`, `r17`.`Name` AS `Name2`, `r13`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r13`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` + SELECT `r13`.`RelationshipsRootEntityId`, `r13`.`Id1`, `r13`.`Name`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`RelationshipsTrunkEntityId1`, `s3`.`Id1` AS `Id10`, `s3`.`Name` AS `Name0`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`Id10` AS `Id100`, `s3`.`Name0` AS `Name00`, `s3`.`OptionalReferenceLeaf_Name`, `s3`.`RequiredReferenceLeaf_Name`, `r13`.`OptionalReferenceBranch_Name`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r16`.`Id1` AS `Id11`, `r16`.`Name` AS `Name1`, `r13`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r13`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r13`.`RequiredReferenceBranch_Name`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r17`.`Id1` AS `Id12`, `r17`.`Name` AS `Name2`, `r13`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r13`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` FROM ((`Root_CollectionTrunk` AS `r13` LEFT JOIN ( SELECT `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r14`.`RelationshipsTrunkEntityId1`, `r14`.`Id1`, `r14`.`Name`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r15`.`RelationshipsBranchEntityId1`, `r15`.`Id1` AS `Id10`, `r15`.`Name` AS `Name0`, `r14`.`OptionalReferenceLeaf_Name`, `r14`.`RequiredReferenceLeaf_Name` @@ -204,7 +204,7 @@ LEFT JOIN ( ) AS `s6` ON `r`.`Id` = `s6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r24` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r25` ON `r`.`Id` = `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` -ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `s4`.`RelationshipsRootEntityId`, `s4`.`Id1`, `s4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s4`.`RelationshipsTrunkEntityId1`, `s4`.`Id10`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s4`.`RelationshipsBranchEntityId1`, `s4`.`Id100`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s4`.`Id11`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s4`.`Id12`, `s5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s5`.`Id1`, `s5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s5`.`RelationshipsBranchEntityId1`, `s5`.`Id10`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r20`.`Id1`, `r21`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r21`.`Id1`, `s6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s6`.`Id1`, `s6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s6`.`RelationshipsBranchEntityId1`, `s6`.`Id10`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r24`.`Id1`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `s4`.`RelationshipsRootEntityId`, `s4`.`Id1`, `s4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s4`.`RelationshipsTrunkEntityId1`, `s4`.`Id10`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s4`.`RelationshipsBranchEntityId1`, `s4`.`Id100`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s4`.`Id11`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s4`.`Id12`, `s5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s5`.`Id1`, `s5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s5`.`RelationshipsBranchEntityId1`, `s5`.`Id10`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r20`.`Id1`, `r21`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r21`.`Id1`, `s6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s6`.`Id1`, `s6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s6`.`RelationshipsBranchEntityId1`, `s6`.`Id10`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r24`.`Id1`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` """); } @@ -268,7 +268,7 @@ public override async Task Select_leaf_trunk_root(bool async) AssertSql( """ -SELECT `r`.`Id`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `s`.`Name0`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Id1`, `r2`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`Id1`, `r3`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s1`.`RelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`RelationshipsTrunkEntityId1`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id100`, `s1`.`Name00`, `s1`.`OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceLeaf_Name`, `s1`.`OptionalReferenceBranch_Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s1`.`Id11`, `s1`.`Name1`, `s1`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s1`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s1`.`RequiredReferenceBranch_Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s1`.`Id12`, `s1`.`Name2`, `s1`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`OptionalReferenceLeaf_Name`, `s2`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`Id1`, `s3`.`Name`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`Id10`, `s3`.`Name0`, `s3`.`OptionalReferenceLeaf_Name`, `s3`.`RequiredReferenceLeaf_Name`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r15`.`Id1`, `r15`.`Name`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r16`.`Id1`, `r16`.`Name` +SELECT `r`.`Id`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `s`.`Name0`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Id1`, `r2`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`Id1`, `r3`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s1`.`RelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`RelationshipsTrunkEntityId1`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id100`, `s1`.`Name00`, `s1`.`OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceLeaf_Name`, `s1`.`OptionalReferenceBranch_Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s1`.`Id11`, `s1`.`Name1`, `s1`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s1`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s1`.`RequiredReferenceBranch_Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s1`.`Id12`, `s1`.`Name2`, `s1`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`OptionalReferenceLeaf_Name`, `s2`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`Id1`, `s3`.`Name`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`Id10`, `s3`.`Name0`, `s3`.`OptionalReferenceLeaf_Name`, `s3`.`RequiredReferenceLeaf_Name`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r15`.`Id1`, `r15`.`Name`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r16`.`Id1`, `r16`.`Name` FROM (((((((((`RootEntities` AS `r` LEFT JOIN ( SELECT `r0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r1`.`RelationshipsBranchEntityId1`, `r1`.`Id1` AS `Id10`, `r1`.`Name` AS `Name0`, `r0`.`OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceLeaf_Name` @@ -278,7 +278,7 @@ LEFT JOIN ( LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r2` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r3` ON `r`.`Id` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN ( - SELECT `r4`.`RelationshipsRootEntityId`, `r4`.`Id1`, `r4`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id1` AS `Id10`, `s0`.`Name` AS `Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id10` AS `Id100`, `s0`.`Name0` AS `Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `r4`.`OptionalReferenceBranch_Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r7`.`Id1` AS `Id11`, `r7`.`Name` AS `Name1`, `r4`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r4`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r4`.`RequiredReferenceBranch_Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r8`.`Id1` AS `Id12`, `r8`.`Name` AS `Name2`, `r4`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r4`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` + SELECT `r4`.`RelationshipsRootEntityId`, `r4`.`Id1`, `r4`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id1` AS `Id10`, `s0`.`Name` AS `Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id10` AS `Id100`, `s0`.`Name0` AS `Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `r4`.`OptionalReferenceBranch_Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r7`.`Id1` AS `Id11`, `r7`.`Name` AS `Name1`, `r4`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r4`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r4`.`RequiredReferenceBranch_Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r8`.`Id1` AS `Id12`, `r8`.`Name` AS `Name2`, `r4`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r4`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` FROM ((`Root_CollectionTrunk` AS `r4` LEFT JOIN ( SELECT `r5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsTrunkEntityId1`, `r5`.`Id1`, `r5`.`Name`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r6`.`RelationshipsBranchEntityId1`, `r6`.`Id1` AS `Id10`, `r6`.`Name` AS `Name0`, `r5`.`OptionalReferenceLeaf_Name`, `r5`.`RequiredReferenceLeaf_Name` @@ -302,7 +302,7 @@ LEFT JOIN ( ) AS `s3` ON `r`.`Id` = `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r15` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r16` ON `r`.`Id` = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` -ORDER BY `r`.`Id`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Id1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`Id1`, `s1`.`RelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`RelationshipsTrunkEntityId1`, `s1`.`Id10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id100`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s1`.`Id11`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s1`.`Id12`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`Id1`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`Id10`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r15`.`Id1`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Id1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`Id1`, `s1`.`RelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`RelationshipsTrunkEntityId1`, `s1`.`Id10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id100`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s1`.`Id11`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s1`.`Id12`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`Id1`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`Id10`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r15`.`Id1`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedReferenceProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedReferenceProjectionJetTest.cs index e0b6ee0c..26d82283 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedReferenceProjectionJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedReferenceProjectionJetTest.cs @@ -27,10 +27,10 @@ public override async Task Select_root(bool async) AssertSql( """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`Name1`, `s0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s0`.`Name2`, `s0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r7`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `r8`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`OptionalReferenceLeaf_Name`, `s2`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~` +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`Name1`, `s0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s0`.`Name2`, `s0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r7`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `r8`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`OptionalReferenceLeaf_Name`, `s2`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~` FROM ((((((`RootEntities` AS `r` LEFT JOIN ( - SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r3`.`Id1` AS `Id11`, `r3`.`Name` AS `Name1`, `r0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_Name`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r4`.`Id1` AS `Id12`, `r4`.`Name` AS `Name2`, `r0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` + SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r3`.`Id1` AS `Id11`, `r3`.`Name` AS `Name1`, `r0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_Name`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r4`.`Id1` AS `Id12`, `r4`.`Name` AS `Name2`, `r0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` FROM ((`Root_CollectionTrunk` AS `r0` LEFT JOIN ( SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityId1`, `r2`.`Id1` AS `Id10`, `r2`.`Name` AS `Name0`, `r1`.`OptionalReferenceLeaf_Name`, `r1`.`RequiredReferenceLeaf_Name` @@ -54,7 +54,7 @@ LEFT JOIN ( ) AS `s2` ON `r`.`Id` = `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r11` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r12` ON `r`.`Id` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` -ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` """); } @@ -64,10 +64,10 @@ public override async Task Select_root_duplicated(bool async) AssertSql( """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`Name1`, `s0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s0`.`Name2`, `s0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r7`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `r8`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`OptionalReferenceLeaf_Name`, `s2`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `s4`.`RelationshipsRootEntityId`, `s4`.`Id1`, `s4`.`Name`, `s4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s4`.`RelationshipsTrunkEntityId1`, `s4`.`Id10`, `s4`.`Name0`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s4`.`RelationshipsBranchEntityId1`, `s4`.`Id100`, `s4`.`Name00`, `s4`.`OptionalReferenceLeaf_Name`, `s4`.`RequiredReferenceLeaf_Name`, `s4`.`OptionalReferenceBranch_Name`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s4`.`Id11`, `s4`.`Name1`, `s4`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s4`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s4`.`RequiredReferenceBranch_Name`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s4`.`Id12`, `s4`.`Name2`, `s4`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s4`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `s5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s5`.`Id1`, `s5`.`Name`, `s5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s5`.`RelationshipsBranchEntityId1`, `s5`.`Id10`, `s5`.`Name0`, `s5`.`OptionalReferenceLeaf_Name`, `s5`.`RequiredReferenceLeaf_Name`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r20`.`Id1`, `r20`.`Name`, `r21`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r21`.`Id1`, `r21`.`Name`, `s6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s6`.`Id1`, `s6`.`Name`, `s6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s6`.`RelationshipsBranchEntityId1`, `s6`.`Id10`, `s6`.`Name0`, `s6`.`OptionalReferenceLeaf_Name`, `s6`.`RequiredReferenceLeaf_Name`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r24`.`Id1`, `r24`.`Name`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r25`.`Id1`, `r25`.`Name` +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`Name1`, `s0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s0`.`Name2`, `s0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`OptionalReferenceLeaf_Name`, `s1`.`RequiredReferenceLeaf_Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r7`.`Name`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `r8`.`Name`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`OptionalReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`OptionalReferenceLeaf_Name`, `s2`.`RequiredReferenceLeaf_Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_OptionalReferenceBranch_RequiredReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_OptionalReferenc~`, `r`.`RequiredReferenceTrunk_RequiredReferenceBranch_RequiredReferenc~`, `s4`.`RelationshipsRootEntityId`, `s4`.`Id1`, `s4`.`Name`, `s4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s4`.`RelationshipsTrunkEntityId1`, `s4`.`Id10`, `s4`.`Name0`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s4`.`RelationshipsBranchEntityId1`, `s4`.`Id100`, `s4`.`Name00`, `s4`.`OptionalReferenceLeaf_Name`, `s4`.`RequiredReferenceLeaf_Name`, `s4`.`OptionalReferenceBranch_Name`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s4`.`Id11`, `s4`.`Name1`, `s4`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `s4`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `s4`.`RequiredReferenceBranch_Name`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s4`.`Id12`, `s4`.`Name2`, `s4`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `s4`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name`, `s5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s5`.`Id1`, `s5`.`Name`, `s5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s5`.`RelationshipsBranchEntityId1`, `s5`.`Id10`, `s5`.`Name0`, `s5`.`OptionalReferenceLeaf_Name`, `s5`.`RequiredReferenceLeaf_Name`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r20`.`Id1`, `r20`.`Name`, `r21`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r21`.`Id1`, `r21`.`Name`, `s6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s6`.`Id1`, `s6`.`Name`, `s6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s6`.`RelationshipsBranchEntityId1`, `s6`.`Id10`, `s6`.`Name0`, `s6`.`OptionalReferenceLeaf_Name`, `s6`.`RequiredReferenceLeaf_Name`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r24`.`Id1`, `r24`.`Name`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r25`.`Id1`, `r25`.`Name` FROM (((((((((((((`RootEntities` AS `r` LEFT JOIN ( - SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r3`.`Id1` AS `Id11`, `r3`.`Name` AS `Name1`, `r0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_Name`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r4`.`Id1` AS `Id12`, `r4`.`Name` AS `Name2`, `r0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` + SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`OptionalReferenceLeaf_Name`, `s`.`RequiredReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_Name`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r3`.`Id1` AS `Id11`, `r3`.`Name` AS `Name1`, `r0`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_Name`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r4`.`Id1` AS `Id12`, `r4`.`Name` AS `Name2`, `r0`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r0`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` FROM ((`Root_CollectionTrunk` AS `r0` LEFT JOIN ( SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityId1`, `r2`.`Id1` AS `Id10`, `r2`.`Name` AS `Name0`, `r1`.`OptionalReferenceLeaf_Name`, `r1`.`RequiredReferenceLeaf_Name` @@ -92,7 +92,7 @@ LEFT JOIN ( LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r11` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r12` ON `r`.`Id` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN ( - SELECT `r13`.`RelationshipsRootEntityId`, `r13`.`Id1`, `r13`.`Name`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`RelationshipsTrunkEntityId1`, `s3`.`Id1` AS `Id10`, `s3`.`Name` AS `Name0`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`Id10` AS `Id100`, `s3`.`Name0` AS `Name00`, `s3`.`OptionalReferenceLeaf_Name`, `s3`.`RequiredReferenceLeaf_Name`, `r13`.`OptionalReferenceBranch_Name`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r16`.`Id1` AS `Id11`, `r16`.`Name` AS `Name1`, `r13`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r13`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r13`.`RequiredReferenceBranch_Name`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r17`.`Id1` AS `Id12`, `r17`.`Name` AS `Name2`, `r13`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r13`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` + SELECT `r13`.`RelationshipsRootEntityId`, `r13`.`Id1`, `r13`.`Name`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`RelationshipsTrunkEntityId1`, `s3`.`Id1` AS `Id10`, `s3`.`Name` AS `Name0`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`Id10` AS `Id100`, `s3`.`Name0` AS `Name00`, `s3`.`OptionalReferenceLeaf_Name`, `s3`.`RequiredReferenceLeaf_Name`, `r13`.`OptionalReferenceBranch_Name`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r16`.`Id1` AS `Id11`, `r16`.`Name` AS `Name1`, `r13`.`OptionalReferenceBranch_OptionalReferenceLeaf_Name`, `r13`.`OptionalReferenceBranch_RequiredReferenceLeaf_Name`, `r13`.`RequiredReferenceBranch_Name`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r17`.`Id1` AS `Id12`, `r17`.`Name` AS `Name2`, `r13`.`RequiredReferenceBranch_OptionalReferenceLeaf_Name`, `r13`.`RequiredReferenceBranch_RequiredReferenceLeaf_Name` FROM ((`Root_CollectionTrunk` AS `r13` LEFT JOIN ( SELECT `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r14`.`RelationshipsTrunkEntityId1`, `r14`.`Id1`, `r14`.`Name`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r15`.`RelationshipsBranchEntityId1`, `r15`.`Id1` AS `Id10`, `r15`.`Name` AS `Name0`, `r14`.`OptionalReferenceLeaf_Name`, `r14`.`RequiredReferenceLeaf_Name` @@ -116,7 +116,7 @@ LEFT JOIN ( ) AS `s6` ON `r`.`Id` = `s6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_CollB7BC1840` AS `r24` ON IIF(`r`.`RequiredReferenceTrunk_OptionalReferenceBranch_Name` IS NOT NULL, `r`.`Id`, NULL) = `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_CollB7BC1840` AS `r25` ON `r`.`Id` = `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` -ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `s4`.`RelationshipsRootEntityId`, `s4`.`Id1`, `s4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s4`.`RelationshipsTrunkEntityId1`, `s4`.`Id10`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s4`.`RelationshipsBranchEntityId1`, `s4`.`Id100`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s4`.`Id11`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s4`.`Id12`, `s5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s5`.`Id1`, `s5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s5`.`RelationshipsBranchEntityId1`, `s5`.`Id10`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r20`.`Id1`, `r21`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r21`.`Id1`, `s6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s6`.`Id1`, `s6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s6`.`RelationshipsBranchEntityId1`, `s6`.`Id10`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r24`.`Id1`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`Id12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`Id10`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`Id1`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`Id1`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `s4`.`RelationshipsRootEntityId`, `s4`.`Id1`, `s4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s4`.`RelationshipsTrunkEntityId1`, `s4`.`Id10`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s4`.`RelationshipsBranchEntityId1`, `s4`.`Id100`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s4`.`Id11`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s4`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s4`.`Id12`, `s5`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s5`.`Id1`, `s5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s5`.`RelationshipsBranchEntityId1`, `s5`.`Id10`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r20`.`Id1`, `r21`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r21`.`Id1`, `s6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s6`.`Id1`, `s6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s6`.`RelationshipsBranchEntityId1`, `s6`.`Id10`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r24`.`Id1`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedTableSplittingNoTrackingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedTableSplittingNoTrackingProjectionJetTest.cs index 56967020..f55fd266 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedTableSplittingNoTrackingProjectionJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedTableSplittingNoTrackingProjectionJetTest.cs @@ -25,19 +25,19 @@ public override async Task Select_trunk_collection(bool async) AssertSql( """ -SELECT `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s0`.`RelationshipsTrunkEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s0`.`RelationshipsTrunkEntityId11`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`Name1`, `s0`.`Name2`, `s0`.`Name3`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s0`.`Id11`, `s0`.`Name4`, `s0`.`Name5`, `s0`.`Name6`, `s0`.`Name7`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `s0`.`Id12`, `s0`.`Name8`, `s0`.`Name9`, `s0`.`Name10` +SELECT `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s0`.`RelationshipsTrunkEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAB35E7B6`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s0`.`RelationshipsTrunkEntityId11`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioE090A91F`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio1D83E82A`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio8B9742A9`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`Name1`, `s0`.`Name2`, `s0`.`Name3`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioD9ECE0E0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s0`.`Id11`, `s0`.`Name4`, `s0`.`Name5`, `s0`.`Name6`, `s0`.`Name7`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio60F6FF19`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `s0`.`Id12`, `s0`.`Name8`, `s0`.`Name9`, `s0`.`Name10` FROM `RootEntities` AS `r` LEFT JOIN ( - SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId0`, `r4`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId10`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId11`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name` AS `Name3`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `r11`.`Id1` AS `Id11`, `r11`.`Name` AS `Name4`, `r2`.`Name` AS `Name5`, `r3`.`Name` AS `Name6`, `r4`.`Name` AS `Name7`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `r12`.`Id1` AS `Id12`, `r12`.`Name` AS `Name8`, `r5`.`Name` AS `Name9`, `r6`.`Name` AS `Name10` + SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId0`, `r4`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId10`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAB35E7B6`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId11`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioE090A91F`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio1D83E82A`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio8B9742A9`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name` AS `Name3`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioD9ECE0E0`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `r11`.`Id1` AS `Id11`, `r11`.`Name` AS `Name4`, `r2`.`Name` AS `Name5`, `r3`.`Name` AS `Name6`, `r4`.`Name` AS `Name7`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio60F6FF19`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `r12`.`Id1` AS `Id12`, `r12`.`Name` AS `Name8`, `r5`.`Name` AS `Name9`, `r6`.`Name` AS `Name10` FROM ((((((((`Root_CollectionTrunk` AS `r0` LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `r1`.`RelationshipsTrunkEntityId1`) - LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_OptionalRef3DABF2A6` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) - LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_RequiredRefEAD29521` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_OptionalRef3A3E5E8C` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_RequiredRef7F36266F` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `r4`.`RelationshipsTrunkEntityId1`) - LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_OptionalRef6DAA31E7` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`RelationshipsTrunkEntityId1` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) - LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_RequiredRefF4CAB043` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`RelationshipsTrunkEntityId1` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_OptionalRefBE35A311` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`RelationshipsTrunkEntityId1` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_RequiredRef3911A89A` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`RelationshipsTrunkEntityId1` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) LEFT JOIN ( - SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`RelationshipsTrunkEntityId1`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` + SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`RelationshipsTrunkEntityId1`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` FROM ((`Root_CollectionTrunk_CollectionBranch` AS `r7` LEFT JOIN `Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf` AS `r8` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`RelationshipsTrunkEntityId1` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r7`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf` AS `r9` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`RelationshipsTrunkEntityId1` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r7`.`Id1` = `r9`.`RelationshipsBranchEntityId1`) @@ -46,7 +46,7 @@ LEFT JOIN ( LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf` AS `r11` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r12` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`RelationshipsTrunkEntityId1` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` ) AS `s0` ON `r`.`Id` = `s0`.`RelationshipsRootEntityId` -ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s0`.`RelationshipsTrunkEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s0`.`RelationshipsTrunkEntityId11`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15` +ORDER BY `r`.`Id`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s0`.`RelationshipsTrunkEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAB35E7B6`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s0`.`RelationshipsTrunkEntityId11`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioE090A91F`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio1D83E82A`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio8B9742A9`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioD9ECE0E0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio60F6FF19`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15` """); } @@ -56,17 +56,17 @@ public override async Task Select_branch_required_collection(bool async) AssertSql( """ -SELECT `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2` +SELECT `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2` FROM (`RootEntities` AS `r` LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) LEFT JOIN ( - SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r3`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r4`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r4`.`Id1` AS `Id10`, `r4`.`Name` AS `Name0`, `r2`.`Name` AS `Name1`, `r3`.`Name` AS `Name2` + SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r3`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r4`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r4`.`Id1` AS `Id10`, `r4`.`Name` AS `Name0`, `r2`.`Name` AS `Name1`, `r3`.`Name` AS `Name2` FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r1` - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1`) - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r3`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRefCBFFDDE0` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0FEDC08C` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r3`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r4`.`RelationshipsBranchEntityId1` ) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` -ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityId11` """); } @@ -76,17 +76,17 @@ public override async Task Select_branch_optional_collection(bool async) AssertSql( """ -SELECT `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2` +SELECT `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2` FROM (`RootEntities` AS `r` LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) LEFT JOIN ( - SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r3`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r4`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r4`.`Id1` AS `Id10`, `r4`.`Name` AS `Name0`, `r2`.`Name` AS `Name1`, `r3`.`Name` AS `Name2` + SELECT `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Id1`, `r1`.`Name`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r3`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r4`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r4`.`Id1` AS `Id10`, `r4`.`Name` AS `Name0`, `r2`.`Name` AS `Name1`, `r3`.`Name` AS `Name2` FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r1` - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1`) - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r3`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRefCBFFDDE0` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0FEDC08C` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r3`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r4`.`RelationshipsBranchEntityId1` ) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` -ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityId11` """); } @@ -96,22 +96,22 @@ public override async Task Select_multiple_branch_leaf(bool async) AssertSql( """ -SELECT `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Name`, `r0`.`RelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`Id1`, `r4`.`Name`, `r2`.`Name`, `r3`.`Name`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`Id1`, `r5`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2` +SELECT `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Name`, `r0`.`RelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`Id1`, `r4`.`Name`, `r2`.`Name`, `r3`.`Name`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`Id1`, `r5`.`Name`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2` FROM ((((((`RootEntities` AS `r` LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti0541F6F6` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ72457FE0` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r5` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti4C268D6C` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ732F7A11` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll8A4684E1` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll8A4684E1` AS `r5` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN ( - SELECT `r6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r6`.`Id1`, `r6`.`Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`RelationshipsBranchEntityId1`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r8`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r9`.`Id1` AS `Id10`, `r9`.`Name` AS `Name0`, `r7`.`Name` AS `Name1`, `r8`.`Name` AS `Name2` + SELECT `r6`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r6`.`Id1`, `r6`.`Name`, `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`RelationshipsBranchEntityId1`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r8`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r9`.`Id1` AS `Id10`, `r9`.`Name` AS `Name0`, `r7`.`Name` AS `Name1`, `r8`.`Name` AS `Name2` FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r6` - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r7` ON `r6`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r6`.`Id1` = `r7`.`RelationshipsBranchEntityId1`) - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r8` ON `r6`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r6`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRefCBFFDDE0` AS `r7` ON `r6`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r7`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r6`.`Id1` = `r7`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0FEDC08C` AS `r8` ON `r6`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r6`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r9` ON `r6`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r6`.`Id1` = `r9`.`RelationshipsBranchEntityId1` ) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` -ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`Id1`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`Id1`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`Id1`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`Id1`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityId11` """); } @@ -214,17 +214,17 @@ public override async Task SelectMany_trunk_collection(bool async) AssertSql( """ -SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r4`.`RelationshipsTrunkEntityId1`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r11`.`Id1`, `r11`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r12`.`Id1`, `r12`.`Name`, `r5`.`Name`, `r6`.`Name` +SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r4`.`RelationshipsTrunkEntityId1`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r11`.`Id1`, `r11`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r12`.`Id1`, `r12`.`Name`, `r5`.`Name`, `r6`.`Name` FROM (((((((((`RootEntities` AS `r` INNER JOIN `Root_CollectionTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `r1`.`RelationshipsTrunkEntityId1`) -LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_OptionalRef3DABF2A6` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) -LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_RequiredRefEAD29521` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) +LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_OptionalRef3A3E5E8C` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) +LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_RequiredRef7F36266F` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `r4`.`RelationshipsTrunkEntityId1`) -LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_OptionalRef6DAA31E7` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`RelationshipsTrunkEntityId1` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) -LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_RequiredRefF4CAB043` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`RelationshipsTrunkEntityId1` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) +LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_OptionalRefBE35A311` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`RelationshipsTrunkEntityId1` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) +LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_RequiredRef3911A89A` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`RelationshipsTrunkEntityId1` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) LEFT JOIN ( - SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`RelationshipsTrunkEntityId1`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` + SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`RelationshipsTrunkEntityId1`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` FROM ((`Root_CollectionTrunk_CollectionBranch` AS `r7` LEFT JOIN `Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf` AS `r8` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`RelationshipsTrunkEntityId1` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r7`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf` AS `r9` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`RelationshipsTrunkEntityId1` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r7`.`Id1` = `r9`.`RelationshipsBranchEntityId1`) @@ -232,7 +232,7 @@ LEFT JOIN ( ) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r0`.`Id1` = `s`.`RelationshipsTrunkEntityId1`) LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_CollectionLeaf` AS `r11` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`RelationshipsTrunkEntityId1` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r12` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r4`.`RelationshipsTrunkEntityId1` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` -ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r4`.`RelationshipsTrunkEntityId1`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r0`.`Id1`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityId1`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r4`.`RelationshipsTrunkEntityId1`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`RelationshipsTrunkEntityId1`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` """); } @@ -246,8 +246,8 @@ public override async Task SelectMany_required_trunk_reference_branch_collection FROM ((((`RootEntities` AS `r` LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1`) -LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r3`.`RelationshipsBranchEntityId1`) +LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRefCBFFDDE0` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1`) +LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0FEDC08C` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r3`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r4`.`RelationshipsBranchEntityId1` WHERE `r0`.`RelationshipsRootEntityId` IS NOT NULL AND `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` IS NOT NULL ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Id1`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityId1`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityId1` @@ -264,8 +264,8 @@ public override async Task SelectMany_optional_trunk_reference_branch_collection FROM ((((`RootEntities` AS `r` LEFT JOIN `Root_OptionalReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRefCCD936D2` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1`) -LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefF60F036D` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r3`.`RelationshipsBranchEntityId1`) +LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRef54763595` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r2`.`RelationshipsBranchEntityId1`) +LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefA12B4078` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r3`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r1`.`Id1` = `r4`.`RelationshipsBranchEntityId1` WHERE `r0`.`RelationshipsRootEntityId` IS NOT NULL AND `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` IS NOT NULL ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r1`.`Id1`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`RelationshipsBranchEntityId1`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityId1`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityId1` diff --git a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedTableSplittingReferenceProjectionNoTrackingJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedTableSplittingReferenceProjectionNoTrackingJetTest.cs index dcfaf877..4a7ebcde 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedTableSplittingReferenceProjectionNoTrackingJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Relationships/Projection/OwnedTableSplittingReferenceProjectionNoTrackingJetTest.cs @@ -25,33 +25,33 @@ public override async Task Select_root(bool async) AssertSql( """ -SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`RelationshipsRootEntityId`, `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s0`.`RelationshipsTrunkEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s0`.`RelationshipsTrunkEntityId11`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`Name1`, `s0`.`Name2`, `s0`.`Name3`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s0`.`Id11`, `s0`.`Name4`, `s0`.`Name5`, `s0`.`Name6`, `s0`.`Name7`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `s0`.`Id12`, `s0`.`Name8`, `s0`.`Name9`, `s0`.`Name10`, `r0`.`Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s1`.`RelationshipsBranchEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s1`.`RelationshipsBranchEntityId11`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`Name1`, `s1`.`Name2`, `r1`.`Name`, `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r31`.`Id1`, `r31`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r32`.`Id1`, `r32`.`Name`, `r5`.`Name`, `r6`.`Name`, `r7`.`Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s2`.`RelationshipsBranchEntityId10`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s2`.`RelationshipsBranchEntityId11`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`Name1`, `s2`.`Name2`, `r8`.`Name`, `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r37`.`Id1`, `r37`.`Name`, `r9`.`Name`, `r10`.`Name`, `r11`.`Name`, `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r38`.`Id1`, `r38`.`Name`, `r12`.`Name`, `r13`.`Name` +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`RelationshipsRootEntityId`, `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s0`.`RelationshipsTrunkEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAB35E7B6`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s0`.`RelationshipsTrunkEntityId11`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioE090A91F`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio1D83E82A`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio8B9742A9`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id100`, `s0`.`Name00`, `s0`.`Name1`, `s0`.`Name2`, `s0`.`Name3`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioD9ECE0E0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s0`.`Id11`, `s0`.`Name4`, `s0`.`Name5`, `s0`.`Name6`, `s0`.`Name7`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio60F6FF19`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `s0`.`Id12`, `s0`.`Name8`, `s0`.`Name9`, `s0`.`Name10`, `r0`.`Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s1`.`RelationshipsBranchEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s1`.`RelationshipsBranchEntityId11`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`Name1`, `s1`.`Name2`, `r1`.`Name`, `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r31`.`Id1`, `r31`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r32`.`Id1`, `r32`.`Name`, `r5`.`Name`, `r6`.`Name`, `r7`.`Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s2`.`RelationshipsBranchEntityId10`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s2`.`RelationshipsBranchEntityId11`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`Name1`, `s2`.`Name2`, `r8`.`Name`, `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r37`.`Id1`, `r37`.`Name`, `r9`.`Name`, `r10`.`Name`, `r11`.`Name`, `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r38`.`Id1`, `r38`.`Name`, `r12`.`Name`, `r13`.`Name` FROM ((((((((((((((((((((`RootEntities` AS `r` LEFT JOIN `Root_OptionalReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Opti4796B722` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Requ4EDDE18D` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Opti03945829` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_RequBB464F25` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Opti0EF40F72` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_RequFA89F212` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Opti5E8F9C73` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Requ91D0AE6E` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_RequiredReferenceTrunk` AS `r7` ON `r`.`Id` = `r7`.`RelationshipsRootEntityId`) LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch` AS `r8` ON `r7`.`RelationshipsRootEntityId` = `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptiC2882DFA` AS `r9` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ6B3E679F` AS `r10` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Opti5972E473` AS `r9` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ0F95E2EB` AS `r10` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch` AS `r11` ON `r7`.`RelationshipsRootEntityId` = `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti0541F6F6` AS `r12` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ72457FE0` AS `r13` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti4C268D6C` AS `r12` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ732F7A11` AS `r13` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN ( - SELECT `r14`.`RelationshipsRootEntityId`, `r14`.`Id1`, `r14`.`Name`, `r15`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r15`.`RelationshipsTrunkEntityId1`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId0`, `r18`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId10`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId11`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`Name1`, `s`.`Name2`, `r15`.`Name` AS `Name3`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `r25`.`Id1` AS `Id11`, `r25`.`Name` AS `Name4`, `r16`.`Name` AS `Name5`, `r17`.`Name` AS `Name6`, `r18`.`Name` AS `Name7`, `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `r26`.`Id1` AS `Id12`, `r26`.`Name` AS `Name8`, `r19`.`Name` AS `Name9`, `r20`.`Name` AS `Name10` + SELECT `r14`.`RelationshipsRootEntityId`, `r14`.`Id1`, `r14`.`Name`, `r15`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r15`.`RelationshipsTrunkEntityId1`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId0`, `r18`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId10`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAB35E7B6`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId11`, `s`.`Id1` AS `Id10`, `s`.`Name` AS `Name0`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioE090A91F`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio1D83E82A`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio8B9742A9`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10` AS `Id100`, `s`.`Name0` AS `Name00`, `s`.`Name1`, `s`.`Name2`, `r15`.`Name` AS `Name3`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioD9ECE0E0`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `r25`.`Id1` AS `Id11`, `r25`.`Name` AS `Name4`, `r16`.`Name` AS `Name5`, `r17`.`Name` AS `Name6`, `r18`.`Name` AS `Name7`, `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio60F6FF19`, `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `r26`.`Id1` AS `Id12`, `r26`.`Name` AS `Name8`, `r19`.`Name` AS `Name9`, `r20`.`Name` AS `Name10` FROM ((((((((`Root_CollectionTrunk` AS `r14` LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch` AS `r15` ON `r14`.`RelationshipsRootEntityId` = `r15`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r14`.`Id1` = `r15`.`RelationshipsTrunkEntityId1`) - LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_OptionalRef3DABF2A6` AS `r16` ON `r15`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r15`.`RelationshipsTrunkEntityId1` = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) - LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_RequiredRefEAD29521` AS `r17` ON `r15`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r15`.`RelationshipsTrunkEntityId1` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_OptionalRef3A3E5E8C` AS `r16` ON `r15`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r15`.`RelationshipsTrunkEntityId1` = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_RequiredRef7F36266F` AS `r17` ON `r15`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r15`.`RelationshipsTrunkEntityId1` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch` AS `r18` ON `r14`.`RelationshipsRootEntityId` = `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r14`.`Id1` = `r18`.`RelationshipsTrunkEntityId1`) - LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_OptionalRef6DAA31E7` AS `r19` ON `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r18`.`RelationshipsTrunkEntityId1` = `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) - LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_RequiredRefF4CAB043` AS `r20` ON `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r18`.`RelationshipsTrunkEntityId1` = `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_OptionalRefBE35A311` AS `r19` ON `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r18`.`RelationshipsTrunkEntityId1` = `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_RequiredRef3911A89A` AS `r20` ON `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r18`.`RelationshipsTrunkEntityId1` = `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) LEFT JOIN ( - SELECT `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r21`.`RelationshipsTrunkEntityId1`, `r21`.`Id1`, `r21`.`Name`, `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r22`.`RelationshipsBranchEntityId1`, `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r23`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r24`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r24`.`Id1` AS `Id10`, `r24`.`Name` AS `Name0`, `r22`.`Name` AS `Name1`, `r23`.`Name` AS `Name2` + SELECT `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r21`.`RelationshipsTrunkEntityId1`, `r21`.`Id1`, `r21`.`Name`, `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r22`.`RelationshipsBranchEntityId1`, `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r23`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r24`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r24`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r24`.`Id1` AS `Id10`, `r24`.`Name` AS `Name0`, `r22`.`Name` AS `Name1`, `r23`.`Name` AS `Name2` FROM ((`Root_CollectionTrunk_CollectionBranch` AS `r21` LEFT JOIN `Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf` AS `r22` ON `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r21`.`RelationshipsTrunkEntityId1` = `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r21`.`Id1` = `r22`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf` AS `r23` ON `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r21`.`RelationshipsTrunkEntityId1` = `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r21`.`Id1` = `r23`.`RelationshipsBranchEntityId1`) @@ -61,24 +61,24 @@ LEFT JOIN ( LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r26` ON `r18`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r18`.`RelationshipsTrunkEntityId1` = `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` ) AS `s0` ON `r`.`Id` = `s0`.`RelationshipsRootEntityId`) LEFT JOIN ( - SELECT `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r27`.`Id1`, `r27`.`Name`, `r28`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r28`.`RelationshipsBranchEntityId1`, `r29`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r29`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r30`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r30`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r30`.`Id1` AS `Id10`, `r30`.`Name` AS `Name0`, `r28`.`Name` AS `Name1`, `r29`.`Name` AS `Name2` + SELECT `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r27`.`Id1`, `r27`.`Name`, `r28`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r28`.`RelationshipsBranchEntityId1`, `r29`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r29`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r30`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r30`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r30`.`Id1` AS `Id10`, `r30`.`Name` AS `Name0`, `r28`.`Name` AS `Name1`, `r29`.`Name` AS `Name2` FROM ((`Root_OptionalReferenceTrunk_CollectionBranch` AS `r27` - LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRefCCD936D2` AS `r28` ON `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r28`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r27`.`Id1` = `r28`.`RelationshipsBranchEntityId1`) - LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefF60F036D` AS `r29` ON `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r29`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r27`.`Id1` = `r29`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRef54763595` AS `r28` ON `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r28`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r27`.`Id1` = `r28`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefA12B4078` AS `r29` ON `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r29`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r27`.`Id1` = `r29`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r30` ON `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r30`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r27`.`Id1` = `r30`.`RelationshipsBranchEntityId1` ) AS `s1` ON `r0`.`RelationshipsRootEntityId` = `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Coll36EF62D9` AS `r31` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB02F0DA8` AS `r32` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollBC805944` AS `r31` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Coll7D327F6C` AS `r32` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN ( - SELECT `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r33`.`Id1`, `r33`.`Name`, `r34`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r34`.`RelationshipsBranchEntityId1`, `r35`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r35`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r36`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r36`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r36`.`Id1` AS `Id10`, `r36`.`Name` AS `Name0`, `r34`.`Name` AS `Name1`, `r35`.`Name` AS `Name2` + SELECT `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r33`.`Id1`, `r33`.`Name`, `r34`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r34`.`RelationshipsBranchEntityId1`, `r35`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r35`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r36`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r36`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r36`.`Id1` AS `Id10`, `r36`.`Name` AS `Name0`, `r34`.`Name` AS `Name1`, `r35`.`Name` AS `Name2` FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r33` - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r34` ON `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r34`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r33`.`Id1` = `r34`.`RelationshipsBranchEntityId1`) - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r35` ON `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r35`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r33`.`Id1` = `r35`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRefCBFFDDE0` AS `r34` ON `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r34`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r33`.`Id1` = `r34`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0FEDC08C` AS `r35` ON `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r35`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r33`.`Id1` = `r35`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r36` ON `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r36`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r33`.`Id1` = `r36`.`RelationshipsBranchEntityId1` ) AS `s2` ON `r7`.`RelationshipsRootEntityId` = `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll225D701E` AS `r37` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r38` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` -ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`RelationshipsRootEntityId`, `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s0`.`RelationshipsTrunkEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s0`.`RelationshipsTrunkEntityId11`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `s0`.`Id12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s1`.`RelationshipsBranchEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s1`.`RelationshipsBranchEntityId11`, `s1`.`Id10`, `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r31`.`Id1`, `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r32`.`Id1`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s2`.`RelationshipsBranchEntityId10`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s2`.`RelationshipsBranchEntityId11`, `s2`.`Id10`, `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r37`.`Id1`, `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll65358A09` AS `r37` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll8A4684E1` AS `r38` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`RelationshipsRootEntityId`, `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`RelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s0`.`RelationshipsTrunkEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAB35E7B6`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s0`.`RelationshipsTrunkEntityId11`, `s0`.`Id10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioE090A91F`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio1D83E82A`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio8B9742A9`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id100`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioD9ECE0E0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s0`.`Id11`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio60F6FF19`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `s0`.`Id12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s1`.`RelationshipsBranchEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s1`.`RelationshipsBranchEntityId11`, `s1`.`Id10`, `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r31`.`Id1`, `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r32`.`Id1`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s2`.`RelationshipsBranchEntityId10`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s2`.`RelationshipsBranchEntityId11`, `s2`.`Id10`, `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r37`.`Id1`, `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` """); } @@ -88,25 +88,25 @@ public override async Task Select_trunk_optional(bool async) AssertSql( """ -SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r5`.`Name`, `r6`.`Name` +SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r5`.`Name`, `r6`.`Name` FROM (((((((((`RootEntities` AS `r` LEFT JOIN `Root_OptionalReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Opti4796B722` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Requ4EDDE18D` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Opti03945829` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_RequBB464F25` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Opti0EF40F72` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_RequFA89F212` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Opti5E8F9C73` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Requ91D0AE6E` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN ( - SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` + SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` FROM ((`Root_OptionalReferenceTrunk_CollectionBranch` AS `r7` - LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRefCCD936D2` AS `r8` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) - LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefF60F036D` AS `r9` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r9`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRef54763595` AS `r8` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefA12B4078` AS `r9` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r9`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r10` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r10`.`RelationshipsBranchEntityId1` ) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Coll36EF62D9` AS `r11` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB02F0DA8` AS `r12` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` -ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollBC805944` AS `r11` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Coll7D327F6C` AS `r12` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` """); } @@ -116,25 +116,25 @@ public override async Task Select_trunk_required(bool async) AssertSql( """ -SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r5`.`Name`, `r6`.`Name` +SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r5`.`Name`, `r6`.`Name` FROM (((((((((`RootEntities` AS `r` LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptiC2882DFA` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ6B3E679F` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Opti5972E473` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ0F95E2EB` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti0541F6F6` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ72457FE0` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti4C268D6C` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ732F7A11` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN ( - SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` + SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r7` - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r8` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r9` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r9`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRefCBFFDDE0` AS `r8` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0FEDC08C` AS `r9` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r9`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r10` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r10`.`RelationshipsBranchEntityId1` ) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll225D701E` AS `r11` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r12` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` -ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll65358A09` AS `r11` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll8A4684E1` AS `r12` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` """); } @@ -148,9 +148,9 @@ public override async Task Select_branch_required_required(bool async) FROM ((((`RootEntities` AS `r` LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti0541F6F6` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ72457FE0` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti4C268D6C` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ732F7A11` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll8A4684E1` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` """); } @@ -165,9 +165,9 @@ public override async Task Select_branch_required_optional(bool async) FROM ((((`RootEntities` AS `r` LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptiC2882DFA` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ6B3E679F` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll225D701E` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Opti5972E473` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ0F95E2EB` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll65358A09` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` """); } @@ -182,9 +182,9 @@ public override async Task Select_branch_optional_required(bool async) FROM ((((`RootEntities` AS `r` LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti0541F6F6` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ72457FE0` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti4C268D6C` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ732F7A11` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll8A4684E1` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` """); } @@ -199,9 +199,9 @@ public override async Task Select_branch_optional_optional(bool async) FROM ((((`RootEntities` AS `r` LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptiC2882DFA` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ6B3E679F` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll225D701E` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Opti5972E473` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ0F95E2EB` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll65358A09` AS `r4` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` """); } @@ -312,36 +312,36 @@ public override async Task Select_trunk_and_branch_duplicated(bool async) AssertSql( """ -SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r5`.`Name`, `r6`.`Name`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`Id1`, `r13`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`Name1`, `s0`.`Name2`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r18`.`Id1`, `r18`.`Name`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r19`.`Id1`, `r19`.`Name`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r20`.`Id1`, `r20`.`Name` +SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r5`.`Name`, `r6`.`Name`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`Id1`, `r13`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`Name1`, `s0`.`Name2`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r18`.`Id1`, `r18`.`Name`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r19`.`Id1`, `r19`.`Name`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r20`.`Id1`, `r20`.`Name` FROM ((((((((((((((`RootEntities` AS `r` LEFT JOIN `Root_OptionalReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Opti4796B722` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Requ4EDDE18D` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Opti03945829` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_RequBB464F25` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Opti0EF40F72` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_RequFA89F212` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Opti5E8F9C73` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Requ91D0AE6E` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN ( - SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` + SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` FROM ((`Root_OptionalReferenceTrunk_CollectionBranch` AS `r7` - LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRefCCD936D2` AS `r8` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) - LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefF60F036D` AS `r9` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r9`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRef54763595` AS `r8` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefA12B4078` AS `r9` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r9`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r10` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r10`.`RelationshipsBranchEntityId1` ) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Coll36EF62D9` AS `r11` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB02F0DA8` AS `r12` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB02F0DA8` AS `r13` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollBC805944` AS `r11` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Coll7D327F6C` AS `r12` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Coll7D327F6C` AS `r13` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN ( - SELECT `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r14`.`Id1`, `r14`.`Name`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r15`.`RelationshipsBranchEntityId1`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r16`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r17`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r17`.`Id1` AS `Id10`, `r17`.`Name` AS `Name0`, `r15`.`Name` AS `Name1`, `r16`.`Name` AS `Name2` + SELECT `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r14`.`Id1`, `r14`.`Name`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r15`.`RelationshipsBranchEntityId1`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r16`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r17`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r17`.`Id1` AS `Id10`, `r17`.`Name` AS `Name0`, `r15`.`Name` AS `Name1`, `r16`.`Name` AS `Name2` FROM ((`Root_OptionalReferenceTrunk_CollectionBranch` AS `r14` - LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRefCCD936D2` AS `r15` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`Id1` = `r15`.`RelationshipsBranchEntityId1`) - LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefF60F036D` AS `r16` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`Id1` = `r16`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRef54763595` AS `r15` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`Id1` = `r15`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefA12B4078` AS `r16` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`Id1` = `r16`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r17` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`Id1` = `r17`.`RelationshipsBranchEntityId1` ) AS `s0` ON `r0`.`RelationshipsRootEntityId` = `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Coll36EF62D9` AS `r18` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB02F0DA8` AS `r19` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB02F0DA8` AS `r20` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` -ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id10`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r18`.`Id1`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r19`.`Id1`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollBC805944` AS `r18` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Coll7D327F6C` AS `r19` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Coll7D327F6C` AS `r20` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id10`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r18`.`Id1`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r19`.`Id1`, `r20`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` """); } @@ -351,34 +351,34 @@ public override async Task Select_trunk_and_trunk_duplicated(bool async) AssertSql( """ -SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r5`.`Name`, `r6`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`Name1`, `s0`.`Name2`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r17`.`Id1`, `r17`.`Name`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r18`.`Id1`, `r18`.`Name` +SELECT `r0`.`RelationshipsRootEntityId`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r1`.`Name`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r11`.`Name`, `r2`.`Name`, `r3`.`Name`, `r4`.`Name`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `r12`.`Name`, `r5`.`Name`, `r6`.`Name`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`Name`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id10`, `s0`.`Name0`, `s0`.`Name1`, `s0`.`Name2`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r17`.`Id1`, `r17`.`Name`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r18`.`Id1`, `r18`.`Name` FROM ((((((((((((`RootEntities` AS `r` LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptiC2882DFA` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ6B3E679F` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Opti5972E473` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ0F95E2EB` AS `r3` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch` AS `r4` ON `r0`.`RelationshipsRootEntityId` = `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti0541F6F6` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ72457FE0` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti4C268D6C` AS `r5` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ732F7A11` AS `r6` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN ( - SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` + SELECT `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r7`.`Id1`, `r7`.`Name`, `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r8`.`RelationshipsBranchEntityId1`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r9`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r10`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r10`.`Id1` AS `Id10`, `r10`.`Name` AS `Name0`, `r8`.`Name` AS `Name1`, `r9`.`Name` AS `Name2` FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r7` - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r8` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r9` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r9`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRefCBFFDDE0` AS `r8` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r8`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r8`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0FEDC08C` AS `r9` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r9`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r10` ON `r7`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r7`.`Id1` = `r10`.`RelationshipsBranchEntityId1` ) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll225D701E` AS `r11` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r12` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll65358A09` AS `r11` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll8A4684E1` AS `r12` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN ( - SELECT `r13`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r13`.`Id1`, `r13`.`Name`, `r14`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r14`.`RelationshipsBranchEntityId1`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r15`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r16`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r16`.`Id1` AS `Id10`, `r16`.`Name` AS `Name0`, `r14`.`Name` AS `Name1`, `r15`.`Name` AS `Name2` + SELECT `r13`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r13`.`Id1`, `r13`.`Name`, `r14`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r14`.`RelationshipsBranchEntityId1`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r15`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r16`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r16`.`Id1` AS `Id10`, `r16`.`Name` AS `Name0`, `r14`.`Name` AS `Name1`, `r15`.`Name` AS `Name2` FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r13` - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r14` ON `r13`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r14`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r13`.`Id1` = `r14`.`RelationshipsBranchEntityId1`) - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r15` ON `r13`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r13`.`Id1` = `r15`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRefCBFFDDE0` AS `r14` ON `r13`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r14`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r13`.`Id1` = `r14`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0FEDC08C` AS `r15` ON `r13`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r13`.`Id1` = `r15`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r16` ON `r13`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r13`.`Id1` = `r16`.`RelationshipsBranchEntityId1` ) AS `s0` ON `r0`.`RelationshipsRootEntityId` = `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll225D701E` AS `r17` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r18` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` -ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id10`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r17`.`Id1`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll65358A09` AS `r17` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll8A4684E1` AS `r18` ON `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r4`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r11`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`Id1`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r12`.`Id1`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s0`.`Id1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id10`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r17`.`Id1`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` """); } @@ -388,42 +388,42 @@ public override async Task Select_leaf_trunk_root(bool async) AssertSql( """ -SELECT `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Name`, `r0`.`RelationshipsRootEntityId`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`RelationshipsRootEntityId`, `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r3`.`Name`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r18`.`Id1`, `r18`.`Name`, `r4`.`Name`, `r5`.`Name`, `r1`.`Name`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r19`.`Id1`, `r19`.`Name`, `r6`.`Name`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s1`.`RelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`RelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s1`.`RelationshipsTrunkEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s1`.`RelationshipsTrunkEntityId11`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s1`.`RelationshipsBranchEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s1`.`RelationshipsBranchEntityId11`, `s1`.`Id100`, `s1`.`Name00`, `s1`.`Name1`, `s1`.`Name2`, `s1`.`Name3`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s1`.`Id11`, `s1`.`Name4`, `s1`.`Name5`, `s1`.`Name6`, `s1`.`Name7`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `s1`.`Id12`, `s1`.`Name8`, `s1`.`Name9`, `s1`.`Name10`, `r7`.`Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s2`.`RelationshipsBranchEntityId10`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s2`.`RelationshipsBranchEntityId11`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`Name1`, `s2`.`Name2`, `r8`.`Name`, `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r37`.`Id1`, `r37`.`Name`, `r9`.`Name`, `r10`.`Name`, `r11`.`Name`, `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r38`.`Id1`, `r38`.`Name`, `r12`.`Name`, `r13`.`Name`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`Id1`, `s3`.`Name`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s3`.`RelationshipsBranchEntityId10`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s3`.`RelationshipsBranchEntityId11`, `s3`.`Id10`, `s3`.`Name0`, `s3`.`Name1`, `s3`.`Name2`, `r43`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r43`.`Id1`, `r43`.`Name`, `r44`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r44`.`Id1`, `r44`.`Name` +SELECT `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r2`.`Name`, `r0`.`RelationshipsRootEntityId`, `r0`.`Name`, `r`.`Id`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`RelationshipsRootEntityId`, `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`Name`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `s`.`Name0`, `s`.`Name1`, `s`.`Name2`, `r3`.`Name`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r18`.`Id1`, `r18`.`Name`, `r4`.`Name`, `r5`.`Name`, `r1`.`Name`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r19`.`Id1`, `r19`.`Name`, `r6`.`Name`, `r`.`Name`, `r`.`OptionalReferenceTrunkId`, `r`.`RequiredReferenceTrunkId`, `s1`.`RelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`Name`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`RelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s1`.`RelationshipsTrunkEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAB35E7B6`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s1`.`RelationshipsTrunkEntityId11`, `s1`.`Id10`, `s1`.`Name0`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioE090A91F`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio1D83E82A`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s1`.`RelationshipsBranchEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio8B9742A9`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s1`.`RelationshipsBranchEntityId11`, `s1`.`Id100`, `s1`.`Name00`, `s1`.`Name1`, `s1`.`Name2`, `s1`.`Name3`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioD9ECE0E0`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s1`.`Id11`, `s1`.`Name4`, `s1`.`Name5`, `s1`.`Name6`, `s1`.`Name7`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio60F6FF19`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `s1`.`Id12`, `s1`.`Name8`, `s1`.`Name9`, `s1`.`Name10`, `r7`.`Name`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`Name`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s2`.`RelationshipsBranchEntityId10`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s2`.`RelationshipsBranchEntityId11`, `s2`.`Id10`, `s2`.`Name0`, `s2`.`Name1`, `s2`.`Name2`, `r8`.`Name`, `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r37`.`Id1`, `r37`.`Name`, `r9`.`Name`, `r10`.`Name`, `r11`.`Name`, `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r38`.`Id1`, `r38`.`Name`, `r12`.`Name`, `r13`.`Name`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`Id1`, `s3`.`Name`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s3`.`RelationshipsBranchEntityId10`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s3`.`RelationshipsBranchEntityId11`, `s3`.`Id10`, `s3`.`Name0`, `s3`.`Name1`, `s3`.`Name2`, `r43`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r43`.`Id1`, `r43`.`Name`, `r44`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r44`.`Id1`, `r44`.`Name` FROM (((((((((((((((((((((((`RootEntities` AS `r` LEFT JOIN `Root_RequiredReferenceTrunk` AS `r0` ON `r`.`Id` = `r0`.`RelationshipsRootEntityId`) LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch` AS `r1` ON `r0`.`RelationshipsRootEntityId` = `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ72457FE0` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Requ732F7A11` AS `r2` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch` AS `r3` ON `r0`.`RelationshipsRootEntityId` = `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_OptiC2882DFA` AS `r4` ON `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ6B3E679F` AS `r5` ON `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti0541F6F6` AS `r6` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Opti5972E473` AS `r4` ON `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Requ0F95E2EB` AS `r5` ON `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Opti4C268D6C` AS `r6` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_OptionalReferenceTrunk` AS `r7` ON `r`.`Id` = `r7`.`RelationshipsRootEntityId`) LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch` AS `r8` ON `r7`.`RelationshipsRootEntityId` = `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Opti4796B722` AS `r9` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Requ4EDDE18D` AS `r10` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Opti03945829` AS `r9` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_RequBB464F25` AS `r10` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch` AS `r11` ON `r7`.`RelationshipsRootEntityId` = `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Opti0EF40F72` AS `r12` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_RequFA89F212` AS `r13` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Opti5E8F9C73` AS `r12` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Requ91D0AE6E` AS `r13` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN ( - SELECT `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r14`.`Id1`, `r14`.`Name`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r15`.`RelationshipsBranchEntityId1`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r16`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r17`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r17`.`Id1` AS `Id10`, `r17`.`Name` AS `Name0`, `r15`.`Name` AS `Name1`, `r16`.`Name` AS `Name2` + SELECT `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r14`.`Id1`, `r14`.`Name`, `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r15`.`RelationshipsBranchEntityId1`, `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r16`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r17`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r17`.`Id1` AS `Id10`, `r17`.`Name` AS `Name0`, `r15`.`Name` AS `Name1`, `r16`.`Name` AS `Name2` FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r14` - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r15` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`Id1` = `r15`.`RelationshipsBranchEntityId1`) - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r16` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`Id1` = `r16`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRefCBFFDDE0` AS `r15` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r15`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`Id1` = `r15`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0FEDC08C` AS `r16` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r16`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`Id1` = `r16`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r17` ON `r14`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r17`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r14`.`Id1` = `r17`.`RelationshipsBranchEntityId1` ) AS `s` ON `r0`.`RelationshipsRootEntityId` = `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll225D701E` AS `r18` ON `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r19` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll65358A09` AS `r18` ON `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll8A4684E1` AS `r19` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN ( - SELECT `r20`.`RelationshipsRootEntityId`, `r20`.`Id1`, `r20`.`Name`, `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r21`.`RelationshipsTrunkEntityId1`, `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r24`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId0`, `r24`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId10`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s0`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId11`, `s0`.`Id1` AS `Id10`, `s0`.`Name` AS `Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id10` AS `Id100`, `s0`.`Name0` AS `Name00`, `s0`.`Name1`, `s0`.`Name2`, `r21`.`Name` AS `Name3`, `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `r31`.`Id1` AS `Id11`, `r31`.`Name` AS `Name4`, `r22`.`Name` AS `Name5`, `r23`.`Name` AS `Name6`, `r24`.`Name` AS `Name7`, `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `r32`.`Id1` AS `Id12`, `r32`.`Name` AS `Name8`, `r25`.`Name` AS `Name9`, `r26`.`Name` AS `Name10` + SELECT `r20`.`RelationshipsRootEntityId`, `r20`.`Id1`, `r20`.`Name`, `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r21`.`RelationshipsTrunkEntityId1`, `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r24`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId0`, `r24`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId10`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAB35E7B6`, `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s0`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AS `RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s0`.`RelationshipsTrunkEntityId1` AS `RelationshipsTrunkEntityId11`, `s0`.`Id1` AS `Id10`, `s0`.`Name` AS `Name0`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioE090A91F`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s0`.`RelationshipsBranchEntityId1`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio1D83E82A`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s0`.`RelationshipsBranchEntityId10`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio8B9742A9`, `s0`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s0`.`RelationshipsBranchEntityId11`, `s0`.`Id10` AS `Id100`, `s0`.`Name0` AS `Name00`, `s0`.`Name1`, `s0`.`Name2`, `r21`.`Name` AS `Name3`, `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioD9ECE0E0`, `r31`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `r31`.`Id1` AS `Id11`, `r31`.`Name` AS `Name4`, `r22`.`Name` AS `Name5`, `r23`.`Name` AS `Name6`, `r24`.`Name` AS `Name7`, `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio60F6FF19`, `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `r32`.`Id1` AS `Id12`, `r32`.`Name` AS `Name8`, `r25`.`Name` AS `Name9`, `r26`.`Name` AS `Name10` FROM ((((((((`Root_CollectionTrunk` AS `r20` LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch` AS `r21` ON `r20`.`RelationshipsRootEntityId` = `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r20`.`Id1` = `r21`.`RelationshipsTrunkEntityId1`) - LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_OptionalRef3DABF2A6` AS `r22` ON `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r21`.`RelationshipsTrunkEntityId1` = `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) - LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_RequiredRefEAD29521` AS `r23` ON `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r21`.`RelationshipsTrunkEntityId1` = `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_OptionalRef3A3E5E8C` AS `r22` ON `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r21`.`RelationshipsTrunkEntityId1` = `r22`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_OptionalReferenceBranch_RequiredRef7F36266F` AS `r23` ON `r21`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r21`.`RelationshipsTrunkEntityId1` = `r23`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch` AS `r24` ON `r20`.`RelationshipsRootEntityId` = `r24`.`RelationshipsTrunkEntityRelationshipsRootEntityId` AND `r20`.`Id1` = `r24`.`RelationshipsTrunkEntityId1`) - LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_OptionalRef6DAA31E7` AS `r25` ON `r24`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r24`.`RelationshipsTrunkEntityId1` = `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) - LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_RequiredRefF4CAB043` AS `r26` ON `r24`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r24`.`RelationshipsTrunkEntityId1` = `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_OptionalRefBE35A311` AS `r25` ON `r24`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r24`.`RelationshipsTrunkEntityId1` = `r25`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) + LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_RequiredRef3911A89A` AS `r26` ON `r24`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r24`.`RelationshipsTrunkEntityId1` = `r26`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`) LEFT JOIN ( - SELECT `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r27`.`RelationshipsTrunkEntityId1`, `r27`.`Id1`, `r27`.`Name`, `r28`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r28`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r28`.`RelationshipsBranchEntityId1`, `r29`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r29`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r29`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r30`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r30`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r30`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r30`.`Id1` AS `Id10`, `r30`.`Name` AS `Name0`, `r28`.`Name` AS `Name1`, `r29`.`Name` AS `Name2` + SELECT `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r27`.`RelationshipsTrunkEntityId1`, `r27`.`Id1`, `r27`.`Name`, `r28`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r28`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `r28`.`RelationshipsBranchEntityId1`, `r29`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r29`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `r29`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r30`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r30`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AS `RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `r30`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r30`.`Id1` AS `Id10`, `r30`.`Name` AS `Name0`, `r28`.`Name` AS `Name1`, `r29`.`Name` AS `Name2` FROM ((`Root_CollectionTrunk_CollectionBranch` AS `r27` LEFT JOIN `Root_CollectionTrunk_CollectionBranch_OptionalReferenceLeaf` AS `r28` ON `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r28`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r27`.`RelationshipsTrunkEntityId1` = `r28`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r27`.`Id1` = `r28`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_CollectionTrunk_CollectionBranch_RequiredReferenceLeaf` AS `r29` ON `r27`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r29`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r27`.`RelationshipsTrunkEntityId1` = `r29`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` AND `r27`.`Id1` = `r29`.`RelationshipsBranchEntityId1`) @@ -433,24 +433,24 @@ LEFT JOIN ( LEFT JOIN `Root_CollectionTrunk_RequiredReferenceBranch_CollectionLeaf` AS `r32` ON `r24`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r24`.`RelationshipsTrunkEntityId1` = `r32`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1` ) AS `s1` ON `r`.`Id` = `s1`.`RelationshipsRootEntityId`) LEFT JOIN ( - SELECT `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r33`.`Id1`, `r33`.`Name`, `r34`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r34`.`RelationshipsBranchEntityId1`, `r35`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r35`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r36`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r36`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r36`.`Id1` AS `Id10`, `r36`.`Name` AS `Name0`, `r34`.`Name` AS `Name1`, `r35`.`Name` AS `Name2` + SELECT `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r33`.`Id1`, `r33`.`Name`, `r34`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r34`.`RelationshipsBranchEntityId1`, `r35`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r35`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r36`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r36`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r36`.`Id1` AS `Id10`, `r36`.`Name` AS `Name0`, `r34`.`Name` AS `Name1`, `r35`.`Name` AS `Name2` FROM ((`Root_OptionalReferenceTrunk_CollectionBranch` AS `r33` - LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRefCCD936D2` AS `r34` ON `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r34`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r33`.`Id1` = `r34`.`RelationshipsBranchEntityId1`) - LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefF60F036D` AS `r35` ON `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r35`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r33`.`Id1` = `r35`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_OptionalRef54763595` AS `r34` ON `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r34`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r33`.`Id1` = `r34`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_RequiredRefA12B4078` AS `r35` ON `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r35`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r33`.`Id1` = `r35`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_OptionalReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r36` ON `r33`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r36`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r33`.`Id1` = `r36`.`RelationshipsBranchEntityId1` ) AS `s2` ON `r7`.`RelationshipsRootEntityId` = `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_Coll36EF62D9` AS `r37` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_CollB02F0DA8` AS `r38` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_OptionalReferenceBranch_CollBC805944` AS `r37` ON `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_OptionalReferenceTrunk_RequiredReferenceBranch_Coll7D327F6C` AS `r38` ON `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) LEFT JOIN ( - SELECT `r39`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r39`.`Id1`, `r39`.`Name`, `r40`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r40`.`RelationshipsBranchEntityId1`, `r41`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `r41`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r42`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `r42`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r42`.`Id1` AS `Id10`, `r42`.`Name` AS `Name0`, `r40`.`Name` AS `Name1`, `r41`.`Name` AS `Name2` + SELECT `r39`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r39`.`Id1`, `r39`.`Name`, `r40`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r40`.`RelationshipsBranchEntityId1`, `r41`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `r41`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId10`, `r42`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AS `RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `r42`.`RelationshipsBranchEntityId1` AS `RelationshipsBranchEntityId11`, `r42`.`Id1` AS `Id10`, `r42`.`Name` AS `Name0`, `r40`.`Name` AS `Name1`, `r41`.`Name` AS `Name2` FROM ((`Root_RequiredReferenceTrunk_CollectionBranch` AS `r39` - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRef5715C630` AS `r40` ON `r39`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r40`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r39`.`Id1` = `r40`.`RelationshipsBranchEntityId1`) - LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0E54E2D4` AS `r41` ON `r39`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r41`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r39`.`Id1` = `r41`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_OptionalRefCBFFDDE0` AS `r40` ON `r39`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r40`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r39`.`Id1` = `r40`.`RelationshipsBranchEntityId1`) + LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_RequiredRef0FEDC08C` AS `r41` ON `r39`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r41`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r39`.`Id1` = `r41`.`RelationshipsBranchEntityId1`) LEFT JOIN `Root_RequiredReferenceTrunk_CollectionBranch_CollectionLeaf` AS `r42` ON `r39`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r42`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` AND `r39`.`Id1` = `r42`.`RelationshipsBranchEntityId1` ) AS `s3` ON `r0`.`RelationshipsRootEntityId` = `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`) -LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll225D701E` AS `r43` ON `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r43`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) -LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll702A3AC2` AS `r44` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r44`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` -ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`RelationshipsRootEntityId`, `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r18`.`Id1`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r19`.`Id1`, `s1`.`RelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`RelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s1`.`RelationshipsTrunkEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAAB251C6`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s1`.`RelationshipsTrunkEntityId11`, `s1`.`Id10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio85BCDD2B`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio355BD29F`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s1`.`RelationshipsBranchEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioF11D74B1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s1`.`RelationshipsBranchEntityId11`, `s1`.`Id100`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioCE677DB1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s1`.`Id11`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio25ADC25A`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `s1`.`Id12`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s2`.`RelationshipsBranchEntityId10`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s2`.`RelationshipsBranchEntityId11`, `s2`.`Id10`, `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r37`.`Id1`, `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r38`.`Id1`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`Id1`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio5A630C8B`, `s3`.`RelationshipsBranchEntityId10`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3D99058E`, `s3`.`RelationshipsBranchEntityId11`, `s3`.`Id10`, `r43`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r43`.`Id1`, `r44`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +LEFT JOIN `Root_RequiredReferenceTrunk_OptionalReferenceBranch_Coll65358A09` AS `r43` ON `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r43`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`) +LEFT JOIN `Root_RequiredReferenceTrunk_RequiredReferenceBranch_Coll8A4684E1` AS `r44` ON `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId` = `r44`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` +ORDER BY `r`.`Id`, `r0`.`RelationshipsRootEntityId`, `r1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r4`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r5`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r6`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r7`.`RelationshipsRootEntityId`, `r8`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r9`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r10`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r11`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `r12`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r13`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s`.`Id1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s`.`RelationshipsBranchEntityId1`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s`.`RelationshipsBranchEntityId10`, `s`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s`.`RelationshipsBranchEntityId11`, `s`.`Id10`, `r18`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r18`.`Id1`, `r19`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r19`.`Id1`, `s1`.`RelationshipsRootEntityId`, `s1`.`Id1`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s1`.`RelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId10`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId0`, `s1`.`RelationshipsTrunkEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId11`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioAB35E7B6`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId12`, `s1`.`RelationshipsTrunkEntityRelationshipsRootEntityId1`, `s1`.`RelationshipsTrunkEntityId11`, `s1`.`Id10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioE090A91F`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId13`, `s1`.`RelationshipsBranchEntityId1`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio1D83E82A`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId100`, `s1`.`RelationshipsBranchEntityId10`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio8B9742A9`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId110`, `s1`.`RelationshipsBranchEntityId11`, `s1`.`Id100`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioD9ECE0E0`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId14`, `s1`.`Id11`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio60F6FF19`, `s1`.`RelationshipsBranchEntityRelationshipsTrunkEntityId15`, `s1`.`Id12`, `s2`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s2`.`Id1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s2`.`RelationshipsBranchEntityId1`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s2`.`RelationshipsBranchEntityId10`, `s2`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s2`.`RelationshipsBranchEntityId11`, `s2`.`Id10`, `r37`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r37`.`Id1`, `r38`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r38`.`Id1`, `s3`.`RelationshipsTrunkEntityRelationshipsRootEntityId`, `s3`.`Id1`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `s3`.`RelationshipsBranchEntityId1`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatio3F20AD83`, `s3`.`RelationshipsBranchEntityId10`, `s3`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelatioB0EAE515`, `s3`.`RelationshipsBranchEntityId11`, `s3`.`Id10`, `r43`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~`, `r43`.`Id1`, `r44`.`RelationshipsBranchEntityRelationshipsTrunkEntityRelationshipsR~` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs index 94de0ff5..f9bd4c79 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs @@ -5613,18 +5613,18 @@ public override async Task Correlated_collections_on_RightJoin_with_predicate(bo AssertSql( """ -SELECT [u].[Nickname], [u].[SquadId], [t].[Id], [w].[Name], [w].[Id] -FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[FullName], [g].[HasSoulPatch] - FROM [Gears] AS [g] +SELECT `u`.`Nickname`, `u`.`SquadId`, `t`.`Id`, `w`.`Name`, `w`.`Id` +FROM (( + SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`FullName`, `g`.`HasSoulPatch` + FROM `Gears` AS `g` UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[FullName], [o].[HasSoulPatch] - FROM [Officers] AS [o] -) AS [u] -RIGHT JOIN [Tags] AS [t] ON [u].[Nickname] = [t].[GearNickName] -LEFT JOIN [Weapons] AS [w] ON [u].[FullName] = [w].[OwnerFullName] -WHERE [u].[HasSoulPatch] = CAST(0 AS bit) -ORDER BY [u].[Nickname], [u].[SquadId], [t].[Id] + SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`FullName`, `o`.`HasSoulPatch` + FROM `Officers` AS `o` +) AS `u` +RIGHT JOIN `Tags` AS `t` ON `u`.`Nickname` = `t`.`GearNickName`) +LEFT JOIN `Weapons` AS `w` ON `u`.`FullName` = `w`.`OwnerFullName` +WHERE `u`.`HasSoulPatch` = FALSE +ORDER BY `u`.`Nickname`, `u`.`SquadId`, `t`.`Id` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs index 127514d4..f1811db7 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs @@ -4550,12 +4550,12 @@ public override async Task Correlated_collections_on_RightJoin_with_predicate(bo AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [t].[Id], [w].[Name], [w].[Id] -FROM [Gears] AS [g] -RIGHT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] -LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] -WHERE [g].[HasSoulPatch] = CAST(0 AS bit) -ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id] +SELECT `g`.`Nickname`, `g`.`SquadId`, `t`.`Id`, `w`.`Name`, `w`.`Id` +FROM (`Gears` AS `g` +RIGHT JOIN `Tags` AS `t` ON `g`.`Nickname` = `t`.`GearNickName`) +LEFT JOIN `Weapons` AS `w` ON `g`.`FullName` = `w`.`OwnerFullName` +WHERE `g`.`HasSoulPatch` = FALSE +ORDER BY `g`.`Nickname`, `g`.`SquadId`, `t`.`Id` """); } From 57e7b306d91c5c9d02504babd1c08b7fab7745bf Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 18 Oct 2025 22:53:10 +0800 Subject: [PATCH 03/35] rc1 work --- Dependencies.targets | 12 +- Version.props | 6 +- global.json | 2 +- src/EFCore.Jet.Odbc/EFCore.Jet.Odbc.csproj | 7 + src/EFCore.Jet.OleDb/EFCore.Jet.OleDb.csproj | 7 + .../Internal/JetParameterBasedSqlProcessor.cs | 32 +-- .../JetSqlTranslatingExpressionVisitor.cs | 2 +- .../SkipTakeCollapsingExpressionVisitor.cs | 43 ++-- src/Shared/Check.cs | 191 ++++++++++-------- .../Temporal/TimeOnlyTranslationsJetTest.cs | 4 +- 10 files changed, 160 insertions(+), 146 deletions(-) diff --git a/Dependencies.targets b/Dependencies.targets index 07d2b42f..128310b0 100644 --- a/Dependencies.targets +++ b/Dependencies.targets @@ -1,8 +1,8 @@ - [10.0.0-preview.5.25277.114,10.0.999] - [10.0.0-preview.5.25277.114,10.0.999] - [10.0.0-preview.5.25277.114,10.0.999] + [10.0.0-rc.1.25451.107,10.0.999] + [10.0.0-rc.1.25451.107,10.0.999] + [10.0.0-rc.1.25451.107,10.0.999] @@ -29,15 +29,15 @@ - - + + - + diff --git a/Version.props b/Version.props index 4d35e9f9..e18486b0 100644 --- a/Version.props +++ b/Version.props @@ -15,9 +15,9 @@ Bump-up to the next iteration immediately after a release, so that subsequent daily builds are named correctly. --> - 9.0.0 - rtm - 0 + 10.0.0 + alpha + 1 - + diff --git a/Version.props b/Version.props index e18486b0..b70df8e9 100644 --- a/Version.props +++ b/Version.props @@ -16,8 +16,8 @@ correctly. --> 10.0.0 - alpha - 1 + rc + 2 $(DefineConstants);FIXED_TEST_ORDER diff --git a/test/EFCore.Jet.FunctionalTests/ComplexTypesTrackingJetTest.cs b/test/EFCore.Jet.FunctionalTests/ComplexTypesTrackingJetTest.cs index ea5c14bd..04d17417 100644 --- a/test/EFCore.Jet.FunctionalTests/ComplexTypesTrackingJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/ComplexTypesTrackingJetTest.cs @@ -1,33 +1,374 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.TestUtilities; +using Microsoft.Extensions.DependencyInjection; +using System.Threading.Tasks; using Xunit.Abstractions; namespace EntityFrameworkCore.Jet.FunctionalTests; -public class ComplexTypesTrackingJetTest : ComplexTypesTrackingTestBase +public class ComplexTypesTrackingJetTest( + ComplexTypesTrackingJetTest.JetFixture fixture, + ITestOutputHelper testOutputHelper) + : ComplexTypesTrackingJetTestBase(fixture, testOutputHelper) +{ + public class JetFixture : JetFixtureBase + { + protected override string StoreName + => nameof(ComplexTypesTrackingJetTest); + } +} + +public class ComplexTypesTrackingProxiesJetTest( + ComplexTypesTrackingProxiesJetTest.JetFixture fixture, + ITestOutputHelper testOutputHelper) + : ComplexTypesTrackingJetTestBase(fixture, testOutputHelper) { - public ComplexTypesTrackingJetTest(JetFixture fixture, ITestOutputHelper testOutputHelper) - : base(fixture) + // Fields can't be proxied + public override Task Can_track_entity_with_complex_objects_with_fields(EntityState state, bool async) + => Task.CompletedTask; + + // Fields can't be proxied + public override void Can_mark_complex_type_properties_modified_with_fields(bool trackFromQuery) + { + } + + // Fields can't be proxied + public override void Can_read_original_values_for_properties_of_complex_types_with_fields(bool trackFromQuery) + { + } + + // Fields can't be proxied + public override void Can_write_original_values_for_properties_of_complex_types_with_fields(bool trackFromQuery) + { + } + + // Fields can't be proxied + public override Task Can_track_entity_with_complex_structs_with_fields(EntityState state, bool async) + => Task.CompletedTask; + + // Fields can't be proxied + public override void Can_mark_complex_readonly_struct_properties_modified_with_fields(bool trackFromQuery) + { + } + + // Fields can't be proxied + public override void Can_read_original_values_for_properties_of_structs_with_fields(bool trackFromQuery) + { + } + + // Fields can't be proxied + public override void Can_write_original_values_for_properties_of_structs_with_fields(bool trackFromQuery) + { + } + + // Fields can't be proxied + public override Task Can_track_entity_with_complex_readonly_structs_with_fields(EntityState state, bool async) + => Task.CompletedTask; + + // Fields can't be proxied + public override void Can_mark_complex_readonly_readonly_struct_properties_modified_with_fields(bool trackFromQuery) + { + } + + // Fields can't be proxied + public override void Can_read_original_values_for_properties_of_readonly_structs_with_fields(bool trackFromQuery) + { + } + + // Fields can't be proxied + public override void Can_write_original_values_for_properties_of_readonly_structs_with_fields(bool trackFromQuery) + { + } + + // Fields can't be proxied + public override Task Can_track_entity_with_complex_record_objects_with_fields(EntityState state, bool async) + => Task.CompletedTask; + + // Fields can't be proxied + public override void Can_mark_complex_record_type_properties_modified_with_fields(bool trackFromQuery) + { + } + + // Fields can't be proxied + public override void Can_read_original_values_for_properties_of_record_complex_types_with_fields(bool trackFromQuery) + { + } + + // Fields can't be proxied + public override void Can_write_original_values_for_properties_of_record_complex_types_with_fields(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_detect_added_elements_in_complex_type_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override Task Can_track_entity_with_complex_type_collections(EntityState state, bool async) + => Task.CompletedTask; + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_mark_complex_type_collection_properties_modified(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_read_original_values_for_properties_of_complex_type_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_write_original_values_for_properties_of_complex_type_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override Task Can_track_entity_with_complex_struct_collections(EntityState state, bool async) + => Task.CompletedTask; + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_mark_complex_struct_collection_properties_modified(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_read_original_values_for_properties_of_complex_struct_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_write_original_values_for_properties_of_complex_struct_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override Task Can_track_entity_with_complex_readonly_struct_collections(EntityState state, bool async) + => Task.CompletedTask; + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_mark_complex_readonly_struct_collection_properties_modified(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_read_original_values_for_properties_of_readonly_struct_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_write_original_values_for_properties_of_readonly_struct_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override Task Can_track_entity_with_complex_readonly_struct_collections_with_fields(EntityState state, bool async) + => Task.CompletedTask; + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_mark_complex_readonly_struct_collections_with_fields_properties_modified(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_read_original_values_for_properties_of_complex_readonly_struct_collections_with_fields(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_write_original_values_for_properties_of_complex_readonly_struct_collections_with_fields(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_detect_reordered_elements_in_complex_type_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_detect_removed_elements_in_complex_type_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_detect_replaced_elements_in_complex_type_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_detect_duplicates_in_complex_type_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_handle_null_elements_in_complex_type_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_detect_changes_to_struct_collection_elements(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_detect_changes_to_readonly_struct_collection_elements(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_handle_collection_with_mixed_null_and_duplicate_elements(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_detect_changes_to_record_collection_elements(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_detect_nested_collection_changes_in_complex_type_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_detect_changes_to_nested_teams_members_in_complex_type_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_detect_changes_to_nested_struct_teams_in_complex_type_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_detect_changes_to_nested_readonly_struct_teams_in_complex_type_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_read_original_values_for_properties_of_complex_record_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_write_original_values_for_properties_of_complex_record_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_mark_complex_record_collection_properties_modified(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_detect_swapped_complex_objects_in_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Throws_when_accessing_complex_entries_using_incorrect_cardinality() + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override Task Can_track_entity_with_complex_record_collections(EntityState state, bool async) + => Task.CompletedTask; + + // Issue #36175: Complex types with notification change tracking are not supported + public override Task Can_track_entity_with_complex_record_collections_with_fields(EntityState state, bool async) + => Task.CompletedTask; + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_mark_complex_record_collections_with_fields_properties_modified(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_read_original_values_for_properties_of_complex_record_collections_with_fields(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_write_original_values_for_properties_of_complex_record_collections_with_fields(bool trackFromQuery) + { + } + + // Fields can't be proxied + public override Task Can_track_entity_with_complex_field_collections(EntityState state, bool async) + => Task.CompletedTask; + + // Fields can't be proxied + public override void Can_read_original_values_for_properties_of_complex_field_collections(bool trackFromQuery) + { + } + + // Fields can't be proxied + public override void Can_mark_complex_field_collection_properties_modified(bool trackFromQuery) + { + } + + // Fields can't be proxied + public override void Can_write_original_values_for_properties_of_complex_field_collections(bool trackFromQuery) { - fixture.TestSqlLoggerFactory.Clear(); - fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } - protected override void UseTransaction(DatabaseFacade facade, IDbContextTransaction transaction) - => facade.UseTransaction(transaction.GetDbTransaction()); + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_detect_changes_to_record_teams_in_complex_type_collections(bool trackFromQuery) + { + } - public class JetFixture : FixtureBase + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_handle_empty_nested_teams_in_complex_type_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_mark_complex_property_bag_collection_properties_modified(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_read_original_values_for_properties_of_complex_property_bag_collections(bool trackFromQuery) + { + } + + // Issue #36175: Complex types with notification change tracking are not supported + public override Task Can_track_entity_with_complex_property_bag_collections(EntityState state, bool async) + => Task.CompletedTask; + + // Issue #36175: Complex types with notification change tracking are not supported + public override void Can_write_original_values_for_properties_of_complex_property_bag_collections(bool trackFromQuery) + { + } + + public class JetFixture : JetFixtureBase + { + protected override string StoreName + => nameof(ComplexTypesTrackingProxiesJetTest); + + public override bool UseProxies + => true; + + public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) + => base.AddOptions(builder.UseLazyLoadingProxies().UseChangeTrackingProxies()); + + protected override IServiceCollection AddServices(IServiceCollection serviceCollection) + => base.AddServices(serviceCollection.AddEntityFrameworkProxies()); + } +} + +public abstract class ComplexTypesTrackingJetTestBase : ComplexTypesTrackingRelationalTestBase + where TFixture : ComplexTypesTrackingJetTestBase.JetFixtureBase, new() +{ + protected ComplexTypesTrackingJetTestBase(TFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture, testOutputHelper) + { + } + + public abstract class JetFixtureBase : RelationalFixtureBase { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; - - public TestSqlLoggerFactory TestSqlLoggerFactory - => (TestSqlLoggerFactory)ListLoggerFactory; } } diff --git a/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj b/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj index 4724cd1c..191812e7 100644 --- a/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj +++ b/test/EFCore.Jet.FunctionalTests/EFCore.Jet.FunctionalTests.csproj @@ -70,8 +70,6 @@ PreserveNewest - - @@ -102,8 +100,6 @@ - - diff --git a/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsInfrastructureJetTest.cs b/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsInfrastructureJetTest.cs index 5c41619f..fc934720 100644 --- a/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsInfrastructureJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsInfrastructureJetTest.cs @@ -73,137 +73,109 @@ public override async Task Can_generate_up_and_down_scripts() Assert.Equal( """ -IF OBJECT_ID(N'[__EFMigrationsHistory]') IS NULL -BEGIN - CREATE TABLE [__EFMigrationsHistory] ( - [MigrationId] nvarchar(150) NOT NULL, - [ProductVersion] nvarchar(32) NOT NULL, - CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY ([MigrationId]) +IF NOT EXISTS (SELECT * FROM `INFORMATION_SCHEMA.TABLES` WHERE `TABLE_NAME` = '__EFMigrationsHistory') THEN CREATE TABLE `__EFMigrationsHistory` ( + `MigrationId` varchar(150) NOT NULL, + `ProductVersion` varchar(32) NOT NULL, + CONSTRAINT `PK___EFMigrationsHistory` PRIMARY KEY (`MigrationId`) ); -END; -GO +; BEGIN TRANSACTION; -CREATE TABLE [Table1] ( - [Id] int NOT NULL, - [Foo] int NOT NULL, - [Description] nvarchar(max) NOT NULL, - CONSTRAINT [PK_Table1] PRIMARY KEY ([Id]) +CREATE TABLE `Table1` ( + `Id` integer NOT NULL, + `Foo` integer NOT NULL, + `Description` varchar(255) NOT NULL, + CONSTRAINT `PK_Table1` PRIMARY KEY (`Id`) ); -INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) -VALUES (N'00000000000001_Migration1', N'7.0.0-test'); +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('00000000000001_Migration1', '7.0.0-test'); -EXEC sp_rename N'[Table1].[Foo]', N'Bar', 'COLUMN'; +COMMIT TRANSACTION; -INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) -VALUES (N'00000000000002_Migration2', N'7.0.0-test'); +BEGIN TRANSACTION; +ALTER TABLE `Table1` RENAME COLUMN `Foo` TO `Bar`; -COMMIT; -GO +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('00000000000002_Migration2', '7.0.0-test'); -CREATE DATABASE TransactionSuppressed; -GO +COMMIT TRANSACTION; -DROP DATABASE TransactionSuppressed; -GO +BEGIN TRANSACTION; +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('00000000000003_Migration3', '7.0.0-test'); -INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) -VALUES (N'00000000000003_Migration3', N'7.0.0-test'); -GO +COMMIT TRANSACTION; -CREATE PROCEDURE [dbo].[GotoReproduction] -AS -BEGIN - DECLARE @Counter int; - SET @Counter = 1; - WHILE @Counter < 10 - BEGIN - SELECT @Counter - SET @Counter = @Counter + 1 - IF @Counter = 4 GOTO Branch_One --Jumps to the first branch. - IF @Counter = 5 GOTO Branch_Two --This will never execute. - END - Branch_One: - SELECT 'Jumping To Branch One.' - GOTO Branch_Three; --This will prevent Branch_Two from executing.' - Branch_Two: - SELECT 'Jumping To Branch Two.' - Branch_Three: - SELECT 'Jumping To Branch Three.' -END; +BEGIN TRANSACTION; +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('00000000000004_Migration4', '7.0.0-test'); -GO +COMMIT TRANSACTION; -SELECT GetDate(); ---GO -SELECT GetDate() -GO +BEGIN TRANSACTION; +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('00000000000005_Migration5', '7.0.0-test'); -INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) -VALUES (N'00000000000004_Migration4', N'7.0.0-test'); -GO +COMMIT TRANSACTION; BEGIN TRANSACTION; -INSERT INTO Table1 (Id, Bar, Description) VALUES (-1, 3, 'Value With - -Empty Lines') +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('00000000000006_Migration6', '7.0.0-test'); -INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) -VALUES (N'00000000000005_Migration5', N'7.0.0-test'); +COMMIT TRANSACTION; -INSERT INTO Table1 (Id, Bar, Description) VALUES (-2, 4, 'GO -Value With +BEGIN TRANSACTION; +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('00000000000007_Migration7', '7.0.0-test'); -Empty Lines') +COMMIT TRANSACTION; -INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) -VALUES (N'00000000000006_Migration6', N'7.0.0-test'); +BEGIN TRANSACTION; +DELETE FROM `__EFMigrationsHistory` +WHERE `MigrationId` = '00000000000007_Migration7'; -INSERT INTO Table1 (Id, Bar, Description) VALUES (-3, 5, '--Start -GO -Value With +COMMIT TRANSACTION; -GO +BEGIN TRANSACTION; +DELETE FROM `__EFMigrationsHistory` +WHERE `MigrationId` = '00000000000006_Migration6'; -Empty Lines; -GO -') +COMMIT TRANSACTION; -INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) -VALUES (N'00000000000007_Migration7', N'7.0.0-test'); +BEGIN TRANSACTION; +DELETE FROM `__EFMigrationsHistory` +WHERE `MigrationId` = '00000000000005_Migration5'; -COMMIT; -GO +COMMIT TRANSACTION; BEGIN TRANSACTION; -DELETE FROM [__EFMigrationsHistory] -WHERE [MigrationId] = N'00000000000007_Migration7'; +DELETE FROM `__EFMigrationsHistory` +WHERE `MigrationId` = '00000000000004_Migration4'; -DELETE FROM [__EFMigrationsHistory] -WHERE [MigrationId] = N'00000000000006_Migration6'; +COMMIT TRANSACTION; -DELETE FROM [__EFMigrationsHistory] -WHERE [MigrationId] = N'00000000000005_Migration5'; +BEGIN TRANSACTION; +DELETE FROM `__EFMigrationsHistory` +WHERE `MigrationId` = '00000000000003_Migration3'; -DELETE FROM [__EFMigrationsHistory] -WHERE [MigrationId] = N'00000000000004_Migration4'; +COMMIT TRANSACTION; -DELETE FROM [__EFMigrationsHistory] -WHERE [MigrationId] = N'00000000000003_Migration3'; +BEGIN TRANSACTION; +ALTER TABLE `Table1` RENAME COLUMN `Bar` TO `Foo`; -EXEC sp_rename N'[Table1].[Bar]', N'Foo', 'COLUMN'; +DELETE FROM `__EFMigrationsHistory` +WHERE `MigrationId` = '00000000000002_Migration2'; -DELETE FROM [__EFMigrationsHistory] -WHERE [MigrationId] = N'00000000000002_Migration2'; +COMMIT TRANSACTION; -DROP TABLE [Table1]; +BEGIN TRANSACTION; +DROP TABLE `Table1`; -DELETE FROM [__EFMigrationsHistory] -WHERE [MigrationId] = N'00000000000001_Migration1'; +DELETE FROM `__EFMigrationsHistory` +WHERE `MigrationId` = '00000000000001_Migration1'; -COMMIT; -GO +COMMIT TRANSACTION; """, diff --git a/test/EFCore.Jet.FunctionalTests/ModelBuilding/JetModelBuilderGenericTest.cs b/test/EFCore.Jet.FunctionalTests/ModelBuilding/JetModelBuilderGenericTest.cs index 395720aa..7a0780a2 100644 --- a/test/EFCore.Jet.FunctionalTests/ModelBuilding/JetModelBuilderGenericTest.cs +++ b/test/EFCore.Jet.FunctionalTests/ModelBuilding/JetModelBuilderGenericTest.cs @@ -3,8 +3,9 @@ // ReSharper disable InconsistentNaming -using System; using Microsoft.EntityFrameworkCore; +using NetTopologySuite.Features; +using System; namespace EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding; @@ -24,6 +25,13 @@ protected override TestModelBuilder CreateModelBuilder( => new GenericTestModelBuilder(Fixture, configure); } + public class JetGenericComplexCollection(JetModelBuilderFixture fixture) : JetComplexCollection(fixture) + { + protected override TestModelBuilder CreateModelBuilder( + Action? configure) + => new GenericTestModelBuilder(Fixture, configure); + } + public class JetGenericInheritance(JetModelBuilderFixture fixture) : JetInheritance(fixture) { protected override TestModelBuilder CreateModelBuilder( diff --git a/test/EFCore.Jet.FunctionalTests/ModelBuilding/JetModelBuilderNonGenericTest.cs b/test/EFCore.Jet.FunctionalTests/ModelBuilding/JetModelBuilderNonGenericTest.cs index c180a7f1..5c899439 100644 --- a/test/EFCore.Jet.FunctionalTests/ModelBuilding/JetModelBuilderNonGenericTest.cs +++ b/test/EFCore.Jet.FunctionalTests/ModelBuilding/JetModelBuilderNonGenericTest.cs @@ -3,8 +3,9 @@ // ReSharper disable InconsistentNaming -using System; using Microsoft.EntityFrameworkCore; +using NetTopologySuite.Features; +using System; namespace EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding; @@ -22,6 +23,12 @@ protected override TestModelBuilder CreateModelBuilder(Action new NonGenericTestModelBuilder(Fixture, configure); } + public class JetNonGenericComplexCollection(JetModelBuilderFixture fixture) : JetComplexCollection(fixture) + { + protected override TestModelBuilder CreateModelBuilder(Action? configure = null) + => new NonGenericTestModelBuilder(Fixture, configure); + } + public class JetNonGenericInheritance(JetModelBuilderFixture fixture) : JetInheritance(fixture) { protected override TestModelBuilder CreateModelBuilder(Action? configure = null) diff --git a/test/EFCore.Jet.FunctionalTests/ModelBuilding/JetModelBuilderTestBase.cs b/test/EFCore.Jet.FunctionalTests/ModelBuilding/JetModelBuilderTestBase.cs index 5c252319..8d988c5d 100644 --- a/test/EFCore.Jet.FunctionalTests/ModelBuilding/JetModelBuilderTestBase.cs +++ b/test/EFCore.Jet.FunctionalTests/ModelBuilding/JetModelBuilderTestBase.cs @@ -1,28 +1,26 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel.DataAnnotations.Schema; +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Diagnostics; -using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata.Conventions; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; using Microsoft.EntityFrameworkCore.ModelBuilding; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.TestUtilities; -using Xunit; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; -using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Xunit; namespace EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding; public class JetModelBuilderTestBase : RelationalModelBuilderTest { - public abstract class JetNonRelationship(JetModelBuilderFixture fixture) : RelationalNonRelationshipTestBase(fixture), IClassFixture + public abstract class JetNonRelationship(JetModelBuilderFixture fixture) + : RelationalNonRelationshipTestBase(fixture), IClassFixture { [ConditionalFact] public virtual void Index_has_a_filter_if_nonclustered_unique_with_nullable_properties() @@ -66,9 +64,9 @@ public virtual void Index_has_a_filter_if_nonclustered_unique_with_nullable_prop Assert.Equal("[RelationalName] IS NOT NULL", index.GetFilter()); - entityTypeBuilder.Property(e => e.Name).HasColumnName("SqlServerName"); + entityTypeBuilder.Property(e => e.Name).HasColumnName("JetName"); - Assert.Equal("[SqlServerName] IS NOT NULL", index.GetFilter()); + Assert.Equal("[JetName] IS NOT NULL", index.GetFilter()); entityTypeBuilder.Property(e => e.Name).HasColumnName(null); @@ -114,22 +112,20 @@ public void Indexes_can_have_same_name_across_tables() [ConditionalFact] public virtual void Can_set_store_type_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().HaveColumnType("smallint"); - c.Properties().HaveColumnType("nchar(max)"); - c.Properties(typeof(Nullable<>)).HavePrecision(2); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().HaveColumnType("smallint"); + c.Properties().HaveColumnType("nchar(max)"); + c.Properties(typeof(Nullable<>)).HavePrecision(2); + }); - modelBuilder.Entity( - b => - { - b.Property("Charm"); - b.Property("Strange"); - b.Property("Top"); - b.Property("Bottom"); - }); + modelBuilder.Entity(b => + { + b.Property("Charm"); + b.Property("Strange"); + b.Property("Top"); + b.Property("Bottom"); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -150,21 +146,19 @@ public virtual void Can_set_store_type_for_property_type() [ConditionalFact] public virtual void Can_set_fixed_length_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().AreFixedLength(false); - c.Properties().AreFixedLength(); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().AreFixedLength(false); + c.Properties().AreFixedLength(); + }); - modelBuilder.Entity( - b => - { - b.Property("Charm"); - b.Property("Strange"); - b.Property("Top"); - b.Property("Bottom"); - }); + modelBuilder.Entity(b => + { + b.Property("Charm"); + b.Property("Strange"); + b.Property("Top"); + b.Property("Bottom"); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -181,21 +175,19 @@ public virtual void Can_set_fixed_length_for_property_type() [ConditionalFact] public virtual void Can_set_collation_for_property_type() { - var modelBuilder = CreateModelBuilder( - c => - { - c.Properties().UseCollation("Latin1_General_CS_AS_KS_WS"); - c.Properties().UseCollation("Latin1_General_BIN"); - }); + var modelBuilder = CreateModelBuilder(c => + { + c.Properties().UseCollation("Latin1_General_CS_AS_KS_WS"); + c.Properties().UseCollation("Latin1_General_BIN"); + }); - modelBuilder.Entity( - b => - { - b.Property("Charm"); - b.Property("Strange"); - b.Property("Top"); - b.Property("Bottom"); - }); + modelBuilder.Entity(b => + { + b.Property("Charm"); + b.Property("Strange"); + b.Property("Top"); + b.Property("Bottom"); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(Quarks))!; @@ -213,18 +205,15 @@ public virtual void Can_set_collation_for_property_type() public virtual void Can_set_store_type_for_primitive_collection() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up).HasColumnType("national character varying(255)"); - b.PrimitiveCollection(e => e.Down).HasColumnType("nchar(10)"); - b.PrimitiveCollection("Charm").HasColumnType("nvarchar(25)"); - b.PrimitiveCollection("Strange").HasColumnType("text"); - b.PrimitiveCollection>("Top").HasColumnType("char(100)"); - ; - b.PrimitiveCollection?>("Bottom").HasColumnType("varchar(max)"); - ; - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up).HasColumnType("national character varying(255)"); + b.PrimitiveCollection(e => e.Down).HasColumnType("nchar(10)"); + b.PrimitiveCollection("Charm").HasColumnType("nvarchar(25)"); + b.PrimitiveCollection("Strange").HasColumnType("text"); + b.PrimitiveCollection>("Top").HasColumnType("char(100)"); + b.PrimitiveCollection?>("Bottom").HasColumnType("varchar(max)"); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(CollectionQuarks))!; @@ -242,13 +231,12 @@ public virtual void Can_set_store_type_for_primitive_collection() public virtual void Can_set_fixed_length_for_primitive_collection() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up).IsFixedLength(false); - b.PrimitiveCollection(e => e.Down).IsFixedLength(); - b.PrimitiveCollection("Charm").IsFixedLength(); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up).IsFixedLength(false); + b.PrimitiveCollection(e => e.Down).IsFixedLength(); + b.PrimitiveCollection("Charm").IsFixedLength(); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(CollectionQuarks))!; @@ -262,13 +250,12 @@ public virtual void Can_set_fixed_length_for_primitive_collection() public virtual void Can_set_collation_for_primitive_collection() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.PrimitiveCollection(e => e.Up).UseCollation("Latin1_General_CS_AS_KS_WS"); - b.PrimitiveCollection(e => e.Down).UseCollation("Latin1_General_BIN"); - b.PrimitiveCollection("Charm").UseCollation("Latin1_General_CI_AI"); - }); + modelBuilder.Entity(b => + { + b.PrimitiveCollection(e => e.Up).UseCollation("Latin1_General_CS_AS_KS_WS"); + b.PrimitiveCollection(e => e.Down).UseCollation("Latin1_General_BIN"); + b.PrimitiveCollection("Charm").UseCollation("Latin1_General_CI_AI"); + }); var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(CollectionQuarks))!; @@ -278,14 +265,11 @@ public virtual void Can_set_collation_for_primitive_collection() Assert.Equal("Latin1_General_CI_AI", entityType.FindProperty("Charm")!.GetCollation()); } - /*[ConditionalTheory] - [InlineData(true)] - [InlineData(false)] + [ConditionalTheory, InlineData(true), InlineData(false)] public virtual void Can_avoid_attributes_when_discovering_properties(bool useAttributes) { - var modelBuilder = CreateModelBuilder(c => c.Conventions.Replace( - s => new PropertyDiscoveryConvention( - s.GetService()!, useAttributes))); + var modelBuilder = CreateModelBuilder(c => c.Conventions.Replace(s => new PropertyDiscoveryConvention( + s.GetService()!, useAttributes))); modelBuilder.Entity(); if (useAttributes) @@ -293,27 +277,35 @@ public virtual void Can_avoid_attributes_when_discovering_properties(bool useAtt var model = modelBuilder.FinalizeModel(); var entityType = model.FindEntityType(typeof(SqlVariantEntity))!; - Assert.Equal([nameof(SqlVariantEntity.Id), nameof(SqlVariantEntity.Value),], + Assert.Equal( + [nameof(SqlVariantEntity.Id), nameof(SqlVariantEntity.Value),], entityType.GetProperties().Select(p => p.Name)); } else { - Assert.Equal(CoreStrings.PropertyNotAdded(nameof(SqlVariantEntity), nameof(SqlVariantEntity.Value), "object"), + Assert.Equal( + CoreStrings.PropertyNotAdded(nameof(SqlVariantEntity), nameof(SqlVariantEntity.Value), "object"), Assert.Throws(modelBuilder.FinalizeModel).Message); } - }*/ + } protected class SqlVariantEntity { public int Id { get; set; } + [Column(TypeName = "sql_variant")] public object? Value { get; set; } } } - public abstract class JetComplexType(JetModelBuilderFixture fixture) : RelationalComplexTypeTestBase(fixture), IClassFixture; + public abstract class JetComplexType(JetModelBuilderFixture fixture) + : RelationalComplexTypeTestBase(fixture), IClassFixture; + + public abstract class JetComplexCollection(JetModelBuilderFixture fixture) + : RelationalComplexCollectionTestBase(fixture), IClassFixture; - public abstract class JetInheritance(JetModelBuilderFixture fixture) : RelationalInheritanceTestBase(fixture), IClassFixture + public abstract class JetInheritance(JetModelBuilderFixture fixture) + : RelationalInheritanceTestBase(fixture), IClassFixture { [ConditionalFact] // #7240 public void Can_use_shadow_FK_that_collides_with_convention_shadow_FK_on_other_derived_type() @@ -363,7 +355,7 @@ public void Index_convention_run_for_fk_when_derived_type_discovered_before_base var index = modelBuilder.Model.FindEntityType(typeof(CustomerDetails))!.GetIndexes().Single(); - Assert.Equal("IGNORE NULL", index.GetFilter()); + Assert.Equal("[CustomerId] IS NOT NULL", index.GetFilter()); } [ConditionalFact] @@ -379,7 +371,7 @@ public void Index_convention_sets_filter_for_unique_index_when_base_type_changed var index = modelBuilder.Model.FindEntityType(typeof(CustomerDetails))!.GetIndexes().Single(); - Assert.Equal("IGNORE NULL", index.GetFilter()); + Assert.Equal("[CustomerId] IS NOT NULL", index.GetFilter()); modelBuilder.Ignore(); @@ -413,23 +405,20 @@ public virtual void TPT_identifying_FK_is_created_only_on_declaring_table() modelBuilder.Entity() .Ignore(b => b.Bun) .Ignore(b => b.Pickles); - modelBuilder.Entity( - b => - { - b.ToTable("Ingredients"); - b.Ignore(i => i.BigMak); - }); - modelBuilder.Entity( - b => - { - b.ToTable("Buns"); - b.HasOne(i => i.BigMak).WithOne().HasForeignKey(i => i.Id); - }); - modelBuilder.Entity( - b => - { - b.ToTable("SesameBuns"); - }); + modelBuilder.Entity(b => + { + b.ToTable("Ingredients"); + b.Ignore(i => i.BigMak); + }); + modelBuilder.Entity(b => + { + b.ToTable("Buns"); + b.HasOne(i => i.BigMak).WithOne().HasForeignKey(i => i.Id); + }); + modelBuilder.Entity(b => + { + b.ToTable("SesameBuns"); + }); var model = modelBuilder.FinalizeModel(); @@ -478,26 +467,23 @@ public virtual void TPC_identifying_FKs_are_created_on_all_tables() modelBuilder.Entity() .Ignore(b => b.Bun) .Ignore(b => b.Pickles); - modelBuilder.Entity( - b => - { - b.ToTable("Ingredients"); - b.Ignore(i => i.BigMak); - b.HasIndex(e => e.BurgerId); - b.UseTpcMappingStrategy(); - }); - modelBuilder.Entity( - b => - { - b.ToTable("Buns"); - b.HasOne(i => i.BigMak).WithOne().HasForeignKey(i => i.Id); - b.UseTpcMappingStrategy(); - }); - modelBuilder.Entity( - b => - { - b.ToTable("SesameBuns"); - }); + modelBuilder.Entity(b => + { + b.ToTable("Ingredients"); + b.Ignore(i => i.BigMak); + b.HasIndex(e => e.BurgerId); + b.UseTpcMappingStrategy(); + }); + modelBuilder.Entity(b => + { + b.ToTable("Buns"); + b.HasOne(i => i.BigMak).WithOne().HasForeignKey(i => i.Id); + b.UseTpcMappingStrategy(); + }); + modelBuilder.Entity(b => + { + b.ToTable("SesameBuns"); + }); var model = modelBuilder.FinalizeModel(); @@ -545,21 +531,19 @@ public virtual void TPT_index_can_use_inherited_properties() modelBuilder.Entity() .Ignore(b => b.Bun) .Ignore(b => b.Pickles); - modelBuilder.Entity( - b => - { - b.ToTable("Ingredients"); - b.Property("NullableProp"); - b.Ignore(i => i.BigMak); - }); - modelBuilder.Entity( - b => - { - b.ToTable("Buns"); - b.HasIndex(bun => bun.BurgerId); - b.HasIndex("NullableProp"); - b.HasOne(i => i.BigMak).WithOne().HasForeignKey(i => i.Id); - }); + modelBuilder.Entity(b => + { + b.ToTable("Ingredients"); + b.Property("NullableProp"); + b.Ignore(i => i.BigMak); + }); + modelBuilder.Entity(b => + { + b.ToTable("Buns"); + b.HasIndex(bun => bun.BurgerId); + b.HasIndex("NullableProp"); + b.HasOne(i => i.BigMak).WithOne().HasForeignKey(i => i.Id); + }); var model = modelBuilder.FinalizeModel(); @@ -575,12 +559,11 @@ public void Can_add_check_constraints() .HasBaseType(null) .ToTable(tb => tb.HasCheckConstraint("CK_ChildBase_LargeId", "Id > 1000").HasName("CK_LargeId")); modelBuilder.Entity() - .ToTable( - tb => - { - tb.HasCheckConstraint("PositiveId", "Id > 0"); - tb.HasCheckConstraint("CK_ChildBase_LargeId", "Id > 1000"); - }); + .ToTable(tb => + { + tb.HasCheckConstraint("PositiveId", "Id > 0"); + tb.HasCheckConstraint("CK_ChildBase_LargeId", "Id > 1000"); + }); modelBuilder.Entity() .HasBaseType(); modelBuilder.Entity(); @@ -614,8 +597,8 @@ public void Adding_conflicting_check_constraint_to_derived_type_throws() Assert.Equal( RelationalStrings.DuplicateCheckConstraint("LargeId", nameof(Child), nameof(ChildBase)), - Assert.Throws( - () => modelBuilder.Entity().ToTable(tb => tb.HasCheckConstraint("LargeId", "Id > 1000"))).Message); + Assert.Throws(() + => modelBuilder.Entity().ToTable(tb => tb.HasCheckConstraint("LargeId", "Id > 1000"))).Message); } [ConditionalFact] @@ -630,8 +613,7 @@ public void Adding_conflicting_check_constraint_to_derived_type_before_base_thro Assert.Equal( RelationalStrings.DuplicateCheckConstraint("LargeId", nameof(Child), nameof(ChildBase)), - Assert.Throws( - () => modelBuilder.Entity().HasBaseType()).Message); + Assert.Throws(() => modelBuilder.Entity().HasBaseType()).Message); } protected class Parent @@ -656,7 +638,8 @@ protected class DisjointChildSubclass1 : Child; protected class DisjointChildSubclass2 : Child; } - public abstract class JetOneToMany(JetModelBuilderFixture fixture) : RelationalOneToManyTestBase(fixture), IClassFixture + public abstract class JetOneToMany(JetModelBuilderFixture fixture) + : RelationalOneToManyTestBase(fixture), IClassFixture { [ConditionalFact] public virtual void Shadow_foreign_keys_to_generic_types_have_terrible_names_that_should_not_change() @@ -709,11 +692,14 @@ protected class Company; protected class User; } - public abstract class JetManyToOne(JetModelBuilderFixture fixture) : RelationalManyToOneTestBase(fixture), IClassFixture; + public abstract class JetManyToOne(JetModelBuilderFixture fixture) + : RelationalManyToOneTestBase(fixture), IClassFixture; - public abstract class JetOneToOne(JetModelBuilderFixture fixture) : RelationalOneToOneTestBase(fixture), IClassFixture; + public abstract class JetOneToOne(JetModelBuilderFixture fixture) + : RelationalOneToOneTestBase(fixture), IClassFixture; - public abstract class JetManyToMany(JetModelBuilderFixture fixture) : RelationalManyToManyTestBase(fixture), IClassFixture + public abstract class JetManyToMany(JetModelBuilderFixture fixture) + : RelationalManyToManyTestBase(fixture), IClassFixture { [ConditionalFact] public virtual void Join_entity_type_uses_same_schema() @@ -772,7 +758,8 @@ public virtual void Join_entity_type_uses_default_schema_if_related_are_differen } } - public abstract class JetOwnedTypes(JetModelBuilderFixture fixture) : RelationalOwnedTypesTestBase(fixture), IClassFixture + public abstract class JetOwnedTypes(JetModelBuilderFixture fixture) + : RelationalOwnedTypesTestBase(fixture), IClassFixture { [ConditionalFact] public virtual void Owned_types_use_table_splitting_by_default() @@ -895,86 +882,85 @@ public virtual void Owned_types_use_table_splitting_by_default() Assert.All(bookId.PropertyMappings, m => Assert.Equal(ValueGenerated.OnUpdateSometimes, m.Property.ValueGenerated)); } - [ConditionalFact] + /*[ConditionalFact] public virtual void Owned_types_can_be_mapped_to_different_tables() { var modelBuilder = CreateModelBuilder(); var model = modelBuilder.Model; - modelBuilder.Entity( - bb => - { - bb.ToTable( - "BT", "BS", t => - { - t.ExcludeFromMigrations(); + modelBuilder.Entity(bb => + { + bb.ToTable( + "BT", "BS", t => + { + t.ExcludeFromMigrations(); - Assert.Equal("BT", t.Name); - Assert.Equal("BS", t.Schema); - }); - bb.OwnsOne( - b => b.AlternateLabel, tb => - { - tb.Ignore(l => l.Book); - tb.WithOwner() - .HasConstraintName("AlternateLabelFK"); - tb.ToTable("TT", "TS"); - tb.OwnsOne( - l => l.AnotherBookLabel, ab => - { - ab.Ignore(l => l.Book); - ab.ToTable( - "AT1", "AS1", t => - { - t.ExcludeFromMigrations(false); - - Assert.Equal("AT1", t.Name); - Assert.Equal("AS1", t.Schema); - }); - ab.OwnsOne(s => s.SpecialBookLabel) - .ToTable("ST11", "SS11") - .Ignore(l => l.Book) - .Ignore(l => l.BookLabel); - - ab.OwnedEntityType.FindNavigation(nameof(BookLabel.SpecialBookLabel))! - .AddAnnotation("Foo", "Bar"); - }); - tb.OwnsOne( - l => l.SpecialBookLabel, sb => - { - sb.Ignore(l => l.Book); - sb.ToTable("ST2", "SS2"); - sb.OwnsOne(s => s.AnotherBookLabel) - .ToTable("AT21", "AS21") - .Ignore(l => l.Book); - }); - }); - bb.OwnsOne( - b => b.Label, lb => - { - lb.Ignore(l => l.Book); - lb.ToTable("LT", "LS"); - lb.OwnsOne( - l => l.SpecialBookLabel, sb => - { - sb.Ignore(l => l.Book); - sb.ToTable("ST1", "SS1"); - sb.OwnsOne(a => a.AnotherBookLabel) - .ToTable("AT11", "AS11") - .Ignore(l => l.Book); - }); - lb.OwnsOne( - l => l.AnotherBookLabel, ab => - { - ab.Ignore(l => l.Book); - ab.ToTable("AT2", "AS2"); - ab.OwnsOne(a => a.SpecialBookLabel) - .ToTable("ST21", "SS21") - .Ignore(l => l.BookLabel) - .Ignore(l => l.Book); - }); - }); - }); + Assert.Equal("BT", t.Name); + Assert.Equal("BS", t.Schema); + }); + bb.OwnsOne( + b => b.AlternateLabel, tb => + { + tb.Ignore(l => l.Book); + tb.WithOwner() + .HasConstraintName("AlternateLabelFK"); + tb.ToTable("TT", "TS", tb => tb.IsMemoryOptimized()); + tb.OwnsOne( + l => l.AnotherBookLabel, ab => + { + ab.Ignore(l => l.Book); + ab.ToTable( + "AT1", "AS1", t => + { + t.ExcludeFromMigrations(false); + + Assert.Equal("AT1", t.Name); + Assert.Equal("AS1", t.Schema); + }); + ab.OwnsOne(s => s.SpecialBookLabel) + .ToTable("ST11", "SS11") + .Ignore(l => l.Book) + .Ignore(l => l.BookLabel); + + ab.OwnedEntityType.FindNavigation(nameof(BookLabel.SpecialBookLabel))! + .AddAnnotation("Foo", "Bar"); + }); + tb.OwnsOne( + l => l.SpecialBookLabel, sb => + { + sb.Ignore(l => l.Book); + sb.ToTable("ST2", "SS2"); + sb.OwnsOne(s => s.AnotherBookLabel) + .ToTable("AT21", "AS21") + .Ignore(l => l.Book); + }); + }); + bb.OwnsOne( + b => b.Label, lb => + { + lb.Ignore(l => l.Book); + lb.ToTable("LT", "LS"); + lb.OwnsOne( + l => l.SpecialBookLabel, sb => + { + sb.Ignore(l => l.Book); + sb.ToTable("ST1", "SS1"); + sb.OwnsOne(a => a.AnotherBookLabel) + .ToTable("AT11", "AS11") + .Ignore(l => l.Book); + }); + lb.OwnsOne( + l => l.AnotherBookLabel, ab => + { + ab.Ignore(l => l.Book); + ab.ToTable("AT2", "AS2"); + ab.OwnsOne(a => a.SpecialBookLabel) + .ToTable("ST21", "SS21") + .Ignore(l => l.BookLabel) + .Ignore(l => l.Book); + }); + }); + }); modelBuilder.FinalizeModel(); @@ -1001,9 +987,11 @@ public virtual void Owned_types_can_be_mapped_to_different_tables() Assert.True(book.IsTableExcludedFromMigrations()); Assert.Equal("LS", bookOwnership1.DeclaringEntityType.GetSchema()); Assert.Equal("LT", bookOwnership1.DeclaringEntityType.GetTableName()); + //Assert.False(bookOwnership1.DeclaringEntityType.IsMemoryOptimized()); Assert.True(bookOwnership1.DeclaringEntityType.IsTableExcludedFromMigrations()); Assert.Equal("TS", bookOwnership2.DeclaringEntityType.GetSchema()); Assert.Equal("TT", bookOwnership2.DeclaringEntityType.GetTableName()); + //Assert.True(bookOwnership2.DeclaringEntityType.IsMemoryOptimized()); Assert.True(bookOwnership2.DeclaringEntityType.IsTableExcludedFromMigrations()); Assert.Equal("AS2", bookLabel1Ownership1.DeclaringEntityType.GetSchema()); Assert.Equal("AT2", bookLabel1Ownership1.DeclaringEntityType.GetTableName()); @@ -1080,7 +1068,7 @@ public virtual void Owned_type_collections_can_be_mapped_to_different_tables() r => { r.HasKey(o => o.OrderId); - //r.ToTable(tb => tb.IsMemoryOptimized()); + r.ToTable(tb => tb.IsMemoryOptimized()); r.Ignore(o => o.OrderCombination); r.Ignore(o => o.Details); }); @@ -1098,6 +1086,7 @@ public virtual void Owned_type_collections_can_be_mapped_to_different_tables() owned.GetProperties().Select(p => p.GetColumnName())); Assert.Equal(nameof(Order), owned.GetTableName()); Assert.Null(owned.GetSchema()); + Assert.True(owned.IsMemoryOptimized()); modelBuilder.Entity().OwnsMany( c => c.Orders, @@ -1119,6 +1108,53 @@ public virtual void Owned_type_collections_can_be_mapped_to_different_tables() Assert.Equal("blah", owned.GetTableName()); Assert.Null(owned.GetSchema()); + }*/ + + [ConditionalFact] + public virtual void Owned_type_collections_are_mapped_to_same_tables_by_default() + { + var modelBuilder = CreateModelBuilder(); + + modelBuilder.Entity(b => + { + b.OwnsOne(x => x.OwnedReference1, bb => + { + bb.OwnsOne(x => x.Reference1); + bb.OwnsOne(x => x.Reference2); + bb.OwnsMany(x => x.Collection1); + bb.OwnsMany(x => x.Collection2); + }); + + b.OwnsOne(x => x.OwnedReference2, bb => + { + bb.OwnsOne(x => x.Reference1); + bb.OwnsOne(x => x.Reference2); + bb.OwnsMany(x => x.Collection1); + bb.OwnsMany(x => x.Collection2); + }); + + b.OwnsMany(x => x.OwnedCollection1, bb => + { + bb.OwnsOne(x => x.Reference1); + bb.OwnsOne(x => x.Reference2); + bb.OwnsMany(x => x.Collection1); + bb.OwnsMany(x => x.Collection2); + }); + + b.OwnsMany(x => x.OwnedCollection2, bb => + { + bb.OwnsOne(x => x.Reference1); + bb.OwnsOne(x => x.Reference2); + bb.OwnsMany(x => x.Collection1); + bb.OwnsMany(x => x.Collection2); + }); + }); + + Assert.Equal(RelationalStrings.IncompatibleTableNoRelationship( + "JsonEntityWithNesting_Collection1", + "JsonEntityWithNesting.OwnedReference2#OwnedEntityExtraLevel.Collection1#OwnedEntity", + "JsonEntityWithNesting.OwnedReference1#OwnedEntityExtraLevel.Collection1#OwnedEntity"), + Assert.Throws(() => modelBuilder.FinalizeModel()).Message); } [ConditionalFact] @@ -1204,14 +1240,13 @@ public virtual void Json_entity_and_normal_owned_can_exist_side_by_side_on_same_ { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.OwnsOne(x => x.OwnedReference1); - b.OwnsOne(x => x.OwnedReference2, bb => bb.ToJson("reference")); - b.OwnsMany(x => x.OwnedCollection1); - b.OwnsMany(x => x.OwnedCollection2, bb => bb.ToJson("collection")); - }); + modelBuilder.Entity(b => + { + b.OwnsOne(x => x.OwnedReference1); + b.OwnsOne(x => x.OwnedReference2, bb => bb.ToJson("reference")); + b.OwnsMany(x => x.OwnedCollection1); + b.OwnsMany(x => x.OwnedCollection2, bb => bb.ToJson("collection")); + }); var model = modelBuilder.FinalizeModel(); var owner = model.FindEntityType(typeof(JsonEntity))!; @@ -1243,20 +1278,18 @@ public virtual void Json_entity_with_tph_inheritance() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.OwnsOne(x => x.OwnedReferenceOnBase, bb => bb.ToJson("reference_on_base")); - b.OwnsMany(x => x.OwnedCollectionOnBase, bb => bb.ToJson("collection_on_base")); - }); + modelBuilder.Entity(b => + { + b.OwnsOne(x => x.OwnedReferenceOnBase, bb => bb.ToJson("reference_on_base")); + b.OwnsMany(x => x.OwnedCollectionOnBase, bb => bb.ToJson("collection_on_base")); + }); - modelBuilder.Entity( - b => - { - b.HasBaseType(); - b.OwnsOne(x => x.OwnedReferenceOnDerived, bb => bb.ToJson("reference_on_derived")); - b.OwnsMany(x => x.OwnedCollectionOnDerived, bb => bb.ToJson("collection_on_derived")); - }); + modelBuilder.Entity(b => + { + b.HasBaseType(); + b.OwnsOne(x => x.OwnedReferenceOnDerived, bb => bb.ToJson("reference_on_derived")); + b.OwnsMany(x => x.OwnedCollectionOnDerived, bb => bb.ToJson("collection_on_derived")); + }); var model = modelBuilder.FinalizeModel(); var ownedEntities = model.FindEntityTypes(typeof(OwnedEntity)).ToList(); @@ -1280,114 +1313,134 @@ public virtual void Json_entity_with_tph_inheritance() public virtual void Json_entity_with_nested_structure_same_property_names() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.OwnsOne( - x => x.OwnedReference1, bb => - { - bb.ToJson("ref1"); - bb.OwnsOne(x => x.Reference1); - bb.OwnsOne(x => x.Reference2); - bb.OwnsMany(x => x.Collection1); - bb.OwnsMany(x => x.Collection2); - }); + modelBuilder.Entity(b => + { + b.OwnsOne( + x => x.OwnedReference1, bb => + { + bb.ToJson("ref1"); + bb.OwnsOne(x => x.Reference1); + bb.OwnsOne(x => x.Reference2); + bb.OwnsMany(x => x.Collection1); + bb.OwnsMany(x => x.Collection2); + }); - b.OwnsOne( - x => x.OwnedReference2, bb => - { - bb.ToJson("ref2"); - bb.OwnsOne(x => x.Reference1); - bb.OwnsOne(x => x.Reference2); - bb.OwnsMany(x => x.Collection1); - bb.OwnsMany(x => x.Collection2); - }); + b.OwnsOne( + x => x.OwnedReference2, bb => + { + bb.ToJson("ref2"); + bb.OwnsOne(x => x.Reference1); + bb.OwnsOne(x => x.Reference2); + bb.OwnsMany(x => x.Collection1); + bb.OwnsMany(x => x.Collection2); + }); - b.OwnsMany( - x => x.OwnedCollection1, bb => - { - bb.ToJson("col1"); - bb.OwnsOne(x => x.Reference1); - bb.OwnsOne(x => x.Reference2); - bb.OwnsMany(x => x.Collection1); - bb.OwnsMany(x => x.Collection2); - }); + b.OwnsMany( + x => x.OwnedCollection1, bb => + { + bb.ToJson("col1"); + bb.OwnsOne(x => x.Reference1); + bb.OwnsOne(x => x.Reference2); + bb.OwnsMany(x => x.Collection1); + bb.OwnsMany(x => x.Collection2); + }); - b.OwnsMany( - x => x.OwnedCollection2, bb => - { - bb.ToJson("col2"); - bb.OwnsOne(x => x.Reference1); - bb.OwnsOne(x => x.Reference2); - bb.OwnsMany(x => x.Collection1); - bb.OwnsMany(x => x.Collection2); - }); - }); + b.OwnsMany( + x => x.OwnedCollection2, bb => + { + bb.ToJson("col2"); + bb.OwnsOne(x => x.Reference1) + .HasAnnotation(RelationalAnnotationNames.JsonPropertyName, null); + bb.OwnsOne(x => x.Reference2) + .ToTable("Ref2") + .HasAnnotation(RelationalAnnotationNames.ContainerColumnName, null); + bb.OwnsMany(x => x.Collection1); + bb.OwnsMany(x => x.Collection2); + }); + }); var model = modelBuilder.FinalizeModel(); var outerOwnedEntities = model.FindEntityTypes(typeof(OwnedEntityExtraLevel)); - Assert.Equal(4, outerOwnedEntities.Count()); + + Assert.Collection( + outerOwnedEntities, + e => Assert.Equal("col1", e.GetContainerColumnName()), + e => Assert.Equal("col2", e.GetContainerColumnName()), + e => Assert.Equal("ref1", e.GetContainerColumnName()), + e => Assert.Equal("ref2", e.GetContainerColumnName())); foreach (var outerOwnedEntity in outerOwnedEntities) { Assert.Equal("Date", outerOwnedEntity.GetProperty("Date").GetJsonPropertyName()); Assert.Equal("Fraction", outerOwnedEntity.GetProperty("Fraction").GetJsonPropertyName()); Assert.Equal("Enum", outerOwnedEntity.GetProperty("Enum").GetJsonPropertyName()); - Assert.Equal( - "Reference1", - outerOwnedEntity.GetNavigations().Single(n => n.Name == "Reference1").TargetEntityType.GetJsonPropertyName()); - Assert.Equal( - "Reference2", - outerOwnedEntity.GetNavigations().Single(n => n.Name == "Reference2").TargetEntityType.GetJsonPropertyName()); - Assert.Equal( - "Collection1", - outerOwnedEntity.GetNavigations().Single(n => n.Name == "Collection1").TargetEntityType.GetJsonPropertyName()); - Assert.Equal( - "Collection2", - outerOwnedEntity.GetNavigations().Single(n => n.Name == "Collection2").TargetEntityType.GetJsonPropertyName()); - } - var ownedEntities = model.FindEntityTypes(typeof(OwnedEntity)); - Assert.Equal(16, ownedEntities.Count()); + var nestedOwnedTypes = outerOwnedEntity.GetNavigations().Select(n => n.TargetEntityType).ToList(); + Assert.Collection( + nestedOwnedTypes, + e => Assert.Equal("Collection1", e.GetJsonPropertyName()), + e => Assert.Equal("Collection2", e.GetJsonPropertyName()), + e => Assert.Equal( + outerOwnedEntity.GetContainerColumnName() == "col2" ? null : "Reference1", + e.GetJsonPropertyName()), + e => Assert.Equal( + outerOwnedEntity.GetContainerColumnName() == "col2" ? null : "Reference2", + e.GetJsonPropertyName())); + + Assert.Collection( + nestedOwnedTypes, + e => Assert.Equal(outerOwnedEntity.GetContainerColumnName(), e.GetContainerColumnName()), + e => Assert.Equal(outerOwnedEntity.GetContainerColumnName(), e.GetContainerColumnName()), + e => Assert.Equal(outerOwnedEntity.GetContainerColumnName(), e.GetContainerColumnName()), + e => Assert.Equal( + outerOwnedEntity.GetContainerColumnName() == "col2" ? null : outerOwnedEntity.GetContainerColumnName(), + e.GetContainerColumnName())); + + foreach (var ownedEntity in nestedOwnedTypes) + { + if (ownedEntity.GetContainerColumnName() == null) + { + continue; + } - foreach (var ownedEntity in ownedEntities) - { - Assert.Equal("Date", ownedEntity.GetProperty("Date").GetJsonPropertyName()); - Assert.Equal("Fraction", ownedEntity.GetProperty("Fraction").GetJsonPropertyName()); - Assert.Equal("Enum", ownedEntity.GetProperty("Enum").GetJsonPropertyName()); + Assert.Equal("Date", ownedEntity.GetProperty("Date").GetJsonPropertyName()); + Assert.Equal("Fraction", ownedEntity.GetProperty("Fraction").GetJsonPropertyName()); + Assert.Equal("Enum", ownedEntity.GetProperty("Enum").GetJsonPropertyName()); + } } + + Assert.Equal(16, model.FindEntityTypes(typeof(OwnedEntity)).Count()); } [ConditionalFact] public virtual void Json_entity_nested_enums_have_conversions_to_int_by_default_ToJson_first() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.OwnsOne( - x => x.OwnedReference1, bb => - { - bb.ToJson(); - bb.OwnsOne(x => x.Reference1); - bb.OwnsOne(x => x.Reference2); - bb.OwnsMany(x => x.Collection1); - bb.OwnsMany(x => x.Collection2); - }); + modelBuilder.Entity(b => + { + b.OwnsOne( + x => x.OwnedReference1, bb => + { + bb.ToJson(); + bb.OwnsOne(x => x.Reference1); + bb.OwnsOne(x => x.Reference2); + bb.OwnsMany(x => x.Collection1); + bb.OwnsMany(x => x.Collection2); + }); - b.Ignore(x => x.OwnedReference2); - b.OwnsMany( - x => x.OwnedCollection1, bb => - { - bb.ToJson(); - bb.OwnsOne(x => x.Reference1); - bb.OwnsOne(x => x.Reference2); - bb.OwnsMany(x => x.Collection1); - bb.OwnsMany(x => x.Collection2); - }); + b.Ignore(x => x.OwnedReference2); + b.OwnsMany( + x => x.OwnedCollection1, bb => + { + bb.ToJson(); + bb.OwnsOne(x => x.Reference1); + bb.OwnsOne(x => x.Reference2); + bb.OwnsMany(x => x.Collection1); + bb.OwnsMany(x => x.Collection2); + }); - b.Ignore(x => x.OwnedCollection2); - }); + b.Ignore(x => x.OwnedCollection2); + }); var model = modelBuilder.FinalizeModel(); var outerOwnedEntities = model.FindEntityTypes(typeof(OwnedEntityExtraLevel)); @@ -1417,32 +1470,31 @@ public virtual void Json_entity_nested_enums_have_conversions_to_int_by_default_ public virtual void Json_entity_nested_enums_have_conversions_to_int_by_default_ToJson_last() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.OwnsOne( - x => x.OwnedReference1, bb => - { - bb.OwnsOne(x => x.Reference1); - bb.OwnsOne(x => x.Reference2); - bb.OwnsMany(x => x.Collection1); - bb.OwnsMany(x => x.Collection2); - bb.ToJson(); - }); + modelBuilder.Entity(b => + { + b.OwnsOne( + x => x.OwnedReference1, bb => + { + bb.OwnsOne(x => x.Reference1); + bb.OwnsOne(x => x.Reference2); + bb.OwnsMany(x => x.Collection1); + bb.OwnsMany(x => x.Collection2); + bb.ToJson(); + }); - b.Ignore(x => x.OwnedReference2); - b.OwnsMany( - x => x.OwnedCollection1, bb => - { - bb.OwnsOne(x => x.Reference1); - bb.OwnsOne(x => x.Reference2); - bb.OwnsMany(x => x.Collection1); - bb.OwnsMany(x => x.Collection2); - bb.ToJson(); - }); + b.Ignore(x => x.OwnedReference2); + b.OwnsMany( + x => x.OwnedCollection1, bb => + { + bb.OwnsOne(x => x.Reference1); + bb.OwnsOne(x => x.Reference2); + bb.OwnsMany(x => x.Collection1); + bb.OwnsMany(x => x.Collection2); + bb.ToJson(); + }); - b.Ignore(x => x.OwnedCollection2); - }); + b.Ignore(x => x.OwnedCollection2); + }); var model = modelBuilder.FinalizeModel(); var outerOwnedEntities = model.FindEntityTypes(typeof(OwnedEntityExtraLevel)); @@ -1472,34 +1524,33 @@ public virtual void Json_entity_nested_enums_have_conversions_to_int_by_default_ public virtual void Entity_mapped_to_json_and_unwound_afterwards_properly_cleans_up_its_state() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.OwnsOne( - x => x.OwnedReference1, bb => - { - bb.ToJson(); - bb.OwnsOne(x => x.Reference1); - bb.OwnsOne(x => x.Reference2); - bb.OwnsMany(x => x.Collection1); - bb.OwnsMany(x => x.Collection2); - bb.ToJson(null); - }); + modelBuilder.Entity(b => + { + b.OwnsOne( + x => x.OwnedReference1, bb => + { + bb.ToJson(); + bb.OwnsOne(x => x.Reference1); + bb.OwnsOne(x => x.Reference2); + bb.OwnsMany(x => x.Collection1); + bb.OwnsMany(x => x.Collection2); + bb.ToJson(null); + }); - b.Ignore(x => x.OwnedReference2); - b.OwnsMany( - x => x.OwnedCollection1, bb => - { - bb.OwnsOne(x => x.Reference1); - bb.OwnsOne(x => x.Reference2); - bb.OwnsMany(x => x.Collection1); - bb.OwnsMany(x => x.Collection2); - bb.ToJson(); - bb.ToJson(null); - }); + b.Ignore(x => x.OwnedReference2); + b.OwnsMany( + x => x.OwnedCollection1, bb => + { + bb.OwnsOne(x => x.Reference1); + bb.OwnsOne(x => x.Reference2); + bb.OwnsMany(x => x.Collection1); + bb.OwnsMany(x => x.Collection2); + bb.ToJson(); + bb.ToJson(null); + }); - b.Ignore(x => x.OwnedCollection2); - }); + b.Ignore(x => x.OwnedCollection2); + }); var model = modelBuilder.FinalizeModel(); var outerOwnedEntities = model.FindEntityTypes(typeof(OwnedEntityExtraLevel)); @@ -1536,15 +1587,38 @@ public virtual void Entity_mapped_to_json_and_unwound_afterwards_properly_cleans public virtual void Json_entity_mapped_to_view() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.ToView("MyView"); - b.OwnsOne(x => x.OwnedReference1, bb => bb.ToJson()); - b.Ignore(x => x.OwnedReference2); - b.OwnsMany(x => x.OwnedCollection1, bb => bb.ToJson()); - b.Ignore(x => x.OwnedCollection2); - }); + modelBuilder.Entity(b => + { + b.ToView("MyView"); + b.OwnsOne(x => x.OwnedReference1, bb => bb.ToJson()); + b.Ignore(x => x.OwnedReference2); + b.OwnsMany(x => x.OwnedCollection1, bb => bb.ToJson()); + b.Ignore(x => x.OwnedCollection2); + }); + + var model = modelBuilder.FinalizeModel(); + + var owner = model.FindEntityType(typeof(JsonEntity))!; + Assert.Equal("MyView", owner.GetViewName()); + + var ownedEntities = model.FindEntityTypes(typeof(OwnedEntity)); + Assert.Equal(2, ownedEntities.Count()); + Assert.Equal(2, ownedEntities.Where(e => e.IsMappedToJson()).Count()); + Assert.True(ownedEntities.All(x => x.GetViewName() == "MyView")); + } + + [ConditionalFact] + public virtual void Json_entity_mapped_to_view_with_custom_schema() + { + var modelBuilder = CreateModelBuilder(); + modelBuilder.Entity(b => + { + b.ToView("MyView", "MySchema"); + b.OwnsOne(x => x.OwnedReference1, bb => bb.ToJson()); + b.Ignore(x => x.OwnedReference2); + b.OwnsMany(x => x.OwnedCollection1, bb => bb.ToJson()); + b.Ignore(x => x.OwnedCollection2); + }); var model = modelBuilder.FinalizeModel(); @@ -1555,100 +1629,100 @@ public virtual void Json_entity_mapped_to_view() Assert.Equal(2, ownedEntities.Count()); Assert.Equal(2, ownedEntities.Where(e => e.IsMappedToJson()).Count()); Assert.True(ownedEntities.All(x => x.GetViewName() == "MyView")); + Assert.True(ownedEntities.All(x => x.GetViewSchema() == "MySchema")); } [ConditionalFact] public virtual void Json_entity_with_custom_property_names() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.OwnsOne( - x => x.OwnedReference1, bb => - { - bb.ToJson(); - bb.Property(x => x.Date).HasJsonPropertyName("OuterDate"); - bb.Property(x => x.Fraction).HasJsonPropertyName("OuterFraction"); - bb.Property(x => x.Enum).HasJsonPropertyName("OuterEnum"); - bb.OwnsOne( - x => x.Reference1, bbb => - { - bbb.HasJsonPropertyName("RenamedReference1"); - bbb.Property(x => x.Date).HasJsonPropertyName("InnerDate"); - bbb.Property(x => x.Fraction).HasJsonPropertyName("InnerFraction"); - bbb.Property(x => x.Enum).HasJsonPropertyName("InnerEnum"); - }); - bb.OwnsOne( - x => x.Reference2, bbb => - { - bbb.HasJsonPropertyName("RenamedReference2"); - bbb.Property(x => x.Date).HasJsonPropertyName("InnerDate"); - bbb.Property(x => x.Fraction).HasJsonPropertyName("InnerFraction"); - bbb.Property(x => x.Enum).HasJsonPropertyName("InnerEnum"); - }); - bb.OwnsMany( - x => x.Collection1, bbb => - { - bbb.HasJsonPropertyName("RenamedCollection1"); - bbb.Property(x => x.Date).HasJsonPropertyName("InnerDate"); - bbb.Property(x => x.Fraction).HasJsonPropertyName("InnerFraction"); - bbb.Property(x => x.Enum).HasJsonPropertyName("InnerEnum"); - }); - bb.OwnsMany( - x => x.Collection2, bbb => - { - bbb.HasJsonPropertyName("RenamedCollection2"); - bbb.Property(x => x.Date).HasJsonPropertyName("InnerDate"); - bbb.Property(x => x.Fraction).HasJsonPropertyName("InnerFraction"); - bbb.Property(x => x.Enum).HasJsonPropertyName("InnerEnum"); - }); - }); + modelBuilder.Entity(b => + { + b.OwnsOne( + x => x.OwnedReference1, bb => + { + bb.ToJson(); + bb.Property(x => x.Date).HasJsonPropertyName("OuterDate"); + bb.Property(x => x.Fraction).HasJsonPropertyName("OuterFraction"); + bb.Property(x => x.Enum).HasJsonPropertyName("OuterEnum"); + bb.OwnsOne( + x => x.Reference1, bbb => + { + bbb.HasJsonPropertyName("RenamedReference1"); + bbb.Property(x => x.Date).HasJsonPropertyName("InnerDate"); + bbb.Property(x => x.Fraction).HasJsonPropertyName("InnerFraction"); + bbb.Property(x => x.Enum).HasJsonPropertyName("InnerEnum"); + }); + bb.OwnsOne( + x => x.Reference2, bbb => + { + bbb.HasJsonPropertyName("RenamedReference2"); + bbb.Property(x => x.Date).HasJsonPropertyName("InnerDate"); + bbb.Property(x => x.Fraction).HasJsonPropertyName("InnerFraction"); + bbb.Property(x => x.Enum).HasJsonPropertyName("InnerEnum"); + }); + bb.OwnsMany( + x => x.Collection1, bbb => + { + bbb.HasJsonPropertyName("RenamedCollection1"); + bbb.Property(x => x.Date).HasJsonPropertyName("InnerDate"); + bbb.Property(x => x.Fraction).HasJsonPropertyName("InnerFraction"); + bbb.Property(x => x.Enum).HasJsonPropertyName("InnerEnum"); + }); + bb.OwnsMany( + x => x.Collection2, bbb => + { + bbb.HasJsonPropertyName("RenamedCollection2"); + bbb.Property(x => x.Date).HasJsonPropertyName("InnerDate"); + bbb.Property(x => x.Fraction).HasJsonPropertyName("InnerFraction"); + bbb.Property(x => x.Enum).HasJsonPropertyName("InnerEnum"); + }); + }); - b.OwnsMany( - x => x.OwnedCollection1, bb => - { - bb.Property(x => x.Date).HasJsonPropertyName("OuterDate"); - bb.Property(x => x.Fraction).HasJsonPropertyName("OuterFraction"); - bb.Property(x => x.Enum).HasJsonPropertyName("OuterEnum"); - bb.OwnsOne( - x => x.Reference1, bbb => - { - bbb.HasJsonPropertyName("RenamedReference1"); - bbb.Property(x => x.Date).HasJsonPropertyName("InnerDate"); - bbb.Property(x => x.Fraction).HasJsonPropertyName("InnerFraction"); - bbb.Property(x => x.Enum).HasJsonPropertyName("InnerEnum"); - }); - bb.OwnsOne( - x => x.Reference2, bbb => - { - bbb.HasJsonPropertyName("RenamedReference2"); - bbb.Property(x => x.Date).HasJsonPropertyName("InnerDate"); - bbb.Property(x => x.Fraction).HasJsonPropertyName("InnerFraction"); - bbb.Property(x => x.Enum).HasJsonPropertyName("InnerEnum"); - }); - bb.OwnsMany( - x => x.Collection1, bbb => - { - bbb.HasJsonPropertyName("RenamedCollection1"); - bbb.Property(x => x.Date).HasJsonPropertyName("InnerDate"); - bbb.Property(x => x.Fraction).HasJsonPropertyName("InnerFraction"); - bbb.Property(x => x.Enum).HasJsonPropertyName("InnerEnum"); - }); - bb.OwnsMany( - x => x.Collection2, bbb => - { - bbb.HasJsonPropertyName("RenamedCollection2"); - bbb.Property(x => x.Date).HasJsonPropertyName("InnerDate"); - bbb.Property(x => x.Fraction).HasJsonPropertyName("InnerFraction"); - bbb.Property(x => x.Enum).HasJsonPropertyName("InnerEnum"); - }); - bb.ToJson(); - }); + b.OwnsMany( + x => x.OwnedCollection1, bb => + { + bb.Property(x => x.Date).HasJsonPropertyName("OuterDate"); + bb.Property(x => x.Fraction).HasJsonPropertyName("OuterFraction"); + bb.Property(x => x.Enum).HasJsonPropertyName("OuterEnum"); + bb.OwnsOne( + x => x.Reference1, bbb => + { + bbb.HasJsonPropertyName("RenamedReference1"); + bbb.Property(x => x.Date).HasJsonPropertyName("InnerDate"); + bbb.Property(x => x.Fraction).HasJsonPropertyName("InnerFraction"); + bbb.Property(x => x.Enum).HasJsonPropertyName("InnerEnum"); + }); + bb.OwnsOne( + x => x.Reference2, bbb => + { + bbb.HasJsonPropertyName("RenamedReference2"); + bbb.Property(x => x.Date).HasJsonPropertyName("InnerDate"); + bbb.Property(x => x.Fraction).HasJsonPropertyName("InnerFraction"); + bbb.Property(x => x.Enum).HasJsonPropertyName("InnerEnum"); + }); + bb.OwnsMany( + x => x.Collection1, bbb => + { + bbb.HasJsonPropertyName("RenamedCollection1"); + bbb.Property(x => x.Date).HasJsonPropertyName("InnerDate"); + bbb.Property(x => x.Fraction).HasJsonPropertyName("InnerFraction"); + bbb.Property(x => x.Enum).HasJsonPropertyName("InnerEnum"); + }); + bb.OwnsMany( + x => x.Collection2, bbb => + { + bbb.HasJsonPropertyName("RenamedCollection2"); + bbb.Property(x => x.Date).HasJsonPropertyName("InnerDate"); + bbb.Property(x => x.Fraction).HasJsonPropertyName("InnerFraction"); + bbb.Property(x => x.Enum).HasJsonPropertyName("InnerEnum"); + }); + bb.ToJson(); + }); - b.Ignore(x => x.OwnedReference2); - b.Ignore(x => x.OwnedCollection2); - }); + b.Ignore(x => x.OwnedReference2); + b.Ignore(x => x.OwnedCollection2); + }); var model = modelBuilder.FinalizeModel(); var outerOwnedEntities = model.FindEntityTypes(typeof(OwnedEntityExtraLevel)); @@ -1683,88 +1757,11 @@ public virtual void Json_entity_with_custom_property_names() Assert.Equal("InnerEnum", ownedEntity.GetProperty("Enum").GetJsonPropertyName()); } } - - [ConditionalFact] - public virtual void Json_entity_and_normal_owned_can_exist_side_to_side_on_same_entity() - { - var modelBuilder = CreateModelBuilder(); - - modelBuilder.Entity( - b => - { - b.OwnsOne(x => x.OwnedReference1); - b.OwnsOne(x => x.OwnedReference2, bb => bb.ToJson("reference")); - b.OwnsMany(x => x.OwnedCollection1); - b.OwnsMany(x => x.OwnedCollection2, bb => bb.ToJson("collection")); - }); - - var model = modelBuilder.FinalizeModel(); - - var ownedEntities = model.FindEntityTypes(typeof(OwnedEntity)); - Assert.Equal(4, ownedEntities.Count()); - Assert.Equal(2, ownedEntities.Where(e => e.IsMappedToJson()).Count()); - Assert.Equal(2, ownedEntities.Where(e => e.IsOwned() && !e.IsMappedToJson()).Count()); - } - - [ConditionalFact] - public virtual void Json_entity_with_nested_structure_same_property_names_() - { - var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => - { - b.OwnsOne( - x => x.OwnedReference1, bb => - { - bb.ToJson("ref1"); - bb.OwnsOne(x => x.Reference1); - bb.OwnsOne(x => x.Reference2); - bb.OwnsMany(x => x.Collection1); - bb.OwnsMany(x => x.Collection2); - }); - - b.OwnsOne( - x => x.OwnedReference2, bb => - { - bb.ToJson("ref2"); - bb.OwnsOne(x => x.Reference1); - bb.OwnsOne(x => x.Reference2); - bb.OwnsMany(x => x.Collection1); - bb.OwnsMany(x => x.Collection2); - }); - - b.OwnsMany( - x => x.OwnedCollection1, bb => - { - bb.ToJson("col1"); - bb.OwnsOne(x => x.Reference1); - bb.OwnsOne(x => x.Reference2); - bb.OwnsMany(x => x.Collection1); - bb.OwnsMany(x => x.Collection2); - }); - - b.OwnsMany( - x => x.OwnedCollection2, bb => - { - bb.ToJson("col2"); - bb.OwnsOne(x => x.Reference1); - bb.OwnsOne(x => x.Reference2); - bb.OwnsMany(x => x.Collection1); - bb.OwnsMany(x => x.Collection2); - }); - }); - - var model = modelBuilder.FinalizeModel(); - var outerOwnedEntities = model.FindEntityTypes(typeof(OwnedEntityExtraLevel)); - Assert.Equal(4, outerOwnedEntities.Count()); - - var ownedEntities = model.FindEntityTypes(typeof(OwnedEntity)); - Assert.Equal(16, ownedEntities.Count()); - } } public class JetModelBuilderFixture : RelationalModelBuilderFixture { - public override TestHelpers TestHelpers => JetTestHelpers.Instance; + public override TestHelpers TestHelpers + => JetTestHelpers.Instance; } } diff --git a/test/EFCore.Jet.FunctionalTests/ModelBuilding/JetTestModelBuilderExtensions.cs b/test/EFCore.Jet.FunctionalTests/ModelBuilding/JetTestModelBuilderExtensions.cs index 1145292e..f127ed4d 100644 --- a/test/EFCore.Jet.FunctionalTests/ModelBuilding/JetTestModelBuilderExtensions.cs +++ b/test/EFCore.Jet.FunctionalTests/ModelBuilding/JetTestModelBuilderExtensions.cs @@ -1,9 +1,14 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.EntityFrameworkCore.ModelBuilding; +using System; + namespace EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding; public static class JetTestModelBuilderExtensions { - + } diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocJsonQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocJsonQueryJetTest.cs index 280ab96d..2fb56f84 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocJsonQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocJsonQueryJetTest.cs @@ -1,23 +1,17 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections.Generic; -using System.Data.Common; +using Microsoft.EntityFrameworkCore; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; using System.Threading.Tasks; -using EntityFrameworkCore.Jet.Diagnostics.Internal; -using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Diagnostics; -using Microsoft.EntityFrameworkCore.Diagnostics.Internal; -using Microsoft.EntityFrameworkCore.Query; -using Microsoft.EntityFrameworkCore.TestUtilities; -using Xunit; -using System.Linq; namespace EntityFrameworkCore.Jet.FunctionalTests.Query; -#nullable disable - -public class AdHocJsonQueryJetTest : AdHocJsonQueryJetTestBase +public class AdHocJsonQueryJetTest(NonSharedFixture fixture) : AdHocJsonQueryJetTestBase(fixture) { -} + public override async Task Read_enum_property_with_legacy_values(bool async) + { + var exception = await Assert.ThrowsAsync(() => base.Read_enum_property_with_legacy_values_core(async)); + } + + protected override string JsonColumnType + => "nvarchar(max)"; +} \ No newline at end of file diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocJsonQueryJetTestBase.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocJsonQueryJetTestBase.cs index 568aed8e..c74bc7f7 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocJsonQueryJetTestBase.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocJsonQueryJetTestBase.cs @@ -1,22 +1,28 @@ -#nullable disable -using EntityFrameworkCore.Jet.Diagnostics.Internal; +using EntityFrameworkCore.Jet.Diagnostics.Internal; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.Diagnostics.Internal; +using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; using System.Collections.Generic; -using System.Data.Common; +using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using Xunit; -namespace Microsoft.EntityFrameworkCore.Query; +namespace EntityFrameworkCore.Jet.FunctionalTests.Query; -public abstract class AdHocJsonQueryJetTestBase : AdHocJsonQueryRelationalTestBase +#nullable disable + +public abstract class AdHocJsonQueryJetTestBase(NonSharedFixture fixture) : AdHocJsonQueryRelationalTestBase(fixture) { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; + protected void AssertSql(params string[] expected) + => TestSqlLoggerFactory.AssertBaseline(expected); + protected override void ConfigureWarnings(WarningsConfigurationBuilder builder) { base.ConfigureWarnings(builder); @@ -24,6 +30,220 @@ protected override void ConfigureWarnings(WarningsConfigurationBuilder builder) builder.Log(CoreEventId.StringEnumValueInJson); } + public override async Task Project_root_with_missing_scalars(bool async) + { + await base.Project_root_with_missing_scalars(async); + + AssertSql( + """ +SELECT [e].[Id], [e].[Name], [e].[Collection], [e].[OptionalReference], [e].[RequiredReference] +FROM [Entities] AS [e] +WHERE [e].[Id] < 4 +"""); + } + + public override async Task Project_top_level_json_entity_with_missing_scalars(bool async) + { + await base.Project_top_level_json_entity_with_missing_scalars(async); + + AssertSql( + """ +SELECT [e].[Id], [e].[OptionalReference], [e].[RequiredReference], [e].[Collection] +FROM [Entities] AS [e] +WHERE [e].[Id] < 4 +"""); + } + + public override async Task Project_nested_json_entity_with_missing_scalars(bool async) + { + await base.Project_nested_json_entity_with_missing_scalars(async); + + AssertSql( + """ +SELECT [e].[Id], JSON_QUERY([e].[OptionalReference], '$.NestedOptionalReference'), JSON_QUERY([e].[RequiredReference], '$.NestedRequiredReference'), JSON_QUERY([e].[Collection], '$[0].NestedCollection') +FROM [Entities] AS [e] +WHERE [e].[Id] < 4 +"""); + } + + public override async Task Project_root_entity_with_missing_required_navigation(bool async) + { + await base.Project_root_entity_with_missing_required_navigation(async); + + AssertSql( + """ +SELECT [e].[Id], [e].[Name], [e].[Collection], [e].[OptionalReference], [e].[RequiredReference] +FROM [Entities] AS [e] +WHERE [e].[Id] = 5 +"""); + } + + public override async Task Project_missing_required_navigation(bool async) + { + await base.Project_missing_required_navigation(async); + + AssertSql( + """ +SELECT JSON_QUERY([e].[RequiredReference], '$.NestedRequiredReference'), [e].[Id] +FROM [Entities] AS [e] +WHERE [e].[Id] = 5 +"""); + } + + public override async Task Project_root_entity_with_null_required_navigation(bool async) + { + await base.Project_root_entity_with_null_required_navigation(async); + + AssertSql( + """ +SELECT [e].[Id], [e].[Name], [e].[Collection], [e].[OptionalReference], [e].[RequiredReference] +FROM [Entities] AS [e] +WHERE [e].[Id] = 6 +"""); + } + + public override async Task Project_null_required_navigation(bool async) + { + await base.Project_null_required_navigation(async); + + AssertSql( + """ +SELECT [e].[RequiredReference], [e].[Id] +FROM [Entities] AS [e] +WHERE [e].[Id] = 6 +"""); + } + + public override async Task Project_missing_required_scalar(bool async) + { + await base.Project_missing_required_scalar(async); + + switch (JsonColumnType) + { + case "json": + AssertSql( + """ +SELECT [e].[Id], JSON_VALUE([e].[RequiredReference], '$.Number' RETURNING float) AS [Number] +FROM [Entities] AS [e] +WHERE [e].[Id] = 2 +"""); + break; + case "nvarchar(max)": + AssertSql( + """ +SELECT [e].[Id], CAST(JSON_VALUE([e].[RequiredReference], '$.Number') AS float) AS [Number] +FROM [Entities] AS [e] +WHERE [e].[Id] = 2 +"""); + break; + default: + throw new UnreachableException(); + } + } + + public override async Task Project_null_required_scalar(bool async) + { + await base.Project_null_required_scalar(async); + + switch (JsonColumnType) + { + case "json": + AssertSql( + """ +SELECT [e].[Id], JSON_VALUE([e].[RequiredReference], '$.Number' RETURNING float) AS [Number] +FROM [Entities] AS [e] +WHERE [e].[Id] = 4 +"""); + break; + case "nvarchar(max)": + AssertSql( + """ +SELECT [e].[Id], CAST(JSON_VALUE([e].[RequiredReference], '$.Number') AS float) AS [Number] +FROM [Entities] AS [e] +WHERE [e].[Id] = 4 +"""); + break; + default: + throw new UnreachableException(); + } + } + + protected override async Task Seed21006(Context21006 context) + { + await base.Seed21006(context); + + // missing scalar on top level + await context.Database.ExecuteSqlAsync( + $$$""" +INSERT INTO [Entities] ([Collection], [OptionalReference], [RequiredReference], [Id], [Name]) +VALUES ( +'[{"Text":"e2 c1","NestedCollection":[{"DoB":"2000-01-01T00:00:00","Text":"e2 c1 c1"},{"DoB":"2000-01-01T00:00:00","Text":"e2 c1 c2"}],"NestedOptionalReference":{"DoB":"2000-01-01T00:00:00","Text":"e2 c1 nor"},"NestedRequiredReference":{"DoB":"2000-01-01T00:00:00","Text":"e2 c1 nrr"}},{"Text":"e2 c2","NestedCollection":[{"DoB":"2000-01-01T00:00:00","Text":"e2 c2 c1"},{"DoB":"2000-01-01T00:00:00","Text":"e2 c2 c2"}],"NestedOptionalReference":{"DoB":"2000-01-01T00:00:00","Text":"e2 c2 nor"},"NestedRequiredReference":{"DoB":"2000-01-01T00:00:00","Text":"e2 c2 nrr"}}]', +'{"Text":"e2 or","NestedCollection":[{"DoB":"2000-01-01T00:00:00","Text":"e2 or c1"},{"DoB":"2000-01-01T00:00:00","Text":"e2 or c2"}],"NestedOptionalReference":{"DoB":"2000-01-01T00:00:00","Text":"e2 or nor"},"NestedRequiredReference":{"DoB":"2000-01-01T00:00:00","Text":"e2 or nrr"}}', +'{"Text":"e2 rr","NestedCollection":[{"DoB":"2000-01-01T00:00:00","Text":"e2 rr c1"},{"DoB":"2000-01-01T00:00:00","Text":"e2 rr c2"}],"NestedOptionalReference":{"DoB":"2000-01-01T00:00:00","Text":"e2 rr nor"},"NestedRequiredReference":{"DoB":"2000-01-01T00:00:00","Text":"e2 rr nrr"}}', +2, +'e2') +"""); + + // missing scalar on nested level + await context.Database.ExecuteSqlAsync( + $$$""" +INSERT INTO [Entities] ([Collection], [OptionalReference], [RequiredReference], [Id], [Name]) +VALUES ( +'[{"Number":7,"Text":"e3 c1","NestedCollection":[{"Text":"e3 c1 c1"},{"Text":"e3 c1 c2"}],"NestedOptionalReference":{"Text":"e3 c1 nor"},"NestedRequiredReference":{"Text":"e3 c1 nrr"}},{"Number":7,"Text":"e3 c2","NestedCollection":[{"Text":"e3 c2 c1"},{"Text":"e3 c2 c2"}],"NestedOptionalReference":{"Text":"e3 c2 nor"},"NestedRequiredReference":{"Text":"e3 c2 nrr"}}]', +'{"Number":7,"Text":"e3 or","NestedCollection":[{"Text":"e3 or c1"},{"Text":"e3 or c2"}],"NestedOptionalReference":{"Text":"e3 or nor"},"NestedRequiredReference":{"Text":"e3 or nrr"}}', +'{"Number":7,"Text":"e3 rr","NestedCollection":[{"Text":"e3 rr c1"},{"Text":"e3 rr c2"}],"NestedOptionalReference":{"Text":"e3 rr nor"},"NestedRequiredReference":{"Text":"e3 rr nrr"}}', +3, +'e3') +"""); + + // null scalar on top level + await context.Database.ExecuteSqlAsync( + $$$""" +INSERT INTO [Entities] ([Collection], [OptionalReference], [RequiredReference], [Id], [Name]) +VALUES ( +'[{"Number":null,"Text":"e4 c1","NestedCollection":[{"Text":"e4 c1 c1"},{"Text":"e4 c1 c2"}],"NestedOptionalReference":{"Text":"e4 c1 nor"},"NestedRequiredReference":{"Text":"e4 c1 nrr"}},{"Number":null,"Text":"e4 c2","NestedCollection":[{"Text":"e4 c2 c1"},{"Text":"e4 c2 c2"}],"NestedOptionalReference":{"Text":"e4 c2 nor"},"NestedRequiredReference":{"Text":"e4 c2 nrr"}}]', +'{"Number":null,"Text":"e4 or","NestedCollection":[{"Text":"e4 or c1"},{"Text":"e4 or c2"}],"NestedOptionalReference":{"Text":"e4 or nor"},"NestedRequiredReference":{"Text":"e4 or nrr"}}', +'{"Number":null,"Text":"e4 rr","NestedCollection":[{"Text":"e4 rr c1"},{"Text":"e4 rr c2"}],"NestedOptionalReference":{"Text":"e4 rr nor"},"NestedRequiredReference":{"Text":"e4 rr nrr"}}', +4, +'e4') +"""); + + // missing required navigation + await context.Database.ExecuteSqlAsync( + $$$""" +INSERT INTO [Entities] ([Collection], [OptionalReference], [RequiredReference], [Id], [Name]) +VALUES ( +'[{"Number":7,"Text":"e5 c1","NestedCollection":[{"DoB":"2000-01-01T00:00:00","Text":"e5 c1 c1"},{"DoB":"2000-01-01T00:00:00","Text":"e5 c1 c2"}],"NestedOptionalReference":{"DoB":"2000-01-01T00:00:00","Text":"e5 c1 nor"}},{"Number":7,"Text":"e5 c2","NestedCollection":[{"DoB":"2000-01-01T00:00:00","Text":"e5 c2 c1"},{"DoB":"2000-01-01T00:00:00","Text":"e5 c2 c2"}],"NestedOptionalReference":{"DoB":"2000-01-01T00:00:00","Text":"e5 c2 nor"}}]', +'{"Number":7,"Text":"e5 or","NestedCollection":[{"DoB":"2000-01-01T00:00:00","Text":"e5 or c1"},{"DoB":"2000-01-01T00:00:00","Text":"e5 or c2"}],"NestedOptionalReference":{"DoB":"2000-01-01T00:00:00","Text":"e5 or nor"}}', +'{"Number":7,"Text":"e5 rr","NestedCollection":[{"DoB":"2000-01-01T00:00:00","Text":"e5 rr c1"},{"DoB":"2000-01-01T00:00:00","Text":"e5 rr c2"}],"NestedOptionalReference":{"DoB":"2000-01-01T00:00:00","Text":"e5 rr nor"}}', +5, +'e5') +"""); + + // null required navigation + await context.Database.ExecuteSqlAsync( + $$$""" +INSERT INTO [Entities] ([Collection], [OptionalReference], [RequiredReference], [Id], [Name]) +VALUES ( +'[{"Number":7,"Text":"e6 c1","NestedCollection":[{"DoB":"2000-01-01T00:00:00","Text":"e6 c1 c1"},{"DoB":"2000-01-01T00:00:00","Text":"e6 c1 c2"}],"NestedOptionalReference":{"DoB":"2000-01-01T00:00:00","Text":"e6 c1 nor"},"NestedRequiredReference":null},{"Number":7,"Text":"e6 c2","NestedCollection":[{"DoB":"2000-01-01T00:00:00","Text":"e6 c2 c1"},{"DoB":"2000-01-01T00:00:00","Text":"e6 c2 c2"}],"NestedOptionalReference":{"DoB":"2000-01-01T00:00:00","Text":"e6 c2 nor"},"NestedRequiredReference":null}]', +'{"Number":7,"Text":"e6 or","NestedCollection":[{"DoB":"2000-01-01T00:00:00","Text":"e6 or c1"},{"DoB":"2000-01-01T00:00:00","Text":"e6 or c2"}],"NestedOptionalReference":{"DoB":"2000-01-01T00:00:00","Text":"e6 or nor"},"NestedRequiredReference":null}', +'{"Number":7,"Text":"e6 rr","NestedCollection":[{"DoB":"2000-01-01T00:00:00","Text":"e6 rr c1"},{"DoB":"2000-01-01T00:00:00","Text":"e6 rr c2"}],"NestedOptionalReference":{"DoB":"2000-01-01T00:00:00","Text":"e6 rr nor"},"NestedRequiredReference":null}', +6, +'e6') +"""); + } + + protected override async Task Seed29219(DbContext ctx) + { + await base.Seed29219(ctx); + + await ctx.Database.ExecuteSqlAsync( + $$""" +INSERT INTO [Entities] ([Id], [Reference], [Collection]) +VALUES(3, '{ "NonNullableScalar" : 30 }', '[{ "NonNullableScalar" : 10001 }]') +"""); + } + protected override async Task Seed30028(DbContext ctx) { // complete @@ -70,50 +290,39 @@ INSERT INTO [Reviews] ([Rounds], [Id]) VALUES('[{"RoundNumber":11,"SubRounds":[{"SubRoundNumber":111},{"SubRoundNumber":112}]}]', 1) """); - protected override Task SeedArrayOfPrimitives(DbContext ctx) + protected override async Task Seed34960(Context34960 ctx) { - var entity1 = new MyEntityArrayOfPrimitives - { - Id = 1, - Reference = new MyJsonEntityArrayOfPrimitives - { - IntArray = [1, 2, 3], - ListOfString = - [ - "Foo", - "Bar", - "Baz" - ] - }, - Collection = - [ - new MyJsonEntityArrayOfPrimitives { IntArray = [111, 112, 113], ListOfString = ["Foo11", "Bar11"] }, - new MyJsonEntityArrayOfPrimitives { IntArray = [211, 212, 213], ListOfString = ["Foo12", "Bar12"] } - ] - }; - - var entity2 = new MyEntityArrayOfPrimitives - { - Id = 2, - Reference = new MyJsonEntityArrayOfPrimitives - { - IntArray = [10, 20, 30], - ListOfString = - [ - "A", - "B", - "C" - ] - }, - Collection = - [ - new MyJsonEntityArrayOfPrimitives { IntArray = [110, 120, 130], ListOfString = ["A1", "Z1"] }, - new MyJsonEntityArrayOfPrimitives { IntArray = [210, 220, 230], ListOfString = ["A2", "Z2"] } - ] - }; - - ctx.AddRange(entity1, entity2); - return ctx.SaveChangesAsync(); + await base.Seed34960(ctx); + + // JSON nulls + await ctx.Database.ExecuteSqlAsync( + $$""" +INSERT INTO [Entities] ([Collection], [Reference], [Id]) +VALUES( +'null', +'null', +4) +"""); + + // JSON object where collection should be + await ctx.Database.ExecuteSqlAsync( + $$""" +INSERT INTO [Junk] ([Collection], [Reference], [Id]) +VALUES( +'{ "DoB":"2000-01-01T00:00:00","Text":"junk" }', +NULL, +1) +"""); + + // JSON array where entity should be + await ctx.Database.ExecuteSqlAsync( + $$""" +INSERT INTO [Junk] ([Collection], [Reference], [Id]) +VALUES( +NULL, +'[{ "DoB":"2000-01-01T00:00:00","Text":"junk" }]', +2) +"""); } protected override Task SeedJunkInJson(DbContext ctx) @@ -168,11 +377,113 @@ INSERT INTO [Entities] ([Json], [Id]) """); } + protected override async Task SeedBadJsonProperties(ContextBadJsonProperties ctx) + { + await ctx.Database.ExecuteSqlAsync( + $$""" +INSERT INTO [Entities] ([Id], [Scenario], [OptionalReference], [RequiredReference], [Collection]) +VALUES( +1, +'baseline', +'{"NestedOptional": { "Text":"or no" }, "NestedRequired": { "Text":"or nr" }, "NestedCollection": [ { "Text":"or nc 1" }, { "Text":"or nc 2" } ] }', +'{"NestedOptional": { "Text":"rr no" }, "NestedRequired": { "Text":"rr nr" }, "NestedCollection": [ { "Text":"rr nc 1" }, { "Text":"rr nc 2" } ] }', +'[ +{"NestedOptional": { "Text":"c 1 no" }, "NestedRequired": { "Text":"c 1 nr" }, "NestedCollection": [ { "Text":"c 1 nc 1" }, { "Text":"c 1 nc 2" } ] }, +{"NestedOptional": { "Text":"c 2 no" }, "NestedRequired": { "Text":"c 2 nr" }, "NestedCollection": [ { "Text":"c 2 nc 1" }, { "Text":"c 2 nc 2" } ] } +]') +"""); + + await ctx.Database.ExecuteSqlAsync( + $$""" +INSERT INTO [Entities] ([Id], [Scenario], [OptionalReference], [RequiredReference], [Collection]) +VALUES( +2, +'duplicated navigations', +'{"NestedOptional": { "Text":"or no" }, "NestedOptional": { "Text":"or no dupnav" }, "NestedRequired": { "Text":"or nr" }, "NestedCollection": [ { "Text":"or nc 1" }, { "Text":"or nc 2" } ], "NestedCollection": [ { "Text":"or nc 1 dupnav" }, { "Text":"or nc 2 dupnav" } ], "NestedRequired": { "Text":"or nr dupnav" } }', +'{"NestedOptional": { "Text":"rr no" }, "NestedOptional": { "Text":"rr no dupnav" }, "NestedRequired": { "Text":"rr nr" }, "NestedCollection": [ { "Text":"rr nc 1" }, { "Text":"rr nc 2" } ], "NestedCollection": [ { "Text":"rr nc 1 dupnav" }, { "Text":"rr nc 2 dupnav" } ], "NestedRequired": { "Text":"rr nr dupnav" } }', +'[ +{"NestedOptional": { "Text":"c 1 no" }, "NestedOptional": { "Text":"c 1 no dupnav" }, "NestedRequired": { "Text":"c 1 nr" }, "NestedCollection": [ { "Text":"c 1 nc 1" }, { "Text":"c 1 nc 2" } ], "NestedCollection": [ { "Text":"c 1 nc 1 dupnav" }, { "Text":"c 1 nc 2 dupnav" } ], "NestedRequired": { "Text":"c 1 nr dupnav" } }, +{"NestedOptional": { "Text":"c 2 no" }, "NestedOptional": { "Text":"c 2 no dupnav" }, "NestedRequired": { "Text":"c 2 nr" }, "NestedCollection": [ { "Text":"c 2 nc 1" }, { "Text":"c 2 nc 2" } ], "NestedCollection": [ { "Text":"c 2 nc 1 dupnav" }, { "Text":"c 2 nc 2 dupnav" } ], "NestedRequired": { "Text":"c 2 nr dupnav" } } +]') +"""); + + await ctx.Database.ExecuteSqlAsync( + $$""" +INSERT INTO [Entities] ([Id], [Scenario], [OptionalReference], [RequiredReference], [Collection]) +VALUES( +3, +'duplicated scalars', +'{"NestedOptional": { "Text":"or no", "Text":"or no dupprop" }, "NestedRequired": { "Text":"or nr", "Text":"or nr dupprop" }, "NestedCollection": [ { "Text":"or nc 1", "Text":"or nc 1 dupprop" }, { "Text":"or nc 2", "Text":"or nc 2 dupprop" } ] }', +'{"NestedOptional": { "Text":"rr no", "Text":"rr no dupprop" }, "NestedRequired": { "Text":"rr nr", "Text":"rr nr dupprop" }, "NestedCollection": [ { "Text":"rr nc 1", "Text":"rr nc 1 dupprop" }, { "Text":"rr nc 2", "Text":"rr nc 2 dupprop" } ] }', +'[ +{"NestedOptional": { "Text":"c 1 no", "Text":"c 1 no dupprop" }, "NestedRequired": { "Text":"c 1 nr", "Text":"c 1 nr dupprop" }, "NestedCollection": [ { "Text":"c 1 nc 1", "Text":"c 1 nc 1 dupprop" }, { "Text":"c 1 nc 2", "Text":"c 1 nc 2 dupprop" } ] }, +{"NestedOptional": { "Text":"c 2 no", "Text":"c 2 no dupprop" }, "NestedRequired": { "Text":"c 2 nr", "Text":"c 2 nr dupprop" }, "NestedCollection": [ { "Text":"c 2 nc 1", "Text":"c 2 nc 1 dupprop" }, { "Text":"c 2 nc 2", "Text":"c 2 nc 2 dupprop" } ] } +]') +"""); + + await ctx.Database.ExecuteSqlAsync( + $$""" +INSERT INTO [Entities] ([Id], [Scenario], [OptionalReference], [RequiredReference], [Collection]) +VALUES( +4, +'empty navigation property names', +'{"": { "Text":"or no" }, "": { "Text":"or nr" }, "": [ { "Text":"or nc 1" }, { "Text":"or nc 2" } ] }', +'{"": { "Text":"rr no" }, "": { "Text":"rr nr" }, "": [ { "Text":"rr nc 1" }, { "Text":"rr nc 2" } ] }', +'[ +{"": { "Text":"c 1 no" }, "": { "Text":"c 1 nr" }, "": [ { "Text":"c 1 nc 1" }, { "Text":"c 1 nc 2" } ] }, +{"": { "Text":"c 2 no" }, "": { "Text":"c 2 nr" }, "": [ { "Text":"c 2 nc 1" }, { "Text":"c 2 nc 2" } ] } +]') +"""); + + await ctx.Database.ExecuteSqlAsync( + $$""" +INSERT INTO [Entities] ([Id], [Scenario], [OptionalReference], [RequiredReference], [Collection]) +VALUES( +5, +'empty scalar property names', +'{"NestedOptional": { "":"or no" }, "NestedRequired": { "":"or nr" }, "NestedCollection": [ { "":"or nc 1" }, { "":"or nc 2" } ] }', +'{"NestedOptional": { "":"rr no" }, "NestedRequired": { "":"rr nr" }, "NestedCollection": [ { "":"rr nc 1" }, { "":"rr nc 2" } ] }', +'[ +{"NestedOptional": { "":"c 1 no" }, "NestedRequired": { "":"c 1 nr" }, "NestedCollection": [ { "":"c 1 nc 1" }, { "":"c 1 nc 2" } ] }, +{"NestedOptional": { "":"c 2 no" }, "NestedRequired": { "":"c 2 nr" }, "NestedCollection": [ { "":"c 2 nc 1" }, { "":"c 2 nc 2" } ] } +]') +"""); + + await ctx.Database.ExecuteSqlAsync( + $$""" +INSERT INTO [Entities] ([Id], [Scenario], [OptionalReference], [RequiredReference], [Collection]) +VALUES( +10, +'null navigation property names', +'{null: { "Text":"or no" }, null: { "Text":"or nr" }, null: [ { "Text":"or nc 1" }, { "Text":"or nc 2" } ] }', +'{null: { "Text":"rr no" }, null: { "Text":"rr nr" }, null: [ { "Text":"rr nc 1" }, { "Text":"rr nc 2" } ] }', +'[ +{null: { "Text":"c 1 no" }, null: { "Text":"c 1 nr" }, null: [ { "Text":"c 1 nc 1" }, { "Text":"c 1 nc 2" } ] }, +{null: { "Text":"c 2 no" }, null: { "Text":"c 2 nr" }, null: [ { "Text":"c 2 nc 1" }, { "Text":"c 2 nc 2" } ] } +]') +"""); + + await ctx.Database.ExecuteSqlAsync( + $$""" +INSERT INTO [Entities] ([Id], [Scenario], [OptionalReference], [RequiredReference], [Collection]) +VALUES( +11, +'null scalar property names', +'{"NestedOptional": { null:"or no", "Text":"or no nonnull" }, "NestedRequired": { null:"or nr", "Text":"or nr nonnull" }, "NestedCollection": [ { null:"or nc 1", "Text":"or nc 1 nonnull" }, { null:"or nc 2", "Text":"or nc 2 nonnull" } ] }', +'{"NestedOptional": { null:"rr no", "Text":"rr no nonnull" }, "NestedRequired": { null:"rr nr", "Text":"rr nr nonnull" }, "NestedCollection": [ { null:"rr nc 1", "Text":"rr nc 1 nonnull" }, { null:"rr nc 2", "Text":"rr nc 2 nonnull" } ] }', +'[ +{"NestedOptional": { null:"c 1 no", "Text":"c 1 no nonnull" }, "NestedRequired": { null:"c 1 nr", "Text":"c 1 nr nonnull" }, "NestedCollection": [ { null:"c 1 nc 1", "Text":"c 1 nc 1 nonnull" }, { null:"c 1 nc 2", "Text":"c 1 nc 2 nonnull" } ] }, +{"NestedOptional": { null:"c 2 no", "Text":"c 2 no nonnull" }, "NestedRequired": { null:"c 2 nr", "Text":"c 2 nr nonnull" }, "NestedCollection": [ { null:"c 2 nc 1", "Text":"c 2 nc 1 nonnull" }, { null:"c 2 nc 2", "Text":"c 2 nc 2 nonnull" } ] } +]') +"""); + } + #region EnumLegacyValues - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual async Task Read_enum_property_with_legacy_values(bool async) + [ConditionalTheory, MemberData(nameof(IsAsyncData))] + public abstract Task Read_enum_property_with_legacy_values(bool async); + + protected virtual async Task Read_enum_property_with_legacy_values_core(bool async) { var contextFactory = await InitializeAsync( onModelCreating: BuildModelEnumLegacyValues, @@ -180,25 +491,26 @@ public virtual async Task Read_enum_property_with_legacy_values(bool async) seed: SeedEnumLegacyValues); using var context = contextFactory.CreateContext(); - var query = context.Set().Select( - x => new - { - x.Reference.IntEnum, - x.Reference.ByteEnum, - x.Reference.LongEnum, - x.Reference.NullableEnum - }); - - var exception = async - ? await (Assert.ThrowsAsync(() => query.ToListAsync())) - : Assert.Throws(() => query.ToList()); - - // Conversion failed when converting the nvarchar value '...' to data type int - //Assert.Equal(245, exception.Number); + + var query = context.Set().Select(x => new + { + x.Reference.IntEnum, + x.Reference.ByteEnum, + x.Reference.LongEnum, + x.Reference.NullableEnum + }); + + if (async) + { + await query.ToListAsync(); + } + else + { + query.ToList(); + } } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Read_json_entity_with_enum_properties_with_legacy_values(bool async) { var contextFactory = await InitializeAsync( @@ -213,7 +525,7 @@ public virtual async Task Read_json_entity_with_enum_properties_with_legacy_valu var result = async ? await query.ToListAsync() - : [.. query]; + : query.ToList(); Assert.Equal(1, result.Count); Assert.Equal(ByteEnumLegacyValues.Redmond, result[0].ByteEnum); @@ -225,21 +537,20 @@ public virtual async Task Read_json_entity_with_enum_properties_with_legacy_valu var testLogger = new TestLogger(); Assert.Single( - ListLoggerFactory.Log.Where( - l => l.Message == CoreResources.LogStringEnumValueInJson(testLogger).GenerateMessage(nameof(ByteEnumLegacyValues)))); + ListLoggerFactory.Log, + l => l.Message == CoreResources.LogStringEnumValueInJson(testLogger).GenerateMessage(nameof(ByteEnumLegacyValues))); Assert.Single( - ListLoggerFactory.Log.Where( - l => l.Message == CoreResources.LogStringEnumValueInJson(testLogger).GenerateMessage(nameof(IntEnumLegacyValues)))); + ListLoggerFactory.Log, + l => l.Message == CoreResources.LogStringEnumValueInJson(testLogger).GenerateMessage(nameof(IntEnumLegacyValues))); Assert.Single( - ListLoggerFactory.Log.Where( - l => l.Message == CoreResources.LogStringEnumValueInJson(testLogger).GenerateMessage(nameof(LongEnumLegacyValues)))); + ListLoggerFactory.Log, + l => l.Message == CoreResources.LogStringEnumValueInJson(testLogger).GenerateMessage(nameof(LongEnumLegacyValues))); Assert.Single( - ListLoggerFactory.Log.Where( - l => l.Message == CoreResources.LogStringEnumValueInJson(testLogger).GenerateMessage(nameof(ULongEnumLegacyValues)))); + ListLoggerFactory.Log, + l => l.Message == CoreResources.LogStringEnumValueInJson(testLogger).GenerateMessage(nameof(ULongEnumLegacyValues))); } - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual async Task Read_json_entity_collection_with_enum_properties_with_legacy_values(bool async) { var contextFactory = await InitializeAsync( @@ -254,7 +565,7 @@ public virtual async Task Read_json_entity_collection_with_enum_properties_with_ var result = async ? await query.ToListAsync() - : [.. query]; + : query.ToList(); Assert.Equal(1, result.Count); Assert.Equal(2, result[0].Count); @@ -272,17 +583,17 @@ public virtual async Task Read_json_entity_collection_with_enum_properties_with_ var testLogger = new TestLogger(); Assert.Single( - ListLoggerFactory.Log.Where( - l => l.Message == CoreResources.LogStringEnumValueInJson(testLogger).GenerateMessage(nameof(ByteEnumLegacyValues)))); + ListLoggerFactory.Log, + l => l.Message == CoreResources.LogStringEnumValueInJson(testLogger).GenerateMessage(nameof(ByteEnumLegacyValues))); Assert.Single( - ListLoggerFactory.Log.Where( - l => l.Message == CoreResources.LogStringEnumValueInJson(testLogger).GenerateMessage(nameof(IntEnumLegacyValues)))); + ListLoggerFactory.Log, + l => l.Message == CoreResources.LogStringEnumValueInJson(testLogger).GenerateMessage(nameof(IntEnumLegacyValues))); Assert.Single( - ListLoggerFactory.Log.Where( - l => l.Message == CoreResources.LogStringEnumValueInJson(testLogger).GenerateMessage(nameof(LongEnumLegacyValues)))); + ListLoggerFactory.Log, + l => l.Message == CoreResources.LogStringEnumValueInJson(testLogger).GenerateMessage(nameof(LongEnumLegacyValues))); Assert.Single( - ListLoggerFactory.Log.Where( - l => l.Message == CoreResources.LogStringEnumValueInJson(testLogger).GenerateMessage(nameof(ULongEnumLegacyValues)))); + ListLoggerFactory.Log, + l => l.Message == CoreResources.LogStringEnumValueInJson(testLogger).GenerateMessage(nameof(ULongEnumLegacyValues))); } private Task SeedEnumLegacyValues(DbContext ctx) @@ -290,21 +601,20 @@ private Task SeedEnumLegacyValues(DbContext ctx) $$""" INSERT INTO [Entities] ([Collection], [Reference], [Id], [Name]) VALUES( -'[{"ByteEnum":"Bellevue","IntEnum":"Foo","LongEnum":"One","ULongEnum":"One","Name":"e1_c1","NullableEnum":"Bar"},{"ByteEnum":"Seattle","IntEnum":"Baz","LongEnum":"Two","ULongEnum":"Two","Name":"e1_c2","NullableEnum":null}]', -'{"ByteEnum":"Redmond","IntEnum":"Foo","LongEnum":"Three","ULongEnum":"Three","Name":"e1_r","NullableEnum":"Bar"}', +N'[{"ByteEnum":"Bellevue","IntEnum":"Foo","LongEnum":"One","ULongEnum":"One","Name":"e1_c1","NullableEnum":"Bar"},{"ByteEnum":"Seattle","IntEnum":"Baz","LongEnum":"Two","ULongEnum":"Two","Name":"e1_c2","NullableEnum":null}]', +N'{"ByteEnum":"Redmond","IntEnum":"Foo","LongEnum":"Three","ULongEnum":"Three","Name":"e1_r","NullableEnum":"Bar"}', 1, -'e1') +N'e1') """); protected virtual void BuildModelEnumLegacyValues(ModelBuilder modelBuilder) - => modelBuilder.Entity( - b => - { - b.ToTable("Entities"); - b.Property(x => x.Id).ValueGeneratedNever(); - b.OwnsOne(x => x.Reference, b => b.ToJson().HasColumnType(JsonColumnType)); - b.OwnsMany(x => x.Collection, b => b.ToJson().HasColumnType(JsonColumnType)); - }); + => modelBuilder.Entity(b => + { + b.ToTable("Entities"); + b.Property(x => x.Id).ValueGeneratedNever(); + b.OwnsOne(x => x.Reference, b => b.ToJson().HasColumnType(JsonColumnType)); + b.OwnsMany(x => x.Collection, b => b.ToJson().HasColumnType(JsonColumnType)); + }); private class MyEntityEnumLegacyValues { @@ -321,12 +631,16 @@ private class MyJsonEntityEnumLegacyValues // ReSharper disable once UnusedAutoPropertyAccessor.Local public IntEnumLegacyValues IntEnum { get; set; } + // ReSharper disable once UnusedAutoPropertyAccessor.Local public ByteEnumLegacyValues ByteEnum { get; set; } + // ReSharper disable once UnusedAutoPropertyAccessor.Local public LongEnumLegacyValues LongEnum { get; set; } + // ReSharper disable once UnusedAutoPropertyAccessor.Local public ULongEnumLegacyValues ULongEnum { get; set; } + // ReSharper disable once UnusedAutoPropertyAccessor.Local public IntEnumLegacyValues? NullableEnum { get; set; } } @@ -360,4 +674,16 @@ private enum ULongEnumLegacyValues : ulong } #endregion + + public override async Task Entity_splitting_with_owned_json() + { + await base.Entity_splitting_with_owned_json(); + + AssertSql( + """ +SELECT TOP 2 `m`.`Id`, `m`.`PropertyInMainTable`, `o`.`PropertyInOtherTable`, `m`.`Json` +FROM `MyEntity` AS `m` +INNER JOIN `OtherTable` AS `o` ON `m`.`Id` = `o`.`Id` +"""); + } } diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocManyToManyQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocManyToManyQueryJetTest.cs index 44e60d1b..0d22c2e0 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocManyToManyQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocManyToManyQueryJetTest.cs @@ -1,9 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -// ReSharper disable InconsistentNaming - -using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs index bb3a5823..95500352 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs @@ -195,7 +195,7 @@ public virtual async Task Select_nested_projection() """, // """ -@id='1' +@id='2' SELECT TOP 2 `c`.`Id`, `c`.`Name` FROM `Customers` AS `c` @@ -203,7 +203,7 @@ public virtual async Task Select_nested_projection() """, // """ -@id='2' +@id='3' SELECT TOP 2 `c`.`Id`, `c`.`Name` FROM `Customers` AS `c` @@ -923,7 +923,7 @@ ORDER BY `p`.`Id` """, // """ -@p0='2' +@p0='3' DELETE FROM `Products` WHERE `Id` = @p0; diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonBulkUpdateJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonBulkUpdateJetTest.cs new file mode 100644 index 00000000..34a17296 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonBulkUpdateJetTest.cs @@ -0,0 +1,435 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexJson; + +public class ComplexJsonBulkUpdateJetTest( + ComplexJsonJetFixture fixture, + ITestOutputHelper testOutputHelper) + : ComplexJsonBulkUpdateRelationalTestBase(fixture, testOutputHelper) +{ + #region Delete + + public override async Task Delete_entity_with_associations() + { + await base.Delete_entity_with_associations(); + + AssertSql( + """ +@deletableEntity_Name='Root3_With_different_values' (Size = 255) + +DELETE FROM `RootEntity` AS `r` +WHERE `r`.`Name` = @deletableEntity_Name +"""); + } + + public override async Task Delete_required_associate() + { + await base.Delete_required_associate(); + + AssertSql(); + } + + public override async Task Delete_optional_associate() + { + await base.Delete_optional_associate(); + + AssertSql(); + } + + #endregion Delete + + #region Update properties + + public override async Task Update_property_inside_associate() + { + await base.Update_property_inside_associate(); + + AssertExecuteUpdateSql( + """ +@p='foo_updated' (Size = 4000) + +UPDATE [r] +SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.String', @p) +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Update_property_inside_associate_with_special_chars() + { + await base.Update_property_inside_associate_with_special_chars(); + + AssertExecuteUpdateSql( + """ +UPDATE [r] +SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.String', N'{ Some other/JSON:like text though it [isn''t]: ממש ממש לאéèéè }') +FROM [RootEntity] AS [r] +WHERE JSON_VALUE([r].[RequiredAssociate], '$.String') = N'{ this may/look:like JSON but it [isn''t]: ממש ממש לאéèéè }' +"""); + } + + public override async Task Update_property_inside_nested_associate() + { + await base.Update_property_inside_nested_associate(); + + AssertExecuteUpdateSql( + """ +@p='foo_updated' (Size = 4000) + +UPDATE [r] +SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.RequiredNestedAssociate.String', @p) +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Update_property_on_projected_associate() + { + await base.Update_property_on_projected_associate(); + + AssertExecuteUpdateSql( + """ +@p='foo_updated' (Size = 4000) + +UPDATE [r] +SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.String', @p) +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Update_property_on_projected_associate_with_OrderBy_Skip() + { + await base.Update_property_on_projected_associate_with_OrderBy_Skip(); + + AssertExecuteUpdateSql(); + } + + public override async Task Update_associate_with_null_required_property() + { + await base.Update_associate_with_null_required_property(); + + AssertExecuteUpdateSql(); + } + + #endregion Update properties + + #region Update association + + public override async Task Update_associate_to_parameter() + { + await base.Update_associate_to_parameter(); + + AssertExecuteUpdateSql( + """ +@complex_type_p='{"Id":1000,"Int":80,"Ints":[1,2,3],"Name":"Updated associate name","String":"Updated nested string","NestedCollection":[],"OptionalNestedAssociate":null,"RequiredNestedAssociate":{"Id":1000,"Int":80,"Ints":[1,2,3],"Name":"Updated nested name","String":"Updated nested string"}}' (Size = 277) + +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate` = @complex_type_p +"""); + } + + public override async Task Update_nested_associate_to_parameter() + { + await base.Update_nested_associate_to_parameter(); + + AssertExecuteUpdateSql( + """ +@complex_type_p='{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name","String":"Updated nested string"}' (Size = 97) + +UPDATE [r] +SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.RequiredNestedAssociate', JSON_QUERY(@complex_type_p)) +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Update_associate_to_another_associate() + { + await base.Update_associate_to_another_associate(); + + AssertExecuteUpdateSql( + """ +UPDATE `RootEntity` AS `r` +SET `r`.`OptionalAssociate` = `r`.`RequiredAssociate` +"""); + } + + public override async Task Update_nested_associate_to_another_nested_associate() + { + await base.Update_nested_associate_to_another_nested_associate(); + + AssertExecuteUpdateSql( + """ +UPDATE [r] +SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.OptionalNestedAssociate', JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate')) +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Update_associate_to_inline() + { + await base.Update_associate_to_inline(); + + AssertExecuteUpdateSql( + """ +@complex_type_p='{"Id":1000,"Int":70,"Ints":[1,2,4],"Name":"Updated associate name","String":"Updated associate string","NestedCollection":[],"OptionalNestedAssociate":null,"RequiredNestedAssociate":{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name","String":"Updated nested string"}}' (Size = 280) + +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate` = @complex_type_p +"""); + } + + public override async Task Update_associate_to_inline_with_lambda() + { + await base.Update_associate_to_inline_with_lambda(); + + AssertExecuteUpdateSql( + """ +UPDATE [r] +SET [r].[RequiredAssociate] = '{"Id":1000,"Int":70,"Ints":[1,2,4],"Name":"Updated associate name","String":"Updated associate string","NestedCollection":[],"OptionalNestedAssociate":null,"RequiredNestedAssociate":{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name","String":"Updated nested string"}}' +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Update_nested_associate_to_inline_with_lambda() + { + await base.Update_nested_associate_to_inline_with_lambda(); + + AssertExecuteUpdateSql( + """ +UPDATE [r] +SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.RequiredNestedAssociate', JSON_QUERY('{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name","String":"Updated nested string"}')) +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Update_associate_to_null() + { + await base.Update_associate_to_null(); + + AssertExecuteUpdateSql( + """ +UPDATE `RootEntity` AS `r` +SET `r`.`OptionalAssociate` = NULL +"""); + } + + public override async Task Update_associate_to_null_with_lambda() + { + await base.Update_associate_to_null_with_lambda(); + + AssertExecuteUpdateSql( + """ +UPDATE `RootEntity` AS `r` +SET `r`.`OptionalAssociate` = NULL +"""); + } + + public override async Task Update_associate_to_null_parameter() + { + await base.Update_associate_to_null_parameter(); + + AssertExecuteUpdateSql( + """ +UPDATE `RootEntity` AS `r` +SET `r`.`OptionalAssociate` = NULL +"""); + } + + public override async Task Update_required_nested_associate_to_null() + { + await base.Update_required_nested_associate_to_null(); + + AssertExecuteUpdateSql(); + } + + #endregion Update association + + #region Update collection + + public override async Task Update_collection_to_parameter() + { + await base.Update_collection_to_parameter(); + + AssertExecuteUpdateSql( + """ +@complex_type_p='[{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated associate name1","String":"Updated associate string1","NestedCollection":[],"OptionalNestedAssociate":null,"RequiredNestedAssociate":{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name1","String":"Updated nested string1"}},{"Id":1001,"Int":81,"Ints":[1,2,4],"Name":"Updated associate name2","String":"Updated associate string2","NestedCollection":[],"OptionalNestedAssociate":null,"RequiredNestedAssociate":{"Id":1001,"Int":81,"Ints":[1,2,4],"Name":"Updated nested name2","String":"Updated nested string2"}}]' (Size = 571) + +UPDATE `RootEntity` AS `r` +SET `r`.`AssociateCollection` = @complex_type_p +"""); + } + + public override async Task Update_nested_collection_to_parameter() + { + await base.Update_nested_collection_to_parameter(); + + AssertExecuteUpdateSql( + """ +@complex_type_p='[{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name1","String":"Updated nested string1"},{"Id":1001,"Int":81,"Ints":[1,2,4],"Name":"Updated nested name2","String":"Updated nested string2"}]' (Size = 201) + +UPDATE [r] +SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.NestedCollection', JSON_QUERY(@complex_type_p)) +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Update_nested_collection_to_inline_with_lambda() + { + await base.Update_nested_collection_to_inline_with_lambda(); + + AssertExecuteUpdateSql( + """ +UPDATE [r] +SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.NestedCollection', JSON_QUERY('[{"Id":1000,"Int":80,"Ints":[1,2,4],"Name":"Updated nested name1","String":"Updated nested string1"},{"Id":1001,"Int":81,"Ints":[1,2,4],"Name":"Updated nested name2","String":"Updated nested string2"}]')) +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Update_nested_collection_to_another_nested_collection() + { + await base.Update_nested_collection_to_another_nested_collection(); + + AssertExecuteUpdateSql( + """ +UPDATE [r] +SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.NestedCollection', JSON_QUERY([r].[OptionalAssociate], '$.NestedCollection')) +FROM [RootEntity] AS [r] +WHERE [r].[OptionalAssociate] IS NOT NULL +"""); + } + + public override async Task Update_collection_referencing_the_original_collection() + { + await base.Update_collection_referencing_the_original_collection(); + + AssertExecuteUpdateSql(); + } + + public override async Task Update_inside_structural_collection() + { + await base.Update_inside_structural_collection(); + + AssertExecuteUpdateSql(); + } + + #endregion Update collection + + #region Update primitive collection + + public override async Task Update_primitive_collection_to_constant() + { + await base.Update_primitive_collection_to_constant(); + + AssertExecuteUpdateSql( + """ +UPDATE [r] +SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.Ints', JSON_QUERY(N'[1,2,4]')) +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Update_primitive_collection_to_parameter() + { + await base.Update_primitive_collection_to_parameter(); + + AssertExecuteUpdateSql( + """ +@ints='[1,2,4]' (Size = 4000) + +UPDATE [r] +SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.Ints', JSON_QUERY(@ints)) +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Update_primitive_collection_to_another_collection() + { + await base.Update_primitive_collection_to_another_collection(); + + AssertExecuteUpdateSql( + """ +UPDATE [r] +SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.OptionalNestedAssociate.Ints', JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate.Ints')) +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Update_inside_primitive_collection() + { + await base.Update_inside_primitive_collection(); + + AssertExecuteUpdateSql( + """ +@p='99' + +UPDATE [r] +SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.Ints[1]', @p) +FROM [RootEntity] AS [r] +WHERE ( + SELECT COUNT(*) + FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) AS [i]) >= 2 +"""); + } + + #endregion Update primitive collection + + #region Multiple updates + + public override async Task Update_multiple_properties_inside_same_associate() + { + await base.Update_multiple_properties_inside_same_associate(); + + // Note that since two properties within the same JSON column are updated, SQL Server 2025 modify + // is not used (it only supports modifying a single property) + AssertExecuteUpdateSql( + """ +@p='foo_updated' (Size = 4000) +@p0='20' + +UPDATE [r] +SET [r].[RequiredAssociate] = JSON_MODIFY(JSON_MODIFY([r].[RequiredAssociate], '$.String', @p), '$.Int', @p0) +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Update_multiple_properties_inside_associates_and_on_entity_type() + { + await base.Update_multiple_properties_inside_associates_and_on_entity_type(); + + AssertExecuteUpdateSql( + """ +@p='foo_updated' (Size = 4000) + +UPDATE [r] +SET [r].[Name] = [r].[Name] + N'Modified', + [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.String', JSON_VALUE([r].[OptionalAssociate], '$.String')), + [r].[OptionalAssociate] = JSON_MODIFY([r].[OptionalAssociate], '$.RequiredNestedAssociate.String', @p) +FROM [RootEntity] AS [r] +WHERE [r].[OptionalAssociate] IS NOT NULL +"""); + } + + public override async Task Update_multiple_projected_associates_via_anonymous_type() + { + await base.Update_multiple_projected_associates_via_anonymous_type(); + + AssertExecuteUpdateSql( + """ +@p='foo_updated' (Size = 4000) + +UPDATE [r] +SET [r].[RequiredAssociate] = JSON_MODIFY([r].[RequiredAssociate], '$.String', JSON_VALUE([r].[OptionalAssociate], '$.String')), + [r].[OptionalAssociate] = JSON_MODIFY([r].[OptionalAssociate], '$.String', @p) +FROM [RootEntity] AS [r] +WHERE [r].[OptionalAssociate] IS NOT NULL +"""); + } + + #endregion Multiple updates + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonCollectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonCollectionJetTest.cs new file mode 100644 index 00000000..4a9feee6 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonCollectionJetTest.cs @@ -0,0 +1,189 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexJson; + +public class ComplexJsonCollectionJetTest(ComplexJsonJetFixture fixture, ITestOutputHelper testOutputHelper) + : ComplexJsonCollectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Count() + { + await base.Count(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE ( + SELECT COUNT(*) + FROM OPENJSON([r].[AssociateCollection], '$') AS [a]) = 2 +"""); + } + + public override async Task Where() + { + await base.Where(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE ( + SELECT COUNT(*) + FROM OPENJSON([r].[AssociateCollection], '$') WITH ([Int] int '$.Int') AS [a] + WHERE [a].[Int] <> 8) = 2 +"""); + } + + public override async Task OrderBy_ElementAt() + { + await base.OrderBy_ElementAt(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE ( + SELECT [a].[Int] + FROM OPENJSON([r].[AssociateCollection], '$') WITH ( + [Id] int '$.Id', + [Int] int '$.Int' + ) AS [a] + ORDER BY [a].[Id] + OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY) = 8 +"""); + } + + #region Distinct + + public override async Task Distinct() + { + AssertSql( +); + } + + public override async Task Distinct_projected(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Distinct_projected(queryTrackingBehavior); + + AssertSql(); + } + + public override async Task Distinct_over_projected_nested_collection() + { + AssertSql( +); + } + + public override async Task Distinct_over_projected_filtered_nested_collection() + { + await base.Distinct_over_projected_filtered_nested_collection(); + + AssertSql(); + } + + #endregion Distinct + + #region Index + + public override async Task Index_constant() + { + await base.Index_constant(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[AssociateCollection], '$[0].Int') AS int) = 8 +"""); + } + + public override async Task Index_parameter() + { + await base.Index_parameter(); + + AssertSql( + """ +@i='0' + +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[AssociateCollection], '$[' + CAST(@i AS nvarchar(max)) + '].Int') AS int) = 8 +"""); + } + + public override async Task Index_column() + { + await base.Index_column(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[AssociateCollection], '$[' + CAST([r].[Id] - 1 AS nvarchar(max)) + '].Int') AS int) = 8 +"""); + } + + public override async Task Index_out_of_bounds() + { + await base.Index_out_of_bounds(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[AssociateCollection], '$[9999].Int') AS int) = 8 +"""); + } + + #endregion Index + + #region GroupBy + + [ConditionalFact] + public override async Task GroupBy() + { + await base.GroupBy(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE 16 IN ( + SELECT COALESCE(SUM([a].[Int]), 0) + FROM OPENJSON([r].[AssociateCollection], '$') WITH ( + [Int] int '$.Int', + [String] nvarchar(max) '$.String' + ) AS [a] + GROUP BY [a].[String] +) +"""); + } + + #endregion GroupBy + + public override async Task Select_within_Select_within_Select_with_aggregates() + { + await base.Select_within_Select_within_Select_with_aggregates(); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(SUM([s].[value]), 0) + FROM OPENJSON([r].[AssociateCollection], '$') WITH ([NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON) AS [a] + OUTER APPLY ( + SELECT MAX([n].[Int]) AS [value] + FROM OPENJSON([a].[NestedCollection], '$') WITH ([Int] int '$.Int') AS [n] + ) AS [s]) +FROM [RootEntity] AS [r] +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonJetFixture.cs new file mode 100644 index 00000000..294fb54d --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonJetFixture.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; +using Microsoft.EntityFrameworkCore.TestUtilities; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexJson; + +public class ComplexJsonJetFixture : ComplexJsonRelationalFixtureBase +{ + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; + + public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) + { + var options = base.AddOptions(builder); + return options; + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonMiscellaneousJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonMiscellaneousJetTest.cs new file mode 100644 index 00000000..6805be6d --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonMiscellaneousJetTest.cs @@ -0,0 +1,95 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexJson; + +public class ComplexJsonMiscellaneousJetTest(ComplexJsonJetFixture fixture, ITestOutputHelper testOutputHelper) + : ComplexJsonMiscellaneousRelationalTestBase(fixture, testOutputHelper) +{ + #region Simple filters + + public override async Task Where_on_associate_scalar_property() + { + await base.Where_on_associate_scalar_property(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[RequiredAssociate], '$.Int') AS int) = 8 +"""); + } + + public override async Task Where_on_optional_associate_scalar_property() + { + await base.Where_on_optional_associate_scalar_property(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[OptionalAssociate], '$.Int') AS int) = 8 +"""); + } + + public override async Task Where_on_nested_associate_scalar_property() + { + await base.Where_on_nested_associate_scalar_property(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[RequiredAssociate], '$.RequiredNestedAssociate.Int') AS int) = 8 +"""); + } + + #endregion Simple filters + + #region Value types + + public override async Task Where_property_on_non_nullable_value_type() + { + await base.Where_property_on_non_nullable_value_type(); + + AssertSql( + """ +SELECT [v].[Id], [v].[Name], [v].[AssociateCollection], [v].[OptionalAssociate], [v].[RequiredAssociate] +FROM [ValueRootEntity] AS [v] +WHERE CAST(JSON_VALUE([v].[RequiredAssociate], '$.Int') AS int) = 8 +"""); + } + + public override async Task Where_property_on_nullable_value_type_Value() + { + await base.Where_property_on_nullable_value_type_Value(); + + AssertSql( + """ +SELECT [v].[Id], [v].[Name], [v].[AssociateCollection], [v].[OptionalAssociate], [v].[RequiredAssociate] +FROM [ValueRootEntity] AS [v] +WHERE CAST(JSON_VALUE([v].[OptionalAssociate], '$.Int') AS int) = 8 +"""); + } + + public override async Task Where_HasValue_on_nullable_value_type() + { + await base.Where_HasValue_on_nullable_value_type(); + + AssertSql( + """ +SELECT `v`.`Id`, `v`.`Name`, `v`.`AssociateCollection`, `v`.`OptionalAssociate`, `v`.`RequiredAssociate` +FROM `ValueRootEntity` AS `v` +WHERE (`v`.`OptionalAssociate`) IS NOT NULL +"""); + } + + #endregion Value types + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonPrimitiveCollectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonPrimitiveCollectionJetTest.cs new file mode 100644 index 00000000..553c00fd --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonPrimitiveCollectionJetTest.cs @@ -0,0 +1,101 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexJson; + +public class ComplexJsonPrimitiveCollectionJetTest(ComplexJsonJetFixture fixture, ITestOutputHelper testOutputHelper) + : ComplexJsonPrimitiveCollectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Count() + { + await base.Count(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE ( + SELECT COUNT(*) + FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) AS [i]) = 3 +"""); + } + + public override async Task Index() + { + await base.Index(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[RequiredAssociate], '$.Ints[0]') AS int) = 1 +"""); + } + + public override async Task Contains() + { + await base.Contains(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE 3 IN ( + SELECT [i].[value] + FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) WITH ([value] int '$') AS [i] +) +"""); + } + + public override async Task Any_predicate() + { + await base.Any_predicate(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE 2 IN ( + SELECT [i].[value] + FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) WITH ([value] int '$') AS [i] +) +"""); + } + + public override async Task Nested_Count() + { + await base.Nested_Count(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE ( + SELECT COUNT(*) + FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate.Ints')) AS [i]) = 3 +"""); + } + + public override async Task Select_Sum() + { + await base.Select_Sum(); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(SUM([i0].[value]), 0) + FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) WITH ([value] int '$') AS [i0]) +FROM [RootEntity] AS [r] +WHERE ( + SELECT COALESCE(SUM([i].[value]), 0) + FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) WITH ([value] int '$') AS [i]) >= 6 +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionJetTest.cs new file mode 100644 index 00000000..b871b5ba --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonProjectionJetTest.cs @@ -0,0 +1,375 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexJson; + +public class ComplexJsonProjectionJetTest(ComplexJsonJetFixture fixture, ITestOutputHelper testOutputHelper) + : ComplexJsonProjectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` +FROM `RootEntity` AS `r` +"""); + } + + #region Scalar properties + + public override async Task Select_scalar_property_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_scalar_property_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT JSON_VALUE([r].[RequiredAssociate], '$.String') +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Select_property_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_property_on_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT JSON_VALUE([r].[OptionalAssociate], '$.String') +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Select_value_type_property_on_null_associate_throws(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_value_type_property_on_null_associate_throws(queryTrackingBehavior); + + AssertSql( +); + } + + public override async Task Select_nullable_value_type_property_on_null_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nullable_value_type_property_on_null_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT CAST(JSON_VALUE([r].[OptionalAssociate], '$.Int') AS int) +FROM [RootEntity] AS [r] +"""); + } + + #endregion Scalar properties + + #region Structural properties + + public override async Task Select_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`RequiredAssociate` +FROM `RootEntity` AS `r` +"""); + } + + public override async Task Select_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`OptionalAssociate` +FROM `RootEntity` AS `r` +"""); + } + + public override async Task Select_required_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_nested_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate') +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Select_optional_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_nested_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT JSON_QUERY([r].[RequiredAssociate], '$.OptionalNestedAssociate') +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Select_required_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_nested_on_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT JSON_QUERY([r].[OptionalAssociate], '$.RequiredNestedAssociate') +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Select_optional_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_nested_on_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT JSON_QUERY([r].[OptionalAssociate], '$.OptionalNestedAssociate') +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Select_required_associate_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_associate_via_optional_navigation(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r0`.`RequiredAssociate` +FROM `RootReferencingEntity` AS `r` +LEFT JOIN `RootEntity` AS `r0` ON `r`.`RootEntityId` = `r0`.`Id` +"""); + } + + public override async Task Select_unmapped_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_unmapped_associate_scalar_property(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` +FROM `RootEntity` AS `r` +"""); + } + + public override async Task Select_untranslatable_method_on_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_untranslatable_method_on_associate_scalar_property(queryTrackingBehavior); + + AssertSql( + """ +SELECT CAST(JSON_VALUE([r].[RequiredAssociate], '$.Int') AS int) +FROM [RootEntity] AS [r] +"""); + } + + #endregion Structural properties + + #region Structural collection properties + + public override async Task Select_associate_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_associate_collection(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`AssociateCollection` +FROM `RootEntity` AS `r` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nested_collection_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT JSON_QUERY([r].[RequiredAssociate], '$.NestedCollection') +FROM [RootEntity] AS [r] +ORDER BY [r].[Id] +"""); + } + + public override async Task Select_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nested_collection_on_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT JSON_QUERY([r].[OptionalAssociate], '$.NestedCollection') +FROM [RootEntity] AS [r] +ORDER BY [r].[Id] +"""); + } + + public override async Task SelectMany_associate_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_associate_collection(queryTrackingBehavior); + + AssertSql( + """ +SELECT [a].[Id], [a].[Int], [a].[Ints], [a].[Name], [a].[String], [a].[NestedCollection], [a].[OptionalNestedAssociate], [a].[RequiredNestedAssociate] +FROM [RootEntity] AS [r] +CROSS APPLY OPENJSON([r].[AssociateCollection], '$') WITH ( + [Id] int '$.Id', + [Int] int '$.Int', + [Ints] nvarchar(max) '$.Ints' AS JSON, + [Name] nvarchar(max) '$.Name', + [String] nvarchar(max) '$.String', + [NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON, + [OptionalNestedAssociate] nvarchar(max) '$.OptionalNestedAssociate' AS JSON, + [RequiredNestedAssociate] nvarchar(max) '$.RequiredNestedAssociate' AS JSON +) AS [a] +"""); + } + + public override async Task SelectMany_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_nested_collection_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT [n].[Id], [n].[Int], [n].[Ints], [n].[Name], [n].[String] +FROM [RootEntity] AS [r] +CROSS APPLY OPENJSON([r].[RequiredAssociate], '$.NestedCollection') WITH ( + [Id] int '$.Id', + [Int] int '$.Int', + [Ints] nvarchar(max) '$.Ints' AS JSON, + [Name] nvarchar(max) '$.Name', + [String] nvarchar(max) '$.String' +) AS [n] +"""); + } + + public override async Task SelectMany_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_nested_collection_on_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT [n].[Id], [n].[Int], [n].[Ints], [n].[Name], [n].[String] +FROM [RootEntity] AS [r] +CROSS APPLY OPENJSON([r].[OptionalAssociate], '$.NestedCollection') WITH ( + [Id] int '$.Id', + [Int] int '$.Int', + [Ints] nvarchar(max) '$.Ints' AS JSON, + [Name] nvarchar(max) '$.Name', + [String] nvarchar(max) '$.String' +) AS [n] +"""); + } + + #endregion Structural collection properties + + #region Multiple + + public override async Task Select_root_duplicated(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root_duplicated(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` +FROM `RootEntity` AS `r` +"""); + } + + #endregion Multiple + + #region Subquery + + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); + + AssertSql( + """ +SELECT [r1].[c] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) JSON_QUERY([r0].[RequiredAssociate], '$.RequiredNestedAssociate') AS [c] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +"""); + } + + public override async Task Select_subquery_optional_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior); + + AssertSql( + """ +SELECT [r1].[c] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) JSON_QUERY([r0].[OptionalAssociate], '$.RequiredNestedAssociate') AS [c] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +"""); + } + + #endregion Subquery + + #region Value types + + public override async Task Select_root_with_value_types(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root_with_value_types(queryTrackingBehavior); + + AssertSql( + """ +SELECT `v`.`Id`, `v`.`Name`, `v`.`AssociateCollection`, `v`.`OptionalAssociate`, `v`.`RequiredAssociate` +FROM `ValueRootEntity` AS `v` +"""); + } + + public override async Task Select_non_nullable_value_type(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_non_nullable_value_type(queryTrackingBehavior); + + AssertSql( + """ +SELECT `v`.`RequiredAssociate` +FROM `ValueRootEntity` AS `v` +ORDER BY `v`.`Id` +"""); + } + + public override async Task Select_nullable_value_type(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nullable_value_type(queryTrackingBehavior); + + AssertSql( + """ +SELECT `v`.`OptionalAssociate` +FROM `ValueRootEntity` AS `v` +ORDER BY `v`.`Id` +"""); + } + + public override async Task Select_nullable_value_type_with_Value(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nullable_value_type_with_Value(queryTrackingBehavior); + + AssertSql( + """ +SELECT `v`.`OptionalAssociate` +FROM `ValueRootEntity` AS `v` +ORDER BY `v`.`Id` +"""); + } + + #endregion Value types + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonSetOperationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonSetOperationsJetTest.cs new file mode 100644 index 00000000..df4241bf --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonSetOperationsJetTest.cs @@ -0,0 +1,105 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexJson; + +public class ComplexJsonSetOperationsJetTest(ComplexJsonJetFixture fixture, ITestOutputHelper testOutputHelper) + : ComplexJsonSetOperationsRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Over_associate_collections() + { + await base.Over_associate_collections(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE ( + SELECT COUNT(*) + FROM ( + SELECT 1 AS empty + FROM OPENJSON([r].[AssociateCollection], '$') WITH ([Int] int '$.Int') AS [a] + WHERE [a].[Int] = 8 + UNION ALL + SELECT 1 AS empty + FROM OPENJSON([r].[AssociateCollection], '$') WITH ([String] nvarchar(max) '$.String') AS [a0] + WHERE [a0].[String] = N'foo' + ) AS [u]) = 4 +"""); + } + + public override async Task Over_associate_collection_projected(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Over_associate_collection_projected(queryTrackingBehavior); + + AssertSql(); + } + + public override async Task Over_assocate_collection_Select_nested_with_aggregates_projected(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Over_assocate_collection_Select_nested_with_aggregates_projected(queryTrackingBehavior); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(SUM([s].[value]), 0) + FROM ( + SELECT [a].[NestedCollection] AS [NestedCollection] + FROM OPENJSON([r].[AssociateCollection], '$') WITH ( + [Int] int '$.Int', + [NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON + ) AS [a] + WHERE [a].[Int] = 8 + UNION ALL + SELECT [a0].[NestedCollection] AS [NestedCollection] + FROM OPENJSON([r].[AssociateCollection], '$') WITH ( + [String] nvarchar(max) '$.String', + [NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON + ) AS [a0] + WHERE [a0].[String] = N'foo' + ) AS [u] + OUTER APPLY ( + SELECT COALESCE(SUM([n].[Int]), 0) AS [value] + FROM OPENJSON([u].[NestedCollection], '$') WITH ([Int] int '$.Int') AS [n] + ) AS [s]) +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Over_nested_associate_collection() + { + await base.Over_nested_associate_collection(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE ( + SELECT COUNT(*) + FROM ( + SELECT 1 AS empty + FROM OPENJSON([r].[RequiredAssociate], '$.NestedCollection') WITH ([Int] int '$.Int') AS [n] + WHERE [n].[Int] = 8 + UNION ALL + SELECT 1 AS empty + FROM OPENJSON([r].[RequiredAssociate], '$.NestedCollection') WITH ([String] nvarchar(max) '$.String') AS [n0] + WHERE [n0].[String] = N'foo' + ) AS [u]) = 4 +"""); + } + + public override async Task Over_different_collection_properties() + { + await base.Over_different_collection_properties(); + + AssertSql(); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonStructuralEqualityJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonStructuralEqualityJetTest.cs new file mode 100644 index 00000000..053a8fb2 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexJson/ComplexJsonStructuralEqualityJetTest.cs @@ -0,0 +1,284 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.Query.Associations.ComplexJson; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexJson; + +public class ComplexJsonStructuralEqualityJetTest(ComplexJsonJetFixture fixture, ITestOutputHelper testOutputHelper) + : ComplexJsonStructuralEqualityRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Two_associates() + { + await base.Two_associates(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` +FROM `RootEntity` AS `r` +WHERE (`r`.`RequiredAssociate`) = (`r`.`OptionalAssociate`) +"""); + } + + public override async Task Two_nested_associates() + { + await base.Two_nested_associates(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate') = JSON_QUERY([r].[OptionalAssociate], '$.RequiredNestedAssociate') +"""); + } + + public override async Task Not_equals() + { + await base.Not_equals(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` +FROM `RootEntity` AS `r` +WHERE (`r`.`RequiredAssociate`) <> (`r`.`OptionalAssociate`) OR (`r`.`OptionalAssociate`) IS NULL +"""); + } + + public override async Task Associate_with_inline_null() + { + await base.Associate_with_inline_null(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` +FROM `RootEntity` AS `r` +WHERE (`r`.`OptionalAssociate`) IS NULL +"""); + } + + public override async Task Associate_with_parameter_null() + { + await base.Associate_with_parameter_null(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` +FROM `RootEntity` AS `r` +WHERE (`r`.`OptionalAssociate`) IS NULL +"""); + } + + public override async Task Nested_associate_with_inline_null() + { + await base.Nested_associate_with_inline_null(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE JSON_QUERY([r].[RequiredAssociate], '$.OptionalNestedAssociate') IS NULL +"""); + } + + public override async Task Nested_associate_with_inline() + { + await base.Nested_associate_with_inline(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate') = '{"Id":1000,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredAssociate_RequiredNestedAssociate","String":"foo"}' +"""); + } + + public override async Task Nested_associate_with_parameter() + { + await base.Nested_associate_with_parameter(); + + AssertSql( + """ +@entity_equality_nested='{"Id":1000,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredAssociate_RequiredNestedAssociate","String":"foo"}' (Size = 106) + +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate') = @entity_equality_nested +"""); + } + + public override async Task Two_nested_collections() + { + await base.Two_nested_collections(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE JSON_QUERY([r].[RequiredAssociate], '$.NestedCollection') = JSON_QUERY([r].[OptionalAssociate], '$.NestedCollection') +"""); + } + + public override async Task Nested_collection_with_inline() + { + await base.Nested_collection_with_inline(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE JSON_QUERY([r].[RequiredAssociate], '$.NestedCollection') = '[{"Id":1002,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredAssociate_NestedCollection_1","String":"foo"},{"Id":1003,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredAssociate_NestedCollection_2","String":"foo"}]' +"""); + } + + public override async Task Nested_collection_with_parameter() + { + await base.Nested_collection_with_parameter(); + + AssertSql( + """ +@entity_equality_nestedCollection='[{"Id":1002,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredAssociate_NestedCollection_1","String":"foo"},{"Id":1003,"Int":8,"Ints":[1,2,3],"Name":"Root1_RequiredAssociate_NestedCollection_2","String":"foo"}]' (Size = 205) + +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE JSON_QUERY([r].[RequiredAssociate], '$.NestedCollection') = @entity_equality_nestedCollection +"""); + } + + #region Contains + + public override async Task Contains_with_inline() + { + await base.Contains_with_inline(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE EXISTS ( + SELECT 1 + FROM OPENJSON([r].[RequiredAssociate], '$.NestedCollection') WITH ( + [Id] int '$.Id', + [Int] int '$.Int', + [Ints] nvarchar(max) '$.Ints' AS JSON, + [Name] nvarchar(max) '$.Name', + [String] nvarchar(max) '$.String' + ) AS [n] + WHERE [n].[Id] = 1002 AND [n].[Int] = 8 AND [n].[Ints] = N'[1,2,3]' AND [n].[Name] = N'Root1_RequiredAssociate_NestedCollection_1' AND [n].[String] = N'foo') +"""); + } + + public override async Task Contains_with_parameter() + { + await base.Contains_with_parameter(); + + AssertSql( + """ +@entity_equality_nested_Id='1002' (Nullable = true) +@entity_equality_nested_Int='8' (Nullable = true) +@entity_equality_nested_Ints='[1,2,3]' (Size = 4000) +@entity_equality_nested_Name='Root1_RequiredAssociate_NestedCollection_1' (Size = 4000) +@entity_equality_nested_String='foo' (Size = 4000) + +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE EXISTS ( + SELECT 1 + FROM OPENJSON([r].[RequiredAssociate], '$.NestedCollection') WITH ( + [Id] int '$.Id', + [Int] int '$.Int', + [Ints] nvarchar(max) '$.Ints' AS JSON, + [Name] nvarchar(max) '$.Name', + [String] nvarchar(max) '$.String' + ) AS [n] + WHERE [n].[Id] = @entity_equality_nested_Id AND [n].[Int] = @entity_equality_nested_Int AND [n].[Ints] = @entity_equality_nested_Ints AND [n].[Name] = @entity_equality_nested_Name AND [n].[String] = @entity_equality_nested_String) +"""); + } + + public override async Task Contains_with_operators_composed_on_the_collection() + { + await base.Contains_with_operators_composed_on_the_collection(); + + AssertSql( + """ +@get_Item_Int='106' +@entity_equality_get_Item_Id='3003' (Nullable = true) +@entity_equality_get_Item_Int='108' (Nullable = true) +@entity_equality_get_Item_Ints='[8,9,109]' (Size = 4000) +@entity_equality_get_Item_Name='Root3_RequiredAssociate_NestedCollection_2' (Size = 4000) +@entity_equality_get_Item_String='foo104' (Size = 4000) + +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE EXISTS ( + SELECT 1 + FROM OPENJSON([r].[RequiredAssociate], '$.NestedCollection') WITH ( + [Id] int '$.Id', + [Int] int '$.Int', + [Ints] nvarchar(max) '$.Ints' AS JSON, + [Name] nvarchar(max) '$.Name', + [String] nvarchar(max) '$.String' + ) AS [n] + WHERE [n].[Int] > @get_Item_Int AND [n].[Id] = @entity_equality_get_Item_Id AND [n].[Int] = @entity_equality_get_Item_Int AND [n].[Ints] = @entity_equality_get_Item_Ints AND [n].[Name] = @entity_equality_get_Item_Name AND [n].[String] = @entity_equality_get_Item_String) +"""); + } + + public override async Task Contains_with_nested_and_composed_operators() + { + await base.Contains_with_nested_and_composed_operators(); + + AssertSql( + """ +@get_Item_Id='302' +@entity_equality_get_Item_Id='303' (Nullable = true) +@entity_equality_get_Item_Int='130' (Nullable = true) +@entity_equality_get_Item_Ints='[8,9,131]' (Size = 4000) +@entity_equality_get_Item_Name='Root3_AssociateCollection_2' (Size = 4000) +@entity_equality_get_Item_String='foo115' (Size = 4000) +@entity_equality_get_Item_NestedCollection='[{"Id":3014,"Int":136,"Ints":[8,9,137],"Name":"Root3_AssociateCollection_2_NestedCollection_1","String":"foo118"},{"Id":3015,"Int":138,"Ints":[8,9,139],"Name":"Root3_Root1_AssociateCollection_2_NestedCollection_2","String":"foo119"}]' (Size = 233) +@entity_equality_get_Item_OptionalNestedAssociate='{"Id":3013,"Int":134,"Ints":[8,9,135],"Name":"Root3_AssociateCollection_2_OptionalNestedAssociate","String":"foo117"}' (Size = 117) +@entity_equality_get_Item_RequiredNestedAssociate='{"Id":3012,"Int":132,"Ints":[8,9,133],"Name":"Root3_AssociateCollection_2_RequiredNestedAssociate","String":"foo116"}' (Size = 117) + +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE EXISTS ( + SELECT 1 + FROM OPENJSON([r].[AssociateCollection], '$') WITH ( + [Id] int '$.Id', + [Int] int '$.Int', + [Ints] nvarchar(max) '$.Ints' AS JSON, + [Name] nvarchar(max) '$.Name', + [String] nvarchar(max) '$.String', + [NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON, + [OptionalNestedAssociate] nvarchar(max) '$.OptionalNestedAssociate' AS JSON, + [RequiredNestedAssociate] nvarchar(max) '$.RequiredNestedAssociate' AS JSON + ) AS [a] + WHERE [a].[Id] > @get_Item_Id AND [a].[Id] = @entity_equality_get_Item_Id AND [a].[Int] = @entity_equality_get_Item_Int AND [a].[Ints] = @entity_equality_get_Item_Ints AND [a].[Name] = @entity_equality_get_Item_Name AND [a].[String] = @entity_equality_get_Item_String AND [a].[NestedCollection] = @entity_equality_get_Item_NestedCollection AND [a].[OptionalNestedAssociate] = @entity_equality_get_Item_OptionalNestedAssociate AND [a].[RequiredNestedAssociate] = @entity_equality_get_Item_RequiredNestedAssociate) +"""); + } + + #endregion Contains + + #region Value types + + public override async Task Nullable_value_type_with_null() + { + await base.Nullable_value_type_with_null(); + + AssertSql( + """ +SELECT `v`.`Id`, `v`.`Name`, `v`.`AssociateCollection`, `v`.`OptionalAssociate`, `v`.`RequiredAssociate` +FROM `ValueRootEntity` AS `v` +WHERE (`v`.`OptionalAssociate`) IS NULL +"""); + } + + #endregion Value types + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingBulkUpdateJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingBulkUpdateJetTest.cs new file mode 100644 index 00000000..adcff979 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingBulkUpdateJetTest.cs @@ -0,0 +1,528 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.ComplexTableSplitting; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting; + +public class ComplexTableSplittingBulkUpdateJetTest( + ComplexTableSplittingJetFixture fixture, + ITestOutputHelper testOutputHelper) + : ComplexTableSplittingBulkUpdateRelationalTestBase(fixture, testOutputHelper) +{ + #region Delete + + public override async Task Delete_entity_with_associations() + { + await base.Delete_entity_with_associations(); + + AssertSql( + """ +@deletableEntity_Name='Root3_With_different_values' (Size = 255) + +DELETE FROM `RootEntity` AS `r` +WHERE `r`.`Name` = @deletableEntity_Name +"""); + } + + public override async Task Delete_required_associate() + { + await base.Delete_required_associate(); + + AssertSql(); + } + + public override async Task Delete_optional_associate() + { + await base.Delete_optional_associate(); + + AssertSql(); + } + + #endregion Delete + + #region Update properties + + public override async Task Update_property_inside_associate() + { + await base.Update_property_inside_associate(); + + AssertExecuteUpdateSql( + """ +@p='foo_updated' (Size = 255) + +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate_String` = @p +"""); + } + + public override async Task Update_property_inside_associate_with_special_chars() + { + await base.Update_property_inside_associate_with_special_chars(); + + AssertExecuteUpdateSql( + """ +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate_String` = '{ Some other/JSON:like text though it [isn''t]: ממש ממש לאéèéè }' +WHERE `r`.`RequiredAssociate_String` = '{ this may/look:like JSON but it [isn''t]: ממש ממש לאéèéè }' +"""); + } + + public override async Task Update_property_inside_nested_associate() + { + await base.Update_property_inside_nested_associate(); + + AssertExecuteUpdateSql( + """ +@p='foo_updated' (Size = 255) + +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate_RequiredNestedAssociate_String` = @p +"""); + } + + public override async Task Update_property_on_projected_associate() + { + await base.Update_property_on_projected_associate(); + + AssertExecuteUpdateSql( + """ +@p='foo_updated' (Size = 255) + +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate_String` = @p +"""); + } + + public override async Task Update_property_on_projected_associate_with_OrderBy_Skip() + { + await base.Update_property_on_projected_associate_with_OrderBy_Skip(); + + AssertExecuteUpdateSql(); + } + + public override async Task Update_associate_with_null_required_property() + { + await base.Update_associate_with_null_required_property(); + + AssertExecuteUpdateSql(); + } + + #endregion Update properties + + #region Update association + + public override async Task Update_associate_to_parameter() + { + await base.Update_associate_to_parameter(); + + AssertExecuteUpdateSql( + """ +@complex_type_p_Id='1000' (Nullable = true) +@complex_type_p_Int='80' (Nullable = true) +@complex_type_p_Ints='[1,2,3]' (Size = 255) +@complex_type_p_Name='Updated associate name' (Size = 255) +@complex_type_p_String='Updated nested string' (Size = 255) +@complex_type_p_RequiredNestedAssociate_Id='1000' (Nullable = true) +@complex_type_p_RequiredNestedAssociate_Int='80' (Nullable = true) +@complex_type_p_RequiredNestedAssociate_Ints='[1,2,3]' (Size = 255) +@complex_type_p_RequiredNestedAssociate_Name='Updated nested name' (Size = 255) +@complex_type_p_RequiredNestedAssociate_String='Updated nested string' (Size = 255) + +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate_Id` = @complex_type_p_Id, + `r`.`RequiredAssociate_Int` = @complex_type_p_Int, + `r`.`RequiredAssociate_Ints` = @complex_type_p_Ints, + `r`.`RequiredAssociate_Name` = @complex_type_p_Name, + `r`.`RequiredAssociate_String` = @complex_type_p_String, + `r`.`RequiredAssociate_OptionalNestedAssociate_Id` = NULL, + `r`.`RequiredAssociate_OptionalNestedAssociate_Int` = NULL, + `r`.`RequiredAssociate_OptionalNestedAssociate_Ints` = NULL, + `r`.`RequiredAssociate_OptionalNestedAssociate_Name` = NULL, + `r`.`RequiredAssociate_OptionalNestedAssociate_String` = NULL, + `r`.`RequiredAssociate_RequiredNestedAssociate_Id` = @complex_type_p_RequiredNestedAssociate_Id, + `r`.`RequiredAssociate_RequiredNestedAssociate_Int` = @complex_type_p_RequiredNestedAssociate_Int, + `r`.`RequiredAssociate_RequiredNestedAssociate_Ints` = @complex_type_p_RequiredNestedAssociate_Ints, + `r`.`RequiredAssociate_RequiredNestedAssociate_Name` = @complex_type_p_RequiredNestedAssociate_Name, + `r`.`RequiredAssociate_RequiredNestedAssociate_String` = @complex_type_p_RequiredNestedAssociate_String +"""); + } + + public override async Task Update_nested_associate_to_parameter() + { + await base.Update_nested_associate_to_parameter(); + + AssertExecuteUpdateSql( + """ +@complex_type_p_Id='1000' (Nullable = true) +@complex_type_p_Int='80' (Nullable = true) +@complex_type_p_Ints='[1,2,4]' (Size = 255) +@complex_type_p_Name='Updated nested name' (Size = 255) +@complex_type_p_String='Updated nested string' (Size = 255) + +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate_RequiredNestedAssociate_Id` = @complex_type_p_Id, + `r`.`RequiredAssociate_RequiredNestedAssociate_Int` = @complex_type_p_Int, + `r`.`RequiredAssociate_RequiredNestedAssociate_Ints` = @complex_type_p_Ints, + `r`.`RequiredAssociate_RequiredNestedAssociate_Name` = @complex_type_p_Name, + `r`.`RequiredAssociate_RequiredNestedAssociate_String` = @complex_type_p_String +"""); + } + + public override async Task Update_associate_to_another_associate() + { + await base.Update_associate_to_another_associate(); + + AssertExecuteUpdateSql( + """ +UPDATE `RootEntity` AS `r` +SET `r`.`OptionalAssociate_Id` = `r`.`RequiredAssociate_Id`, + `r`.`OptionalAssociate_Int` = `r`.`RequiredAssociate_Int`, + `r`.`OptionalAssociate_Ints` = `r`.`RequiredAssociate_Ints`, + `r`.`OptionalAssociate_Name` = `r`.`RequiredAssociate_Name`, + `r`.`OptionalAssociate_String` = `r`.`RequiredAssociate_String`, + `r`.`OptionalAssociate_OptionalNestedAssociate_Id` = `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, + `r`.`OptionalAssociate_OptionalNestedAssociate_Int` = `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, + `r`.`OptionalAssociate_OptionalNestedAssociate_Ints` = `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, + `r`.`OptionalAssociate_OptionalNestedAssociate_Name` = `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, + `r`.`OptionalAssociate_OptionalNestedAssociate_String` = `r`.`OptionalAssociate_OptionalNestedAssociate_String`, + `r`.`OptionalAssociate_RequiredNestedAssociate_Id` = `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, + `r`.`OptionalAssociate_RequiredNestedAssociate_Int` = `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, + `r`.`OptionalAssociate_RequiredNestedAssociate_Ints` = `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, + `r`.`OptionalAssociate_RequiredNestedAssociate_Name` = `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, + `r`.`OptionalAssociate_RequiredNestedAssociate_String` = `r`.`OptionalAssociate_RequiredNestedAssociate_String` +"""); + } + + public override async Task Update_nested_associate_to_another_nested_associate() + { + await base.Update_nested_associate_to_another_nested_associate(); + + AssertExecuteUpdateSql( + """ +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate_OptionalNestedAssociate_Id` = `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, + `r`.`RequiredAssociate_OptionalNestedAssociate_Int` = `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, + `r`.`RequiredAssociate_OptionalNestedAssociate_Ints` = `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, + `r`.`RequiredAssociate_OptionalNestedAssociate_Name` = `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, + `r`.`RequiredAssociate_OptionalNestedAssociate_String` = `r`.`RequiredAssociate_RequiredNestedAssociate_String` +"""); + } + + public override async Task Update_associate_to_inline() + { + await base.Update_associate_to_inline(); + + AssertExecuteUpdateSql( + """ +@complex_type_p_Id='1000' (Nullable = true) +@complex_type_p_Int='70' (Nullable = true) +@complex_type_p_Ints='[1,2,4]' (Size = 255) +@complex_type_p_Name='Updated associate name' (Size = 255) +@complex_type_p_String='Updated associate string' (Size = 255) +@complex_type_p_RequiredNestedAssociate_Id='1000' (Nullable = true) +@complex_type_p_RequiredNestedAssociate_Int='80' (Nullable = true) +@complex_type_p_RequiredNestedAssociate_Ints='[1,2,4]' (Size = 255) +@complex_type_p_RequiredNestedAssociate_Name='Updated nested name' (Size = 255) +@complex_type_p_RequiredNestedAssociate_String='Updated nested string' (Size = 255) + +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate_Id` = @complex_type_p_Id, + `r`.`RequiredAssociate_Int` = @complex_type_p_Int, + `r`.`RequiredAssociate_Ints` = @complex_type_p_Ints, + `r`.`RequiredAssociate_Name` = @complex_type_p_Name, + `r`.`RequiredAssociate_String` = @complex_type_p_String, + `r`.`RequiredAssociate_OptionalNestedAssociate_Id` = NULL, + `r`.`RequiredAssociate_OptionalNestedAssociate_Int` = NULL, + `r`.`RequiredAssociate_OptionalNestedAssociate_Ints` = NULL, + `r`.`RequiredAssociate_OptionalNestedAssociate_Name` = NULL, + `r`.`RequiredAssociate_OptionalNestedAssociate_String` = NULL, + `r`.`RequiredAssociate_RequiredNestedAssociate_Id` = @complex_type_p_RequiredNestedAssociate_Id, + `r`.`RequiredAssociate_RequiredNestedAssociate_Int` = @complex_type_p_RequiredNestedAssociate_Int, + `r`.`RequiredAssociate_RequiredNestedAssociate_Ints` = @complex_type_p_RequiredNestedAssociate_Ints, + `r`.`RequiredAssociate_RequiredNestedAssociate_Name` = @complex_type_p_RequiredNestedAssociate_Name, + `r`.`RequiredAssociate_RequiredNestedAssociate_String` = @complex_type_p_RequiredNestedAssociate_String +"""); + } + + public override async Task Update_associate_to_inline_with_lambda() + { + await base.Update_associate_to_inline_with_lambda(); + + AssertExecuteUpdateSql( + """ +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate_Id` = 1000, + `r`.`RequiredAssociate_Int` = 70, + `r`.`RequiredAssociate_Ints` = '[1,2,4]', + `r`.`RequiredAssociate_Name` = 'Updated associate name', + `r`.`RequiredAssociate_String` = 'Updated associate string', + `r`.`RequiredAssociate_OptionalNestedAssociate_Id` = NULL, + `r`.`RequiredAssociate_OptionalNestedAssociate_Int` = NULL, + `r`.`RequiredAssociate_OptionalNestedAssociate_Ints` = NULL, + `r`.`RequiredAssociate_OptionalNestedAssociate_Name` = NULL, + `r`.`RequiredAssociate_OptionalNestedAssociate_String` = NULL, + `r`.`RequiredAssociate_RequiredNestedAssociate_Id` = 1000, + `r`.`RequiredAssociate_RequiredNestedAssociate_Int` = 80, + `r`.`RequiredAssociate_RequiredNestedAssociate_Ints` = '[1,2,4]', + `r`.`RequiredAssociate_RequiredNestedAssociate_Name` = 'Updated nested name', + `r`.`RequiredAssociate_RequiredNestedAssociate_String` = 'Updated nested string' +"""); + } + + public override async Task Update_nested_associate_to_inline_with_lambda() + { + await base.Update_nested_associate_to_inline_with_lambda(); + + AssertExecuteUpdateSql( + """ +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate_RequiredNestedAssociate_Id` = 1000, + `r`.`RequiredAssociate_RequiredNestedAssociate_Int` = 80, + `r`.`RequiredAssociate_RequiredNestedAssociate_Ints` = '[1,2,4]', + `r`.`RequiredAssociate_RequiredNestedAssociate_Name` = 'Updated nested name', + `r`.`RequiredAssociate_RequiredNestedAssociate_String` = 'Updated nested string' +"""); + } + + public override async Task Update_associate_to_null() + { + await base.Update_associate_to_null(); + + AssertExecuteUpdateSql( + """ +UPDATE `RootEntity` AS `r` +SET `r`.`OptionalAssociate_Id` = NULL, + `r`.`OptionalAssociate_Int` = NULL, + `r`.`OptionalAssociate_Ints` = NULL, + `r`.`OptionalAssociate_Name` = NULL, + `r`.`OptionalAssociate_String` = NULL, + `r`.`OptionalAssociate_OptionalNestedAssociate_Id` = NULL, + `r`.`OptionalAssociate_OptionalNestedAssociate_Int` = NULL, + `r`.`OptionalAssociate_OptionalNestedAssociate_Ints` = NULL, + `r`.`OptionalAssociate_OptionalNestedAssociate_Name` = NULL, + `r`.`OptionalAssociate_OptionalNestedAssociate_String` = NULL, + `r`.`OptionalAssociate_RequiredNestedAssociate_Id` = NULL, + `r`.`OptionalAssociate_RequiredNestedAssociate_Int` = NULL, + `r`.`OptionalAssociate_RequiredNestedAssociate_Ints` = NULL, + `r`.`OptionalAssociate_RequiredNestedAssociate_Name` = NULL, + `r`.`OptionalAssociate_RequiredNestedAssociate_String` = NULL +"""); + } + + public override async Task Update_associate_to_null_with_lambda() + { + await base.Update_associate_to_null_with_lambda(); + + AssertExecuteUpdateSql( + """ +UPDATE `RootEntity` AS `r` +SET `r`.`OptionalAssociate_Id` = NULL, + `r`.`OptionalAssociate_Int` = NULL, + `r`.`OptionalAssociate_Ints` = NULL, + `r`.`OptionalAssociate_Name` = NULL, + `r`.`OptionalAssociate_String` = NULL, + `r`.`OptionalAssociate_OptionalNestedAssociate_Id` = NULL, + `r`.`OptionalAssociate_OptionalNestedAssociate_Int` = NULL, + `r`.`OptionalAssociate_OptionalNestedAssociate_Ints` = NULL, + `r`.`OptionalAssociate_OptionalNestedAssociate_Name` = NULL, + `r`.`OptionalAssociate_OptionalNestedAssociate_String` = NULL, + `r`.`OptionalAssociate_RequiredNestedAssociate_Id` = NULL, + `r`.`OptionalAssociate_RequiredNestedAssociate_Int` = NULL, + `r`.`OptionalAssociate_RequiredNestedAssociate_Ints` = NULL, + `r`.`OptionalAssociate_RequiredNestedAssociate_Name` = NULL, + `r`.`OptionalAssociate_RequiredNestedAssociate_String` = NULL +"""); + } + + public override async Task Update_associate_to_null_parameter() + { + await base.Update_associate_to_null_parameter(); + + AssertExecuteUpdateSql( + """ +UPDATE `RootEntity` AS `r` +SET `r`.`OptionalAssociate_Id` = NULL, + `r`.`OptionalAssociate_Int` = NULL, + `r`.`OptionalAssociate_Ints` = NULL, + `r`.`OptionalAssociate_Name` = NULL, + `r`.`OptionalAssociate_String` = NULL, + `r`.`OptionalAssociate_OptionalNestedAssociate_Id` = NULL, + `r`.`OptionalAssociate_OptionalNestedAssociate_Int` = NULL, + `r`.`OptionalAssociate_OptionalNestedAssociate_Ints` = NULL, + `r`.`OptionalAssociate_OptionalNestedAssociate_Name` = NULL, + `r`.`OptionalAssociate_OptionalNestedAssociate_String` = NULL, + `r`.`OptionalAssociate_RequiredNestedAssociate_Id` = NULL, + `r`.`OptionalAssociate_RequiredNestedAssociate_Int` = NULL, + `r`.`OptionalAssociate_RequiredNestedAssociate_Ints` = NULL, + `r`.`OptionalAssociate_RequiredNestedAssociate_Name` = NULL, + `r`.`OptionalAssociate_RequiredNestedAssociate_String` = NULL +"""); + } + + public override async Task Update_required_nested_associate_to_null() + { + await base.Update_required_nested_associate_to_null(); + + AssertExecuteUpdateSql(); + } + + #endregion Update association + + #region Update collection + + public override async Task Update_collection_to_parameter() + { + await base.Update_collection_to_parameter(); + + AssertExecuteUpdateSql(); + } + + public override async Task Update_nested_collection_to_parameter() + { + await base.Update_nested_collection_to_parameter(); + + AssertExecuteUpdateSql(); + } + + public override async Task Update_nested_collection_to_inline_with_lambda() + { + await base.Update_nested_collection_to_inline_with_lambda(); + + AssertExecuteUpdateSql(); + } + + public override async Task Update_collection_referencing_the_original_collection() + { + await base.Update_collection_referencing_the_original_collection(); + + AssertExecuteUpdateSql(); + } + + public override async Task Update_nested_collection_to_another_nested_collection() + { + await base.Update_nested_collection_to_another_nested_collection(); + + AssertExecuteUpdateSql(); + } + + public override async Task Update_inside_structural_collection() + { + await base.Update_inside_structural_collection(); + + AssertExecuteUpdateSql(); + } + + #endregion Update collection + + #region Update primitive collection + + public override async Task Update_primitive_collection_to_constant() + { + await base.Update_primitive_collection_to_constant(); + + AssertExecuteUpdateSql( + """ +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate_Ints` = '[1,2,4]' +"""); + } + + public override async Task Update_primitive_collection_to_parameter() + { + await base.Update_primitive_collection_to_parameter(); + + AssertExecuteUpdateSql( + """ +@ints='[1,2,4]' (Size = 255) + +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate_Ints` = @ints +"""); + } + + public override async Task Update_primitive_collection_to_another_collection() + { + await base.Update_primitive_collection_to_another_collection(); + + AssertExecuteUpdateSql( + """ +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate_OptionalNestedAssociate_Ints` = `r`.`RequiredAssociate_RequiredNestedAssociate_Ints` +"""); + } + + public override async Task Update_inside_primitive_collection() + { + await base.Update_inside_primitive_collection(); + + AssertExecuteUpdateSql( + """ +@p='99' + +UPDATE [r] +SET [r].[RequiredAssociate_Ints] = JSON_MODIFY([r].[RequiredAssociate_Ints], '$[1]', @p) +FROM [RootEntity] AS [r] +WHERE ( + SELECT COUNT(*) + FROM OPENJSON([r].[RequiredAssociate_Ints]) AS [r0]) >= 2 +"""); + } + + #endregion Update primitive collection + + #region Multiple updates + + public override async Task Update_multiple_properties_inside_same_associate() + { + await base.Update_multiple_properties_inside_same_associate(); + + AssertExecuteUpdateSql( + """ +@p='foo_updated' (Size = 255) +@p0='20' + +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate_String` = @p, + `r`.`RequiredAssociate_Int` = @p0 +"""); + } + + public override async Task Update_multiple_properties_inside_associates_and_on_entity_type() + { + await base.Update_multiple_properties_inside_associates_and_on_entity_type(); + + AssertExecuteUpdateSql( + """ +@p='foo_updated' (Size = 255) + +UPDATE `RootEntity` AS `r` +SET `r`.`Name` = `r`.`Name` & 'Modified', + `r`.`RequiredAssociate_String` = `r`.`OptionalAssociate_String`, + `r`.`OptionalAssociate_RequiredNestedAssociate_String` = @p +WHERE `r`.`OptionalAssociate_Id` IS NOT NULL +"""); + } + + public override async Task Update_multiple_projected_associates_via_anonymous_type() + { + await base.Update_multiple_projected_associates_via_anonymous_type(); + + AssertExecuteUpdateSql( + """ +@p='foo_updated' (Size = 255) + +UPDATE `RootEntity` AS `r` +SET `r`.`RequiredAssociate_String` = `r`.`OptionalAssociate_String`, + `r`.`OptionalAssociate_String` = @p +WHERE `r`.`OptionalAssociate_Id` IS NOT NULL +"""); + } + + #endregion Multiple updates + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingJetFixture.cs new file mode 100644 index 00000000..2ffa2d21 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingJetFixture.cs @@ -0,0 +1,11 @@ +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore.Query.Associations.ComplexTableSplitting; +using Microsoft.EntityFrameworkCore.TestUtilities; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting; + +public class ComplexTableSplittingJetFixture : ComplexTableSplittingRelationalFixtureBase, ITestSqlLoggerFactory +{ + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingMiscellaneousJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingMiscellaneousJetTest.cs new file mode 100644 index 00000000..3b42f20f --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingMiscellaneousJetTest.cs @@ -0,0 +1,93 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.ComplexTableSplitting; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting; + +public class ComplexTableSplittingMiscellaneousJetTest( + ComplexTableSplittingJetFixture fixture, + ITestOutputHelper testOutputHelper) + : ComplexTableSplittingMiscellaneousRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Where_on_associate_scalar_property() + { + await base.Where_on_associate_scalar_property(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +WHERE `r`.`RequiredAssociate_Int` = 8 +"""); + } + + public override async Task Where_on_optional_associate_scalar_property() + { + await base.Where_on_optional_associate_scalar_property(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +WHERE `r`.`OptionalAssociate_Int` = 8 +"""); + } + + public override async Task Where_on_nested_associate_scalar_property() + { + await base.Where_on_nested_associate_scalar_property(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +WHERE `r`.`RequiredAssociate_RequiredNestedAssociate_Int` = 8 +"""); + } + + #region Value types + + public override async Task Where_property_on_non_nullable_value_type() + { + await base.Where_property_on_non_nullable_value_type(); + + AssertSql( + """ +SELECT `v`.`Id`, `v`.`Name`, `v`.`OptionalAssociate_Id`, `v`.`OptionalAssociate_Int`, `v`.`OptionalAssociate_Name`, `v`.`OptionalAssociate_String`, `v`.`OptionalAssociate_OptionalNested_Id`, `v`.`OptionalAssociate_OptionalNested_Int`, `v`.`OptionalAssociate_OptionalNested_Name`, `v`.`OptionalAssociate_OptionalNested_String`, `v`.`OptionalAssociate_RequiredNested_Id`, `v`.`OptionalAssociate_RequiredNested_Int`, `v`.`OptionalAssociate_RequiredNested_Name`, `v`.`OptionalAssociate_RequiredNested_String`, `v`.`RequiredAssociate_Id`, `v`.`RequiredAssociate_Int`, `v`.`RequiredAssociate_Name`, `v`.`RequiredAssociate_String`, `v`.`RequiredAssociate_OptionalNested_Id`, `v`.`RequiredAssociate_OptionalNested_Int`, `v`.`RequiredAssociate_OptionalNested_Name`, `v`.`RequiredAssociate_OptionalNested_String`, `v`.`RequiredAssociate_RequiredNested_Id`, `v`.`RequiredAssociate_RequiredNested_Int`, `v`.`RequiredAssociate_RequiredNested_Name`, `v`.`RequiredAssociate_RequiredNested_String` +FROM `ValueRootEntity` AS `v` +WHERE `v`.`RequiredAssociate_Int` = 8 +"""); + } + + public override async Task Where_property_on_nullable_value_type_Value() + { + await base.Where_property_on_nullable_value_type_Value(); + + AssertSql( + """ +SELECT `v`.`Id`, `v`.`Name`, `v`.`OptionalAssociate_Id`, `v`.`OptionalAssociate_Int`, `v`.`OptionalAssociate_Name`, `v`.`OptionalAssociate_String`, `v`.`OptionalAssociate_OptionalNested_Id`, `v`.`OptionalAssociate_OptionalNested_Int`, `v`.`OptionalAssociate_OptionalNested_Name`, `v`.`OptionalAssociate_OptionalNested_String`, `v`.`OptionalAssociate_RequiredNested_Id`, `v`.`OptionalAssociate_RequiredNested_Int`, `v`.`OptionalAssociate_RequiredNested_Name`, `v`.`OptionalAssociate_RequiredNested_String`, `v`.`RequiredAssociate_Id`, `v`.`RequiredAssociate_Int`, `v`.`RequiredAssociate_Name`, `v`.`RequiredAssociate_String`, `v`.`RequiredAssociate_OptionalNested_Id`, `v`.`RequiredAssociate_OptionalNested_Int`, `v`.`RequiredAssociate_OptionalNested_Name`, `v`.`RequiredAssociate_OptionalNested_String`, `v`.`RequiredAssociate_RequiredNested_Id`, `v`.`RequiredAssociate_RequiredNested_Int`, `v`.`RequiredAssociate_RequiredNested_Name`, `v`.`RequiredAssociate_RequiredNested_String` +FROM `ValueRootEntity` AS `v` +WHERE `v`.`OptionalAssociate_Int` = 8 +"""); + } + + public override async Task Where_HasValue_on_nullable_value_type() + { + await base.Where_HasValue_on_nullable_value_type(); + + AssertSql( + """ +SELECT `v`.`Id`, `v`.`Name`, `v`.`OptionalAssociate_Id`, `v`.`OptionalAssociate_Int`, `v`.`OptionalAssociate_Name`, `v`.`OptionalAssociate_String`, `v`.`OptionalAssociate_OptionalNested_Id`, `v`.`OptionalAssociate_OptionalNested_Int`, `v`.`OptionalAssociate_OptionalNested_Name`, `v`.`OptionalAssociate_OptionalNested_String`, `v`.`OptionalAssociate_RequiredNested_Id`, `v`.`OptionalAssociate_RequiredNested_Int`, `v`.`OptionalAssociate_RequiredNested_Name`, `v`.`OptionalAssociate_RequiredNested_String`, `v`.`RequiredAssociate_Id`, `v`.`RequiredAssociate_Int`, `v`.`RequiredAssociate_Name`, `v`.`RequiredAssociate_String`, `v`.`RequiredAssociate_OptionalNested_Id`, `v`.`RequiredAssociate_OptionalNested_Int`, `v`.`RequiredAssociate_OptionalNested_Name`, `v`.`RequiredAssociate_OptionalNested_String`, `v`.`RequiredAssociate_RequiredNested_Id`, `v`.`RequiredAssociate_RequiredNested_Int`, `v`.`RequiredAssociate_RequiredNested_Name`, `v`.`RequiredAssociate_RequiredNested_String` +FROM `ValueRootEntity` AS `v` +WHERE `v`.`OptionalAssociate_Id` IS NOT NULL +"""); + } + + #endregion Value types + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingPrimitiveCollectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingPrimitiveCollectionJetTest.cs new file mode 100644 index 00000000..ee3356da --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingPrimitiveCollectionJetTest.cs @@ -0,0 +1,103 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.ComplexTableSplitting; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting; + +public class ComplexTableSplittingPrimitiveCollectionJetTest( + ComplexTableSplittingJetFixture fixture, + ITestOutputHelper testOutputHelper) + : ComplexTableSplittingPrimitiveCollectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Count() + { + await base.Count(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +WHERE ( + SELECT COUNT(*) + FROM OPENJSON([r].[RequiredAssociate_Ints]) AS [r0]) = 3 +"""); + } + + public override async Task Index() + { + await base.Index(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[RequiredAssociate_Ints], '$[0]') AS int) = 1 +"""); + } + + public override async Task Contains() + { + await base.Contains(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +WHERE 3 IN ( + SELECT [r0].[value] + FROM OPENJSON([r].[RequiredAssociate_Ints]) WITH ([value] int '$') AS [r0] +) +"""); + } + + public override async Task Any_predicate() + { + await base.Any_predicate(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +WHERE 2 IN ( + SELECT [r0].[value] + FROM OPENJSON([r].[RequiredAssociate_Ints]) WITH ([value] int '$') AS [r0] +) +"""); + } + + public override async Task Nested_Count() + { + await base.Nested_Count(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +WHERE ( + SELECT COUNT(*) + FROM OPENJSON([r].[RequiredAssociate_RequiredNestedAssociate_Ints]) AS [r0]) = 3 +"""); + } + + public override async Task Select_Sum() + { + await base.Select_Sum(); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(SUM([r1].[value]), 0) + FROM OPENJSON([r].[RequiredAssociate_Ints]) WITH ([value] int '$') AS [r1]) +FROM [RootEntity] AS [r] +WHERE ( + SELECT COALESCE(SUM([r0].[value]), 0) + FROM OPENJSON([r].[RequiredAssociate_Ints]) WITH ([value] int '$') AS [r0]) >= 6 +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionJetTest.cs new file mode 100644 index 00000000..f958980d --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingProjectionJetTest.cs @@ -0,0 +1,348 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Associations.ComplexTableSplitting; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting; + +public class ComplexTableSplittingProjectionJetTest( + ComplexTableSplittingJetFixture fixture, + ITestOutputHelper testOutputHelper) + : ComplexTableSplittingProjectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + + #region Scalar properties + + public override async Task Select_scalar_property_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_scalar_property_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`RequiredAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + + public override async Task Select_property_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_property_on_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`OptionalAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + + public override async Task Select_value_type_property_on_null_associate_throws(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_value_type_property_on_null_associate_throws(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`OptionalAssociate_Int` +FROM `RootEntity` AS `r` +"""); + } + + public override async Task Select_nullable_value_type_property_on_null_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nullable_value_type_property_on_null_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`OptionalAssociate_Int` +FROM `RootEntity` AS `r` +"""); + } + + #endregion Scalar properties + + #region Structural properties + + public override async Task Select_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + + public override async Task Select_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + + public override async Task Select_required_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_nested_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + + public override async Task Select_optional_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_nested_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + + public override async Task Select_required_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_nested_on_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + + public override async Task Select_optional_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_nested_on_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + + public override async Task Select_required_associate_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_associate_via_optional_navigation(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r0`.`RequiredAssociate_Id`, `r0`.`RequiredAssociate_Int`, `r0`.`RequiredAssociate_Ints`, `r0`.`RequiredAssociate_Name`, `r0`.`RequiredAssociate_String`, `r0`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r0`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r0`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r0`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r0`.`RequiredAssociate_OptionalNestedAssociate_String`, `r0`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r0`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r0`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r0`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r0`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootReferencingEntity` AS `r` +LEFT JOIN `RootEntity` AS `r0` ON `r`.`RootEntityId` = `r0`.`Id` +"""); + } + + public override async Task Select_unmapped_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_unmapped_associate_scalar_property(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + + public override async Task Select_untranslatable_method_on_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_untranslatable_method_on_associate_scalar_property(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`RequiredAssociate_Int` +FROM `RootEntity` AS `r` +"""); + } + + #endregion Structural properties + + #region Structural collection properties + + public override async Task Select_associate_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_associate_collection(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + // Note that collections are not supported with table splitting, only JSON; + // the collection selected here is unmapped, and so the test does client evaluation. + await base.Select_nested_collection_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Select_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nested_collection_on_optional_associate(queryTrackingBehavior); + + // Note that collections are not supported with table splitting, only JSON; + // the collection selected here is unmapped, and so the test does client evaluation. + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +ORDER BY `r`.`Id` +"""); + } + + public override async Task SelectMany_associate_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_associate_collection(queryTrackingBehavior); + + AssertSql(); + } + + public override async Task SelectMany_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_nested_collection_on_required_associate(queryTrackingBehavior); + + AssertSql(); + } + + public override async Task SelectMany_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_nested_collection_on_optional_associate(queryTrackingBehavior); + + AssertSql(); + } + + #endregion Structural collection properties + + #region Multiple + + public override async Task Select_root_duplicated(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root_duplicated(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + + #endregion Multiple + + #region Subquery + + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); + + AssertSql( + """ +SELECT [r1].[RequiredAssociate_RequiredNestedAssociate_Id], [r1].[RequiredAssociate_RequiredNestedAssociate_Int], [r1].[RequiredAssociate_RequiredNestedAssociate_Ints], [r1].[RequiredAssociate_RequiredNestedAssociate_Name], [r1].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) [r0].[RequiredAssociate_RequiredNestedAssociate_Id], [r0].[RequiredAssociate_RequiredNestedAssociate_Int], [r0].[RequiredAssociate_RequiredNestedAssociate_Ints], [r0].[RequiredAssociate_RequiredNestedAssociate_Name], [r0].[RequiredAssociate_RequiredNestedAssociate_String] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +"""); + } + + public override async Task Select_subquery_optional_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior); + + AssertSql( + """ +SELECT [r1].[OptionalAssociate_RequiredNestedAssociate_Id], [r1].[OptionalAssociate_RequiredNestedAssociate_Int], [r1].[OptionalAssociate_RequiredNestedAssociate_Ints], [r1].[OptionalAssociate_RequiredNestedAssociate_Name], [r1].[OptionalAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) [r0].[OptionalAssociate_RequiredNestedAssociate_Id], [r0].[OptionalAssociate_RequiredNestedAssociate_Int], [r0].[OptionalAssociate_RequiredNestedAssociate_Ints], [r0].[OptionalAssociate_RequiredNestedAssociate_Name], [r0].[OptionalAssociate_RequiredNestedAssociate_String] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +"""); + } + + #endregion Subquery + + #region Value types + + public override async Task Select_root_with_value_types(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root_with_value_types(queryTrackingBehavior); + + AssertSql( + """ +SELECT `v`.`Id`, `v`.`Name`, `v`.`OptionalAssociate_Id`, `v`.`OptionalAssociate_Int`, `v`.`OptionalAssociate_Name`, `v`.`OptionalAssociate_String`, `v`.`OptionalAssociate_OptionalNested_Id`, `v`.`OptionalAssociate_OptionalNested_Int`, `v`.`OptionalAssociate_OptionalNested_Name`, `v`.`OptionalAssociate_OptionalNested_String`, `v`.`OptionalAssociate_RequiredNested_Id`, `v`.`OptionalAssociate_RequiredNested_Int`, `v`.`OptionalAssociate_RequiredNested_Name`, `v`.`OptionalAssociate_RequiredNested_String`, `v`.`RequiredAssociate_Id`, `v`.`RequiredAssociate_Int`, `v`.`RequiredAssociate_Name`, `v`.`RequiredAssociate_String`, `v`.`RequiredAssociate_OptionalNested_Id`, `v`.`RequiredAssociate_OptionalNested_Int`, `v`.`RequiredAssociate_OptionalNested_Name`, `v`.`RequiredAssociate_OptionalNested_String`, `v`.`RequiredAssociate_RequiredNested_Id`, `v`.`RequiredAssociate_RequiredNested_Int`, `v`.`RequiredAssociate_RequiredNested_Name`, `v`.`RequiredAssociate_RequiredNested_String` +FROM `ValueRootEntity` AS `v` +"""); + } + + public override async Task Select_non_nullable_value_type(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_non_nullable_value_type(queryTrackingBehavior); + + AssertSql( + """ +SELECT `v`.`RequiredAssociate_Id`, `v`.`RequiredAssociate_Int`, `v`.`RequiredAssociate_Name`, `v`.`RequiredAssociate_String`, `v`.`RequiredAssociate_OptionalNested_Id`, `v`.`RequiredAssociate_OptionalNested_Int`, `v`.`RequiredAssociate_OptionalNested_Name`, `v`.`RequiredAssociate_OptionalNested_String`, `v`.`RequiredAssociate_RequiredNested_Id`, `v`.`RequiredAssociate_RequiredNested_Int`, `v`.`RequiredAssociate_RequiredNested_Name`, `v`.`RequiredAssociate_RequiredNested_String` +FROM `ValueRootEntity` AS `v` +ORDER BY `v`.`Id` +"""); + } + + public override async Task Select_nullable_value_type(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nullable_value_type(queryTrackingBehavior); + + AssertSql( + """ +SELECT `v`.`OptionalAssociate_Id`, `v`.`OptionalAssociate_Int`, `v`.`OptionalAssociate_Name`, `v`.`OptionalAssociate_String`, `v`.`OptionalAssociate_OptionalNested_Id`, `v`.`OptionalAssociate_OptionalNested_Int`, `v`.`OptionalAssociate_OptionalNested_Name`, `v`.`OptionalAssociate_OptionalNested_String`, `v`.`OptionalAssociate_RequiredNested_Id`, `v`.`OptionalAssociate_RequiredNested_Int`, `v`.`OptionalAssociate_RequiredNested_Name`, `v`.`OptionalAssociate_RequiredNested_String` +FROM `ValueRootEntity` AS `v` +ORDER BY `v`.`Id` +"""); + } + + public override async Task Select_nullable_value_type_with_Value(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nullable_value_type_with_Value(queryTrackingBehavior); + + AssertSql( + """ +SELECT `v`.`OptionalAssociate_Id`, `v`.`OptionalAssociate_Int`, `v`.`OptionalAssociate_Name`, `v`.`OptionalAssociate_String`, `v`.`OptionalAssociate_OptionalNested_Id`, `v`.`OptionalAssociate_OptionalNested_Int`, `v`.`OptionalAssociate_OptionalNested_Name`, `v`.`OptionalAssociate_OptionalNested_String`, `v`.`OptionalAssociate_RequiredNested_Id`, `v`.`OptionalAssociate_RequiredNested_Int`, `v`.`OptionalAssociate_RequiredNested_Name`, `v`.`OptionalAssociate_RequiredNested_String` +FROM `ValueRootEntity` AS `v` +ORDER BY `v`.`Id` +"""); + } + + #endregion Value types + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingStructuralEqualityJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingStructuralEqualityJetTest.cs new file mode 100644 index 00000000..15314899 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/ComplexTableSplitting/ComplexTableSplittingStructuralEqualityJetTest.cs @@ -0,0 +1,188 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.ComplexTableSplitting; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.ComplexTableSplitting; + +public class ComplexTableSplittingStructuralEqualityJetTest( + ComplexTableSplittingJetFixture fixture, + ITestOutputHelper testOutputHelper) + : ComplexTableSplittingStructuralEqualityRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Two_associates() + { + await base.Two_associates(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +WHERE `r`.`RequiredAssociate_Id` = `r`.`OptionalAssociate_Id` AND `r`.`RequiredAssociate_Int` = `r`.`OptionalAssociate_Int` AND `r`.`RequiredAssociate_Ints` = `r`.`OptionalAssociate_Ints` AND `r`.`RequiredAssociate_Name` = `r`.`OptionalAssociate_Name` AND `r`.`RequiredAssociate_String` = `r`.`OptionalAssociate_String` AND (`r`.`RequiredAssociate_OptionalNestedAssociate_Id` = `r`.`RequiredAssociate_OptionalNestedAssociate_Id` OR `r`.`RequiredAssociate_OptionalNestedAssociate_Id` IS NULL) AND (`r`.`RequiredAssociate_OptionalNestedAssociate_Int` = `r`.`RequiredAssociate_OptionalNestedAssociate_Int` OR `r`.`RequiredAssociate_OptionalNestedAssociate_Int` IS NULL) AND (`r`.`RequiredAssociate_OptionalNestedAssociate_Ints` = `r`.`RequiredAssociate_OptionalNestedAssociate_Ints` OR `r`.`RequiredAssociate_OptionalNestedAssociate_Ints` IS NULL) AND (`r`.`RequiredAssociate_OptionalNestedAssociate_Name` = `r`.`RequiredAssociate_OptionalNestedAssociate_Name` OR `r`.`RequiredAssociate_OptionalNestedAssociate_Name` IS NULL) AND (`r`.`RequiredAssociate_OptionalNestedAssociate_String` = `r`.`RequiredAssociate_OptionalNestedAssociate_String` OR `r`.`RequiredAssociate_OptionalNestedAssociate_String` IS NULL) AND `r`.`RequiredAssociate_RequiredNestedAssociate_Id` = `r`.`RequiredAssociate_RequiredNestedAssociate_Id` AND `r`.`RequiredAssociate_RequiredNestedAssociate_Int` = `r`.`RequiredAssociate_RequiredNestedAssociate_Int` AND `r`.`RequiredAssociate_RequiredNestedAssociate_Ints` = `r`.`RequiredAssociate_RequiredNestedAssociate_Ints` AND `r`.`RequiredAssociate_RequiredNestedAssociate_Name` = `r`.`RequiredAssociate_RequiredNestedAssociate_Name` AND `r`.`RequiredAssociate_RequiredNestedAssociate_String` = `r`.`RequiredAssociate_RequiredNestedAssociate_String` +"""); + } + + public override async Task Two_nested_associates() + { + await base.Two_nested_associates(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +WHERE `r`.`RequiredAssociate_RequiredNestedAssociate_Id` = `r`.`OptionalAssociate_RequiredNestedAssociate_Id` AND `r`.`RequiredAssociate_RequiredNestedAssociate_Int` = `r`.`OptionalAssociate_RequiredNestedAssociate_Int` AND `r`.`RequiredAssociate_RequiredNestedAssociate_Ints` = `r`.`OptionalAssociate_RequiredNestedAssociate_Ints` AND `r`.`RequiredAssociate_RequiredNestedAssociate_Name` = `r`.`OptionalAssociate_RequiredNestedAssociate_Name` AND `r`.`RequiredAssociate_RequiredNestedAssociate_String` = `r`.`OptionalAssociate_RequiredNestedAssociate_String` +"""); + } + + public override async Task Not_equals() + { + await base.Not_equals(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +WHERE `r`.`RequiredAssociate_Id` <> `r`.`OptionalAssociate_Id` OR `r`.`OptionalAssociate_Id` IS NULL OR `r`.`RequiredAssociate_Int` <> `r`.`OptionalAssociate_Int` OR `r`.`OptionalAssociate_Int` IS NULL OR `r`.`RequiredAssociate_Ints` <> `r`.`OptionalAssociate_Ints` OR `r`.`OptionalAssociate_Ints` IS NULL OR `r`.`RequiredAssociate_Name` <> `r`.`OptionalAssociate_Name` OR `r`.`OptionalAssociate_Name` IS NULL OR `r`.`RequiredAssociate_String` <> `r`.`OptionalAssociate_String` OR `r`.`OptionalAssociate_String` IS NULL OR ((`r`.`RequiredAssociate_OptionalNestedAssociate_Id` <> `r`.`RequiredAssociate_OptionalNestedAssociate_Id` OR `r`.`RequiredAssociate_OptionalNestedAssociate_Id` IS NULL) AND `r`.`RequiredAssociate_OptionalNestedAssociate_Id` IS NOT NULL) OR ((`r`.`RequiredAssociate_OptionalNestedAssociate_Int` <> `r`.`RequiredAssociate_OptionalNestedAssociate_Int` OR `r`.`RequiredAssociate_OptionalNestedAssociate_Int` IS NULL) AND `r`.`RequiredAssociate_OptionalNestedAssociate_Int` IS NOT NULL) OR ((`r`.`RequiredAssociate_OptionalNestedAssociate_Ints` <> `r`.`RequiredAssociate_OptionalNestedAssociate_Ints` OR `r`.`RequiredAssociate_OptionalNestedAssociate_Ints` IS NULL) AND `r`.`RequiredAssociate_OptionalNestedAssociate_Ints` IS NOT NULL) OR ((`r`.`RequiredAssociate_OptionalNestedAssociate_Name` <> `r`.`RequiredAssociate_OptionalNestedAssociate_Name` OR `r`.`RequiredAssociate_OptionalNestedAssociate_Name` IS NULL) AND `r`.`RequiredAssociate_OptionalNestedAssociate_Name` IS NOT NULL) OR ((`r`.`RequiredAssociate_OptionalNestedAssociate_String` <> `r`.`RequiredAssociate_OptionalNestedAssociate_String` OR `r`.`RequiredAssociate_OptionalNestedAssociate_String` IS NULL) AND `r`.`RequiredAssociate_OptionalNestedAssociate_String` IS NOT NULL) OR `r`.`RequiredAssociate_RequiredNestedAssociate_Id` <> `r`.`RequiredAssociate_RequiredNestedAssociate_Id` OR `r`.`RequiredAssociate_RequiredNestedAssociate_Id` IS NULL OR `r`.`RequiredAssociate_RequiredNestedAssociate_Int` <> `r`.`RequiredAssociate_RequiredNestedAssociate_Int` OR `r`.`RequiredAssociate_RequiredNestedAssociate_Int` IS NULL OR `r`.`RequiredAssociate_RequiredNestedAssociate_Ints` <> `r`.`RequiredAssociate_RequiredNestedAssociate_Ints` OR `r`.`RequiredAssociate_RequiredNestedAssociate_Ints` IS NULL OR `r`.`RequiredAssociate_RequiredNestedAssociate_Name` <> `r`.`RequiredAssociate_RequiredNestedAssociate_Name` OR `r`.`RequiredAssociate_RequiredNestedAssociate_Name` IS NULL OR `r`.`RequiredAssociate_RequiredNestedAssociate_String` <> `r`.`RequiredAssociate_RequiredNestedAssociate_String` OR `r`.`RequiredAssociate_RequiredNestedAssociate_String` IS NULL +"""); + } + + public override async Task Associate_with_inline_null() + { + await base.Associate_with_inline_null(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +WHERE `r`.`OptionalAssociate_Id` IS NULL +"""); + } + + public override async Task Associate_with_parameter_null() + { + await base.Associate_with_parameter_null(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +WHERE `r`.`OptionalAssociate_Id` IS NULL AND `r`.`OptionalAssociate_Int` IS NULL AND `r`.`OptionalAssociate_Ints` IS NULL AND `r`.`OptionalAssociate_Name` IS NULL AND `r`.`OptionalAssociate_String` IS NULL AND `r`.`OptionalAssociate_OptionalNestedAssociate_Id` IS NULL AND `r`.`OptionalAssociate_OptionalNestedAssociate_Int` IS NULL AND `r`.`OptionalAssociate_OptionalNestedAssociate_Ints` IS NULL AND `r`.`OptionalAssociate_OptionalNestedAssociate_Name` IS NULL AND `r`.`OptionalAssociate_OptionalNestedAssociate_String` IS NULL AND `r`.`OptionalAssociate_RequiredNestedAssociate_Id` IS NULL AND `r`.`OptionalAssociate_RequiredNestedAssociate_Int` IS NULL AND `r`.`OptionalAssociate_RequiredNestedAssociate_Ints` IS NULL AND `r`.`OptionalAssociate_RequiredNestedAssociate_Name` IS NULL AND `r`.`OptionalAssociate_RequiredNestedAssociate_String` IS NULL +"""); + } + + public override async Task Nested_associate_with_inline_null() + { + await base.Nested_associate_with_inline_null(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +WHERE `r`.`RequiredAssociate_OptionalNestedAssociate_Id` IS NULL +"""); + } + + public override async Task Nested_associate_with_inline() + { + await base.Nested_associate_with_inline(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +WHERE `r`.`RequiredAssociate_RequiredNestedAssociate_Id` = 1000 AND `r`.`RequiredAssociate_RequiredNestedAssociate_Int` = 8 AND `r`.`RequiredAssociate_RequiredNestedAssociate_Ints` = '[1,2,3]' AND `r`.`RequiredAssociate_RequiredNestedAssociate_Name` = 'Root1_RequiredAssociate_RequiredNestedAssociate' AND `r`.`RequiredAssociate_RequiredNestedAssociate_String` = 'foo' +"""); + } + + public override async Task Nested_associate_with_parameter() + { + await base.Nested_associate_with_parameter(); + + AssertSql( + """ +@entity_equality_nested_Id='1000' (Nullable = true) +@entity_equality_nested_Int='8' (Nullable = true) +@entity_equality_nested_Ints='[1,2,3]' (Size = 255) +@entity_equality_nested_Name='Root1_RequiredAssociate_RequiredNestedAssociate' (Size = 255) +@entity_equality_nested_String='foo' (Size = 255) + +SELECT `r`.`Id`, `r`.`Name`, `r`.`OptionalAssociate_Id`, `r`.`OptionalAssociate_Int`, `r`.`OptionalAssociate_Ints`, `r`.`OptionalAssociate_Name`, `r`.`OptionalAssociate_String`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +WHERE `r`.`RequiredAssociate_RequiredNestedAssociate_Id` = @entity_equality_nested_Id AND `r`.`RequiredAssociate_RequiredNestedAssociate_Int` = @entity_equality_nested_Int AND `r`.`RequiredAssociate_RequiredNestedAssociate_Ints` = @entity_equality_nested_Ints AND `r`.`RequiredAssociate_RequiredNestedAssociate_Name` = @entity_equality_nested_Name AND `r`.`RequiredAssociate_RequiredNestedAssociate_String` = @entity_equality_nested_String +"""); + } + + public override async Task Two_nested_collections() + { + await base.Two_nested_collections(); + + AssertSql(); + } + + public override async Task Nested_collection_with_inline() + { + await base.Nested_collection_with_inline(); + + AssertSql(); + } + + public override async Task Nested_collection_with_parameter() + { + await base.Nested_collection_with_parameter(); + + AssertSql(); + } + + #region Contains + + public override async Task Contains_with_inline() + { + await base.Contains_with_inline(); + + AssertSql(); + } + + public override async Task Contains_with_parameter() + { + await base.Contains_with_parameter(); + + AssertSql(); + } + + public override async Task Contains_with_operators_composed_on_the_collection() + { + await base.Contains_with_operators_composed_on_the_collection(); + + AssertSql(); + } + + public override async Task Contains_with_nested_and_composed_operators() + { + await base.Contains_with_nested_and_composed_operators(); + + AssertSql(); + } + + #endregion Contains + + #region Value types + + public override async Task Nullable_value_type_with_null() + { + await base.Nullable_value_type_with_null(); + + AssertSql( + """ +SELECT `v`.`Id`, `v`.`Name`, `v`.`OptionalAssociate_Id`, `v`.`OptionalAssociate_Int`, `v`.`OptionalAssociate_Name`, `v`.`OptionalAssociate_String`, `v`.`OptionalAssociate_OptionalNested_Id`, `v`.`OptionalAssociate_OptionalNested_Int`, `v`.`OptionalAssociate_OptionalNested_Name`, `v`.`OptionalAssociate_OptionalNested_String`, `v`.`OptionalAssociate_RequiredNested_Id`, `v`.`OptionalAssociate_RequiredNested_Int`, `v`.`OptionalAssociate_RequiredNested_Name`, `v`.`OptionalAssociate_RequiredNested_String`, `v`.`RequiredAssociate_Id`, `v`.`RequiredAssociate_Int`, `v`.`RequiredAssociate_Name`, `v`.`RequiredAssociate_String`, `v`.`RequiredAssociate_OptionalNested_Id`, `v`.`RequiredAssociate_OptionalNested_Int`, `v`.`RequiredAssociate_OptionalNested_Name`, `v`.`RequiredAssociate_OptionalNested_String`, `v`.`RequiredAssociate_RequiredNested_Id`, `v`.`RequiredAssociate_RequiredNested_Int`, `v`.`RequiredAssociate_RequiredNested_Name`, `v`.`RequiredAssociate_RequiredNested_String` +FROM `ValueRootEntity` AS `v` +WHERE `v`.`OptionalAssociate_Id` IS NULL +"""); + } + + #endregion Value types + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionJetTest.cs new file mode 100644 index 00000000..ffe1ca72 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionJetTest.cs @@ -0,0 +1,276 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Associations.Navigations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations; + +public class NavigationsCollectionJetTest(NavigationsJetFixture fixture, ITestOutputHelper testOutputHelper) + : NavigationsCollectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Count() + { + await base.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` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `AssociateType` AS `a0` ON `r`.`OptionalAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n` ON `a0`.`OptionalNestedAssociateId` = `n`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n0` ON `a0`.`RequiredNestedAssociateId` = `n0`.`Id`) +INNER JOIN `AssociateType` AS `a1` ON `r`.`RequiredAssociateId` = `a1`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a1`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a2` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a2`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a2`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a2`.`Id` = `n5`.`CollectionAssociateId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId`) +LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) +LEFT JOIN `NestedAssociateType` AS `n7` ON `a1`.`Id` = `n7`.`CollectionAssociateId` +WHERE (( + SELECT COUNT(*) + FROM `AssociateType` AS `a` + WHERE `r`.`Id` = `a`.`CollectionRootId`) = 2) AND (`a1`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) +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` +"""); + } + + public override async Task Where() + { + await base.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` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `AssociateType` AS `a0` ON `r`.`OptionalAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n` ON `a0`.`OptionalNestedAssociateId` = `n`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n0` ON `a0`.`RequiredNestedAssociateId` = `n0`.`Id`) +INNER JOIN `AssociateType` AS `a1` ON `r`.`RequiredAssociateId` = `a1`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a1`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a2` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a2`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a2`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a2`.`Id` = `n5`.`CollectionAssociateId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId`) +LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) +LEFT JOIN `NestedAssociateType` AS `n7` ON `a1`.`Id` = `n7`.`CollectionAssociateId` +WHERE (( + SELECT COUNT(*) + FROM `AssociateType` AS `a` + WHERE `r`.`Id` = `a`.`CollectionRootId` AND `a`.`Int` <> 8) = 2) AND (`a1`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) +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` +"""); + } + + public override async Task OrderBy_ElementAt() + { + await base.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] +FROM [RootEntity] AS [r] +LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] +LEFT JOIN [NestedAssociateType] AS [n] ON [a0].[OptionalNestedAssociateId] = [n].[Id] +LEFT JOIN [NestedAssociateType] AS [n0] ON [a0].[RequiredNestedAssociateId] = [n0].[Id] +INNER JOIN [AssociateType] AS [a1] ON [r].[RequiredAssociateId] = [a1].[Id] +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] + FROM [AssociateType] AS [a2] + LEFT JOIN [NestedAssociateType] AS [n3] ON [a2].[OptionalNestedAssociateId] = [n3].[Id] + INNER JOIN [NestedAssociateType] AS [n4] ON [a2].[RequiredNestedAssociateId] = [n4].[Id] + LEFT JOIN [NestedAssociateType] AS [n5] ON [a2].[Id] = [n5].[CollectionAssociateId] +) AS [s] ON [r].[Id] = [s].[CollectionRootId] +LEFT JOIN [NestedAssociateType] AS [n6] ON [a0].[Id] = [n6].[CollectionAssociateId] +LEFT JOIN [NestedAssociateType] AS [n7] ON [a1].[Id] = [n7].[CollectionAssociateId] +WHERE ( + SELECT [a].[Int] + 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] +"""); + } + + #region Distinct + + public override async Task Distinct() + { + await base.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] +FROM [RootEntity] AS [r] +LEFT JOIN [AssociateType] AS [a1] ON [r].[OptionalAssociateId] = [a1].[Id] +LEFT JOIN [NestedAssociateType] AS [n] ON [a1].[OptionalNestedAssociateId] = [n].[Id] +LEFT JOIN [NestedAssociateType] AS [n0] ON [a1].[RequiredNestedAssociateId] = [n0].[Id] +INNER JOIN [AssociateType] AS [a2] ON [r].[RequiredAssociateId] = [a2].[Id] +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] + FROM [AssociateType] AS [a3] + LEFT JOIN [NestedAssociateType] AS [n3] ON [a3].[OptionalNestedAssociateId] = [n3].[Id] + INNER JOIN [NestedAssociateType] AS [n4] ON [a3].[RequiredNestedAssociateId] = [n4].[Id] + LEFT JOIN [NestedAssociateType] AS [n5] ON [a3].[Id] = [n5].[CollectionAssociateId] +) AS [s] ON [r].[Id] = [s].[CollectionRootId] +LEFT JOIN [NestedAssociateType] AS [n6] ON [a1].[Id] = [n6].[CollectionAssociateId] +LEFT JOIN [NestedAssociateType] AS [n7] ON [a2].[Id] = [n7].[CollectionAssociateId] +WHERE ( + SELECT COUNT(*) + FROM ( + SELECT DISTINCT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String] + 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] +"""); + } + + public override async Task Distinct_projected(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Distinct_projected(queryTrackingBehavior); + + 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] +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] + FROM ( + SELECT DISTINCT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String] + FROM [AssociateType] AS [a] + WHERE [r].[Id] = [a].[CollectionRootId] + ) AS [a0] + LEFT JOIN [NestedAssociateType] AS [n] ON [a0].[OptionalNestedAssociateId] = [n].[Id] + 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] +"""); + } + + public override async Task Distinct_over_projected_nested_collection() + { + await base.Distinct_over_projected_nested_collection(); + + AssertSql(); + } + + public override async Task Distinct_over_projected_filtered_nested_collection() + { + await base.Distinct_over_projected_filtered_nested_collection(); + + AssertSql(); + } + + #endregion Distinct + + #region Index + + public override async Task Index_constant() + { + await base.Index_constant(); + + AssertSql(); + } + + public override async Task Index_parameter() + { + await base.Index_parameter(); + + AssertSql(); + } + + public override async Task Index_column() + { + await base.Index_column(); + + AssertSql(); + } + + public override async Task Index_out_of_bounds() + { + await base.Index_out_of_bounds(); + + AssertSql(); + } + + #endregion Index + + #region GroupBy + + [ConditionalFact] + public override async Task GroupBy() + { + await base.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` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `AssociateType` AS `a0` ON `r`.`OptionalAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n` ON `a0`.`OptionalNestedAssociateId` = `n`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n0` ON `a0`.`RequiredNestedAssociateId` = `n0`.`Id`) +INNER JOIN `AssociateType` AS `a1` ON `r`.`RequiredAssociateId` = `a1`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a1`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a2` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a2`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a2`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a2`.`Id` = `n5`.`CollectionAssociateId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId`) +LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) +LEFT JOIN `NestedAssociateType` AS `n7` ON `a1`.`Id` = `n7`.`CollectionAssociateId` +WHERE (16 IN ( + SELECT IIF(SUM(`a`.`Int`) IS NULL, 0, SUM(`a`.`Int`)) + FROM `AssociateType` AS `a` + WHERE `r`.`Id` = `a`.`CollectionRootId` + GROUP BY `a`.`String` +)) AND (`a1`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) +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` +"""); + } + + #endregion GroupBy + + public override async Task Select_within_Select_within_Select_with_aggregates() + { + await base.Select_within_Select_within_Select_with_aggregates(); + + AssertSql( + """ +SELECT ( + SELECT IIF(SUM(( + SELECT MAX(`n`.`Int`) + FROM `NestedAssociateType` AS `n` + WHERE `a`.`Id` = `n`.`CollectionAssociateId`)) IS NULL, 0, SUM(( + SELECT MAX(`n`.`Int`) + FROM `NestedAssociateType` AS `n` + WHERE `a`.`Id` = `n`.`CollectionAssociateId`))) + FROM `AssociateType` AS `a` + WHERE `r`.`Id` = `a`.`CollectionRootId`) +FROM `RootEntity` AS `r` +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeJetTest.cs new file mode 100644 index 00000000..adee1fa7 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeJetTest.cs @@ -0,0 +1,267 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.Navigations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations; + +public class NavigationsIncludeJetTest(NavigationsJetFixture fixture, ITestOutputHelper testOutputHelper) + : NavigationsIncludeRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Include_required(bool async) + { + await base.Include_required(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` +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`) +INNER JOIN `AssociateType` AS `a0` ON `r`.`RequiredAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) 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` +WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + public override async Task Include_optional(bool async) + { + await base.Include_optional(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` +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`) +INNER JOIN `AssociateType` AS `a0` ON `r`.`RequiredAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) 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` +WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + public override async Task Include_collection(bool async) + { + await base.Include_collection(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` +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`) +INNER JOIN `AssociateType` AS `a0` ON `r`.`RequiredAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) 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` +WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + public override async Task Include_required_optional_and_collection(bool async) + { + await base.Include_required_optional_and_collection(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` +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`) +INNER JOIN `AssociateType` AS `a0` ON `r`.`RequiredAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) 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` +WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + public override async Task Include_nested(bool async) + { + await base.Include_nested(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` +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`) +INNER JOIN `AssociateType` AS `a0` ON `r`.`RequiredAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) 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` +WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + public override async Task Include_nested_optional(bool async) + { + await base.Include_nested_optional(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` +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`) +INNER JOIN `AssociateType` AS `a0` ON `r`.`RequiredAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) 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` +WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + public override async Task Include_nested_collection(bool async) + { + await base.Include_nested_collection(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` +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`) +INNER JOIN `AssociateType` AS `a0` ON `r`.`RequiredAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) 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` +WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + public override async Task Include_nested_collection_on_optional(bool async) + { + await base.Include_nested_collection_on_optional(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` +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`) +INNER JOIN `AssociateType` AS `a0` ON `r`.`RequiredAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) 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` +WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + public override async Task Include_nested_collection_on_collection(bool async) + { + await base.Include_nested_collection_on_collection(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` +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`) +INNER JOIN `AssociateType` AS `a0` ON `r`.`RequiredAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) 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` +WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsJetFixture.cs new file mode 100644 index 00000000..8d17f6ea --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsJetFixture.cs @@ -0,0 +1,11 @@ +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore.Query.Associations.Navigations; +using Microsoft.EntityFrameworkCore.TestUtilities; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations; + +public class NavigationsJetFixture : NavigationsRelationalFixtureBase +{ + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousJetTest.cs new file mode 100644 index 00000000..cb2a6a58 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousJetTest.cs @@ -0,0 +1,105 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.Navigations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations; + +public class NavigationsMiscellaneousJetTest( + NavigationsJetFixture fixture, + ITestOutputHelper testOutputHelper) + : NavigationsMiscellaneousRelationalTestBase(fixture, testOutputHelper) +{ + #region Simple filters + + public override async Task Where_on_associate_scalar_property() + { + await base.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` +FROM ((((((((`RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id`) +LEFT JOIN `AssociateType` AS `a0` ON `r`.`OptionalAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n` ON `a0`.`OptionalNestedAssociateId` = `n`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n0` ON `a0`.`RequiredNestedAssociateId` = `n0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId`) +LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) +LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` +WHERE (`a`.`Int` = 8) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + public override async Task Where_on_optional_associate_scalar_property() + { + await base.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` +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`) +INNER JOIN `AssociateType` AS `a0` ON `r`.`RequiredAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) 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` +WHERE (`a`.`Int` = 8) AND (`a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + public override async Task Where_on_nested_associate_scalar_property() + { + await base.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` +FROM ((((((((`RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`RequiredNestedAssociateId` = `n`.`Id`) +LEFT JOIN `AssociateType` AS `a0` ON `r`.`OptionalAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n0` ON `a0`.`OptionalNestedAssociateId` = `n0`.`Id`) +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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId`) +LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) +LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` +WHERE (`n`.`Int` = 8) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n`.`Id` IS NOT 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` +"""); + } + + #endregion Simple filters + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsPrimitiveCollectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsPrimitiveCollectionJetTest.cs new file mode 100644 index 00000000..cb88b54e --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsPrimitiveCollectionJetTest.cs @@ -0,0 +1,182 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.Navigations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations; + +public class NavigationsPrimitiveCollectionJetTest(NavigationsJetFixture fixture, ITestOutputHelper testOutputHelper) + : NavigationsPrimitiveCollectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Count() + { + await base.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] +FROM [RootEntity] AS [r] +INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] +LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] +LEFT JOIN [NestedAssociateType] AS [n] ON [a0].[OptionalNestedAssociateId] = [n].[Id] +LEFT JOIN [NestedAssociateType] AS [n0] ON [a0].[RequiredNestedAssociateId] = [n0].[Id] +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] + FROM [AssociateType] AS [a1] + LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] + INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] + LEFT JOIN [NestedAssociateType] AS [n5] ON [a1].[Id] = [n5].[CollectionAssociateId] +) AS [s] ON [r].[Id] = [s].[CollectionRootId] +LEFT JOIN [NestedAssociateType] AS [n6] ON [a0].[Id] = [n6].[CollectionAssociateId] +LEFT JOIN [NestedAssociateType] AS [n7] ON [a].[Id] = [n7].[CollectionAssociateId] +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] +"""); + } + + public override async Task Index() + { + await base.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] +FROM [RootEntity] AS [r] +INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] +LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] +LEFT JOIN [NestedAssociateType] AS [n] ON [a0].[OptionalNestedAssociateId] = [n].[Id] +LEFT JOIN [NestedAssociateType] AS [n0] ON [a0].[RequiredNestedAssociateId] = [n0].[Id] +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] + FROM [AssociateType] AS [a1] + LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] + INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] + LEFT JOIN [NestedAssociateType] AS [n5] ON [a1].[Id] = [n5].[CollectionAssociateId] +) AS [s] ON [r].[Id] = [s].[CollectionRootId] +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] +"""); + } + + public override async Task Contains() + { + await base.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] +FROM [RootEntity] AS [r] +INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] +LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] +LEFT JOIN [NestedAssociateType] AS [n] ON [a0].[OptionalNestedAssociateId] = [n].[Id] +LEFT JOIN [NestedAssociateType] AS [n0] ON [a0].[RequiredNestedAssociateId] = [n0].[Id] +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] + FROM [AssociateType] AS [a1] + LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] + INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] + LEFT JOIN [NestedAssociateType] AS [n5] ON [a1].[Id] = [n5].[CollectionAssociateId] +) AS [s] ON [r].[Id] = [s].[CollectionRootId] +LEFT JOIN [NestedAssociateType] AS [n6] ON [a0].[Id] = [n6].[CollectionAssociateId] +LEFT JOIN [NestedAssociateType] AS [n7] ON [a].[Id] = [n7].[CollectionAssociateId] +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] +"""); + } + + public override async Task Any_predicate() + { + await base.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] +FROM [RootEntity] AS [r] +INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] +LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] +LEFT JOIN [NestedAssociateType] AS [n] ON [a0].[OptionalNestedAssociateId] = [n].[Id] +LEFT JOIN [NestedAssociateType] AS [n0] ON [a0].[RequiredNestedAssociateId] = [n0].[Id] +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] + FROM [AssociateType] AS [a1] + LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] + INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] + LEFT JOIN [NestedAssociateType] AS [n5] ON [a1].[Id] = [n5].[CollectionAssociateId] +) AS [s] ON [r].[Id] = [s].[CollectionRootId] +LEFT JOIN [NestedAssociateType] AS [n6] ON [a0].[Id] = [n6].[CollectionAssociateId] +LEFT JOIN [NestedAssociateType] AS [n7] ON [a].[Id] = [n7].[CollectionAssociateId] +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] +"""); + } + + public override async Task Nested_Count() + { + await base.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] +FROM [RootEntity] AS [r] +INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] +INNER JOIN [NestedAssociateType] AS [n] ON [a].[RequiredNestedAssociateId] = [n].[Id] +LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] +LEFT JOIN [NestedAssociateType] AS [n0] ON [a0].[OptionalNestedAssociateId] = [n0].[Id] +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] + FROM [AssociateType] AS [a1] + LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] + INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] + LEFT JOIN [NestedAssociateType] AS [n5] ON [a1].[Id] = [n5].[CollectionAssociateId] +) AS [s] ON [r].[Id] = [s].[CollectionRootId] +LEFT JOIN [NestedAssociateType] AS [n6] ON [a0].[Id] = [n6].[CollectionAssociateId] +LEFT JOIN [NestedAssociateType] AS [n7] ON [a].[Id] = [n7].[CollectionAssociateId] +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] +"""); + } + + public override async Task Select_Sum() + { + await base.Select_Sum(); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(SUM([i0].[value]), 0) + FROM OPENJSON([a].[Ints]) WITH ([value] int '$') AS [i0]) +FROM [RootEntity] AS [r] +INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] +WHERE ( + SELECT COALESCE(SUM([i].[value]), 0) + FROM OPENJSON([a].[Ints]) WITH ([value] int '$') AS [i]) >= 6 +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionJetTest.cs new file mode 100644 index 00000000..f79cbed0 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionJetTest.cs @@ -0,0 +1,409 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Associations.Navigations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations; + +public class NavigationsProjectionJetTest(NavigationsJetFixture fixture, ITestOutputHelper testOutputHelper) + : NavigationsProjectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root(queryTrackingBehavior); + + 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` +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`) +INNER JOIN `AssociateType` AS `a0` ON `r`.`RequiredAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) 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` +WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + #region Scalar properties + + public override async Task Select_scalar_property_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_scalar_property_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `a`.`String` +FROM `RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id` +"""); + } + + public override async Task Select_property_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_property_on_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `a`.`String` +FROM `RootEntity` AS `r` +LEFT JOIN `AssociateType` AS `a` ON `r`.`OptionalAssociateId` = `a`.`Id` +"""); + } + + public override async Task Select_value_type_property_on_null_associate_throws(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_value_type_property_on_null_associate_throws(queryTrackingBehavior); + + AssertSql( + """ +SELECT `a`.`Int` +FROM `RootEntity` AS `r` +LEFT JOIN `AssociateType` AS `a` ON `r`.`OptionalAssociateId` = `a`.`Id` +"""); + } + + public override async Task Select_nullable_value_type_property_on_null_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nullable_value_type_property_on_null_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `a`.`Int` +FROM `RootEntity` AS `r` +LEFT JOIN `AssociateType` AS `a` ON `r`.`OptionalAssociateId` = `a`.`Id` +"""); + } + + #endregion Scalar properties + + #region Structural properties + + public override async Task Select_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_associate(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` +FROM (((`RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`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` +WHERE `a`.`RequiredNestedAssociateId` IS NOT NULL AND `n0`.`Id` IS NOT NULL +ORDER BY `r`.`Id`, `a`.`Id`, `n`.`Id`, `n0`.`Id` +"""); + } + + public override async Task Select_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_associate(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` +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` +"""); + } + + public override async Task Select_required_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_nested_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `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`.`RequiredNestedAssociateId` = `n`.`Id` +WHERE `a`.`RequiredNestedAssociateId` IS NOT NULL AND `n`.`Id` IS NOT NULL +"""); + } + + public override async Task Select_optional_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_nested_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `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`.`OptionalNestedAssociateId` = `n`.`Id` +"""); + } + + public override async Task Select_required_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_nested_on_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `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`.`RequiredNestedAssociateId` = `n`.`Id` +"""); + } + + public override async Task Select_optional_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_nested_on_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `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`.`OptionalNestedAssociateId` = `n`.`Id` +"""); + } + + public override async Task Select_required_associate_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_associate_via_optional_navigation(queryTrackingBehavior); + + 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` +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` +"""); + } + + public override async Task Select_unmapped_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_unmapped_associate_scalar_property(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` +FROM (((`RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`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` +WHERE `a`.`RequiredNestedAssociateId` IS NOT NULL AND `n0`.`Id` IS NOT NULL +ORDER BY `r`.`Id`, `a`.`Id`, `n`.`Id`, `n0`.`Id` +"""); + } + + public override async Task Select_untranslatable_method_on_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_untranslatable_method_on_associate_scalar_property(queryTrackingBehavior); + + AssertSql( + """ +SELECT `a`.`Int` +FROM `RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id` +"""); + } + + #endregion Structural properties + + #region Structural collection properties + + public override async Task Select_associate_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_associate_collection(queryTrackingBehavior); + + 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` +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` + 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` +"""); + } + + public override async Task Select_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nested_collection_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`Id`, `a`.`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` +"""); + } + + public override async Task Select_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nested_collection_on_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`Id`, `a`.`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` +"""); + } + + public override async Task SelectMany_associate_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.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` +FROM (((`RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`Id` = `a`.`CollectionRootId`) +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` +WHERE `a`.`RequiredNestedAssociateId` IS NOT NULL AND `n0`.`Id` IS NOT NULL +ORDER BY `r`.`Id`, `a`.`Id`, `n`.`Id`, `n0`.`Id` +"""); + } + + public override async Task SelectMany_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_nested_collection_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `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` +WHERE `a`.`Id` IS NOT NULL AND `n`.`CollectionAssociateId` IS NOT NULL +"""); + } + + public override async Task SelectMany_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_nested_collection_on_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `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` +WHERE `a`.`Id` IS NOT NULL AND `n`.`CollectionAssociateId` IS NOT NULL +"""); + } + + #endregion Structural collection properties + + #region Multiple + + public override async Task Select_root_duplicated(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root_duplicated(queryTrackingBehavior); + + 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` +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`) +INNER JOIN `AssociateType` AS `a0` ON `r`.`RequiredAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) 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`) +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` + FROM ((`AssociateType` AS `a2` + LEFT JOIN `NestedAssociateType` AS `n8` ON `a2`.`OptionalNestedAssociateId` = `n8`.`Id`) + INNER JOIN `NestedAssociateType` AS `n9` ON `a2`.`RequiredNestedAssociateId` = `n9`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n10` ON `a2`.`Id` = `n10`.`CollectionAssociateId` +) 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` +WHERE `a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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`, `n7`.`Id`, `s0`.`Id`, `s0`.`Id0`, `s0`.`Id1`, `s0`.`Id2`, `n11`.`Id` +"""); + } + + #endregion Multiple + + #region Subquery + + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); + + AssertSql( + """ +SELECT [s].[Id], [s].[CollectionAssociateId], [s].[Int], [s].[Ints], [s].[Name], [s].[String] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String] + FROM [RootEntity] AS [r0] + INNER JOIN [AssociateType] AS [a] ON [r0].[RequiredAssociateId] = [a].[Id] + INNER JOIN [NestedAssociateType] AS [n] ON [a].[RequiredNestedAssociateId] = [n].[Id] + ORDER BY [r0].[Id] +) AS [s] +"""); + } + + public override async Task Select_subquery_optional_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior); + + AssertSql( + """ +SELECT [s].[Id], [s].[CollectionAssociateId], [s].[Int], [s].[Ints], [s].[Name], [s].[String] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String] + FROM [RootEntity] AS [r0] + LEFT JOIN [AssociateType] AS [a] ON [r0].[OptionalAssociateId] = [a].[Id] + LEFT JOIN [NestedAssociateType] AS [n] ON [a].[RequiredNestedAssociateId] = [n].[Id] + ORDER BY [r0].[Id] +) AS [s] +"""); + } + + #endregion Subquery + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsSetOperationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsSetOperationsJetTest.cs new file mode 100644 index 00000000..8519997d --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsSetOperationsJetTest.cs @@ -0,0 +1,167 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Associations.Navigations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations; + +public class NavigationsSetOperationsJetTest( + NavigationsJetFixture fixture, + ITestOutputHelper testOutputHelper) + : NavigationsSetOperationsRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Over_associate_collections() + { + await base.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] +FROM [RootEntity] AS [r] +LEFT JOIN [AssociateType] AS [a1] ON [r].[OptionalAssociateId] = [a1].[Id] +LEFT JOIN [NestedAssociateType] AS [n] ON [a1].[OptionalNestedAssociateId] = [n].[Id] +LEFT JOIN [NestedAssociateType] AS [n0] ON [a1].[RequiredNestedAssociateId] = [n0].[Id] +INNER JOIN [AssociateType] AS [a2] ON [r].[RequiredAssociateId] = [a2].[Id] +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] + FROM [AssociateType] AS [a3] + LEFT JOIN [NestedAssociateType] AS [n3] ON [a3].[OptionalNestedAssociateId] = [n3].[Id] + INNER JOIN [NestedAssociateType] AS [n4] ON [a3].[RequiredNestedAssociateId] = [n4].[Id] + LEFT JOIN [NestedAssociateType] AS [n5] ON [a3].[Id] = [n5].[CollectionAssociateId] +) AS [s] ON [r].[Id] = [s].[CollectionRootId] +LEFT JOIN [NestedAssociateType] AS [n6] ON [a1].[Id] = [n6].[CollectionAssociateId] +LEFT JOIN [NestedAssociateType] AS [n7] ON [a2].[Id] = [n7].[CollectionAssociateId] +WHERE ( + SELECT COUNT(*) + FROM ( + SELECT 1 AS empty + FROM [AssociateType] AS [a] + WHERE [r].[Id] = [a].[CollectionRootId] AND [a].[Int] = 8 + UNION ALL + 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] +"""); + } + + public override async Task Over_associate_collection_projected(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Over_associate_collection_projected(queryTrackingBehavior); + + AssertSql(); + } + + public override async Task Over_assocate_collection_Select_nested_with_aggregates_projected(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Over_assocate_collection_Select_nested_with_aggregates_projected(queryTrackingBehavior); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(SUM([s].[value]), 0) + FROM ( + SELECT [a].[Id] + FROM [AssociateType] AS [a] + WHERE [r].[Id] = [a].[CollectionRootId] AND [a].[Int] = 8 + UNION ALL + SELECT [a0].[Id] + FROM [AssociateType] AS [a0] + WHERE [r].[Id] = [a0].[CollectionRootId] AND [a0].[String] = N'foo' + ) AS [u] + OUTER APPLY ( + SELECT COALESCE(SUM([n].[Int]), 0) AS [value] + FROM [NestedAssociateType] AS [n] + WHERE [u].[Id] = [n].[CollectionAssociateId] + ) AS [s]) +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Over_nested_associate_collection() + { + await base.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] +FROM [RootEntity] AS [r] +INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] +LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] +LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] +LEFT JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] +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] + FROM [AssociateType] AS [a1] + LEFT JOIN [NestedAssociateType] AS [n5] ON [a1].[OptionalNestedAssociateId] = [n5].[Id] + INNER JOIN [NestedAssociateType] AS [n6] ON [a1].[RequiredNestedAssociateId] = [n6].[Id] + LEFT JOIN [NestedAssociateType] AS [n7] ON [a1].[Id] = [n7].[CollectionAssociateId] +) AS [s] ON [r].[Id] = [s].[CollectionRootId] +LEFT JOIN [NestedAssociateType] AS [n8] ON [a0].[Id] = [n8].[CollectionAssociateId] +LEFT JOIN [NestedAssociateType] AS [n9] ON [a].[Id] = [n9].[CollectionAssociateId] +WHERE ( + SELECT COUNT(*) + FROM ( + SELECT 1 AS empty + FROM [NestedAssociateType] AS [n] + WHERE [a].[Id] = [n].[CollectionAssociateId] AND [n].[Int] = 8 + UNION ALL + 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] +"""); + } + + //skip this test as it crashes Jet EF Core provider + [Fact(Skip = "JET EF Core provider issue")] + public override async Task Over_different_collection_properties() + { + await base.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] +FROM [RootEntity] AS [r] +INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] +LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] +LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] +LEFT JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] +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] + FROM [AssociateType] AS [a1] + LEFT JOIN [NestedAssociateType] AS [n5] ON [a1].[OptionalNestedAssociateId] = [n5].[Id] + INNER JOIN [NestedAssociateType] AS [n6] ON [a1].[RequiredNestedAssociateId] = [n6].[Id] + LEFT JOIN [NestedAssociateType] AS [n7] ON [a1].[Id] = [n7].[CollectionAssociateId] +) AS [s] ON [r].[Id] = [s].[CollectionRootId] +LEFT JOIN [NestedAssociateType] AS [n8] ON [a0].[Id] = [n8].[CollectionAssociateId] +LEFT JOIN [NestedAssociateType] AS [n9] ON [a].[Id] = [n9].[CollectionAssociateId] +WHERE ( + SELECT COUNT(*) + FROM ( + SELECT 1 AS empty + FROM [NestedAssociateType] AS [n] + WHERE [a].[Id] = [n].[CollectionAssociateId] + UNION ALL + 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] +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityJetTest.cs new file mode 100644 index 00000000..07a731fc --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualityJetTest.cs @@ -0,0 +1,421 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.Navigations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.Navigations; + +public class NavigationsStructuralEqualityJetTest( + NavigationsJetFixture fixture, + ITestOutputHelper testOutputHelper) + : NavigationsStructuralEqualityRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Two_associates() + { + await base.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` +FROM ((((((((`RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id`) +LEFT JOIN `AssociateType` AS `a0` ON `r`.`OptionalAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n` ON `a0`.`OptionalNestedAssociateId` = `n`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n0` ON `a0`.`RequiredNestedAssociateId` = `n0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId`) +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`) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + public override async Task Two_nested_associates() + { + await base.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` +FROM ((((((((`RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`RequiredNestedAssociateId` = `n`.`Id`) +LEFT JOIN `AssociateType` AS `a0` ON `r`.`OptionalAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n0` ON `a0`.`RequiredNestedAssociateId` = `n0`.`Id`) +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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId`) +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`) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n`.`Id` IS NOT 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` +"""); + } + + public override async Task Not_equals() + { + await base.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` +FROM ((((((((`RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id`) +LEFT JOIN `AssociateType` AS `a0` ON `r`.`OptionalAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n` ON `a0`.`OptionalNestedAssociateId` = `n`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n0` ON `a0`.`RequiredNestedAssociateId` = `n0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId`) +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) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + public override async Task Associate_with_inline_null() + { + await base.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` +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`) +INNER JOIN `AssociateType` AS `a0` ON `r`.`RequiredAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) 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` +WHERE (`a`.`Id` IS NULL) AND (`a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + public override async Task Associate_with_parameter_null() + { + await base.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` +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`) +INNER JOIN `AssociateType` AS `a0` ON `r`.`RequiredAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) 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` +WHERE (`a`.`Id` IS NULL) AND (`a0`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + public override async Task Nested_associate_with_inline_null() + { + await base.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` +FROM ((((((((`RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`OptionalNestedAssociateId` = `n`.`Id`) +LEFT JOIN `AssociateType` AS `a0` ON `r`.`OptionalAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n0` ON `a0`.`OptionalNestedAssociateId` = `n0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`RequiredNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId`) +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) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + public override async Task Nested_associate_with_inline() + { + await base.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` +FROM ((((((((`RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`RequiredNestedAssociateId` = `n`.`Id`) +LEFT JOIN `AssociateType` AS `a0` ON `r`.`OptionalAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n0` ON `a0`.`OptionalNestedAssociateId` = `n0`.`Id`) +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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId`) +LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) +LEFT JOIN `NestedAssociateType` AS `n7` ON `a`.`Id` = `n7`.`CollectionAssociateId` +WHERE (`n`.`Id` = 1000) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n`.`Id` IS NOT 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` +"""); + } + + public override async Task Nested_associate_with_parameter() + { + await base.Nested_associate_with_parameter(); + + AssertSql( + """ +@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` +FROM ((((((((`RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n` ON `a`.`RequiredNestedAssociateId` = `n`.`Id`) +LEFT JOIN `AssociateType` AS `a0` ON `r`.`OptionalAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n0` ON `a0`.`OptionalNestedAssociateId` = `n0`.`Id`) +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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId`) +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) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n`.`Id` IS NOT 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` +"""); + } + + public override async Task Two_nested_collections() + { + await base.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` +FROM ((((((((`RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id`) +LEFT JOIN `AssociateType` AS `a0` ON `r`.`OptionalAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n` ON `a0`.`OptionalNestedAssociateId` = `n`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n0` ON `a0`.`RequiredNestedAssociateId` = `n0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a1`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a1`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a1`.`Id` = `n5`.`CollectionAssociateId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId`) +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`) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT 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` +"""); + } + + public override async Task Nested_collection_with_inline() + { + await base.Nested_collection_with_inline(); + + AssertSql(); + } + + public override async Task Nested_collection_with_parameter() + { + await base.Nested_collection_with_parameter(); + + AssertSql(); + } + + #region Contains + + public override async Task Contains_with_inline() + { + await base.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` +FROM ((((((((`RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id`) +LEFT JOIN `AssociateType` AS `a0` ON `r`.`OptionalAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n0` ON `a0`.`OptionalNestedAssociateId` = `n0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`RequiredNestedAssociateId` = `n1`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n2` ON `a`.`OptionalNestedAssociateId` = `n2`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n4` ON `a1`.`OptionalNestedAssociateId` = `n4`.`Id`) + INNER JOIN `NestedAssociateType` AS `n5` ON `a1`.`RequiredNestedAssociateId` = `n5`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n6` ON `a1`.`Id` = `n6`.`CollectionAssociateId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId`) +LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId`) +LEFT JOIN `NestedAssociateType` AS `n8` ON `a`.`Id` = `n8`.`CollectionAssociateId` +WHERE (EXISTS ( + SELECT 1 + FROM `NestedAssociateType` AS `n` + WHERE `a`.`Id` = `n`.`CollectionAssociateId` AND `n`.`Id` = 1002)) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n3`.`Id` IS NOT NULL) +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` +"""); + } + + public override async Task Contains_with_parameter() + { + await base.Contains_with_parameter(); + + AssertSql( + """ +@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` +FROM ((((((((`RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id`) +LEFT JOIN `AssociateType` AS `a0` ON `r`.`OptionalAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n0` ON `a0`.`OptionalNestedAssociateId` = `n0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`RequiredNestedAssociateId` = `n1`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n2` ON `a`.`OptionalNestedAssociateId` = `n2`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n4` ON `a1`.`OptionalNestedAssociateId` = `n4`.`Id`) + INNER JOIN `NestedAssociateType` AS `n5` ON `a1`.`RequiredNestedAssociateId` = `n5`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n6` ON `a1`.`Id` = `n6`.`CollectionAssociateId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId`) +LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId`) +LEFT JOIN `NestedAssociateType` AS `n8` ON `a`.`Id` = `n8`.`CollectionAssociateId` +WHERE (EXISTS ( + SELECT 1 + FROM `NestedAssociateType` AS `n` + WHERE `a`.`Id` = `n`.`CollectionAssociateId` AND `n`.`Id` = @entity_equality_nested_Id)) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n3`.`Id` IS NOT NULL) +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` +"""); + } + + public override async Task Contains_with_operators_composed_on_the_collection() + { + await base.Contains_with_operators_composed_on_the_collection(); + + AssertSql( + """ +@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` +FROM ((((((((`RootEntity` AS `r` +INNER JOIN `AssociateType` AS `a` ON `r`.`RequiredAssociateId` = `a`.`Id`) +LEFT JOIN `AssociateType` AS `a0` ON `r`.`OptionalAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n0` ON `a0`.`OptionalNestedAssociateId` = `n0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a0`.`RequiredNestedAssociateId` = `n1`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n2` ON `a`.`OptionalNestedAssociateId` = `n2`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a1` + LEFT JOIN `NestedAssociateType` AS `n4` ON `a1`.`OptionalNestedAssociateId` = `n4`.`Id`) + INNER JOIN `NestedAssociateType` AS `n5` ON `a1`.`RequiredNestedAssociateId` = `n5`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n6` ON `a1`.`Id` = `n6`.`CollectionAssociateId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId`) +LEFT JOIN `NestedAssociateType` AS `n7` ON `a0`.`Id` = `n7`.`CollectionAssociateId`) +LEFT JOIN `NestedAssociateType` AS `n8` ON `a`.`Id` = `n8`.`CollectionAssociateId` +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)) AND (`a`.`RequiredNestedAssociateId` IS NOT NULL AND `n3`.`Id` IS NOT NULL) +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` +"""); + } + + public override async Task Contains_with_nested_and_composed_operators() + { + await base.Contains_with_nested_and_composed_operators(); + + AssertSql( + """ +@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` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `AssociateType` AS `a0` ON `r`.`OptionalAssociateId` = `a0`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n` ON `a0`.`OptionalNestedAssociateId` = `n`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n0` ON `a0`.`RequiredNestedAssociateId` = `n0`.`Id`) +INNER JOIN `AssociateType` AS `a1` ON `r`.`RequiredAssociateId` = `a1`.`Id`) +LEFT JOIN `NestedAssociateType` AS `n1` ON `a1`.`OptionalNestedAssociateId` = `n1`.`Id`) +LEFT 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` + FROM ((`AssociateType` AS `a2` + LEFT JOIN `NestedAssociateType` AS `n3` ON `a2`.`OptionalNestedAssociateId` = `n3`.`Id`) + INNER JOIN `NestedAssociateType` AS `n4` ON `a2`.`RequiredNestedAssociateId` = `n4`.`Id`) + LEFT JOIN `NestedAssociateType` AS `n5` ON `a2`.`Id` = `n5`.`CollectionAssociateId` +) AS `s` ON `r`.`Id` = `s`.`CollectionRootId`) +LEFT JOIN `NestedAssociateType` AS `n6` ON `a0`.`Id` = `n6`.`CollectionAssociateId`) +LEFT JOIN `NestedAssociateType` AS `n7` ON `a1`.`Id` = `n7`.`CollectionAssociateId` +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)) AND (`a1`.`RequiredNestedAssociateId` IS NOT NULL AND `n2`.`Id` IS NOT NULL) +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` +"""); + } + + #endregion Contains + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonBulkUpdateJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonBulkUpdateJetTest.cs new file mode 100644 index 00000000..9848b7ec --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonBulkUpdateJetTest.cs @@ -0,0 +1,9 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedJson; + +public class OwnedJsonBulkUpdateJetTest( + OwnedJsonJetFixture fixture, + ITestOutputHelper testOutputHelper) + : OwnedJsonBulkUpdateRelationalTestBase(fixture, testOutputHelper); diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonCollectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonCollectionJetTest.cs new file mode 100644 index 00000000..18a9abce --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonCollectionJetTest.cs @@ -0,0 +1,257 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedJson; + +public class OwnedJsonCollectionJetTest(OwnedJsonJetFixture fixture, ITestOutputHelper testOutputHelper) + : OwnedJsonCollectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Count() + { + await base.Count(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE ( + SELECT COUNT(*) + FROM OPENJSON([r].[AssociateCollection], '$') AS [a]) = 2 +"""); + } + + public override async Task Where() + { + await base.Where(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE ( + SELECT COUNT(*) + FROM OPENJSON([r].[AssociateCollection], '$') WITH ( + [Id] int '$.Id', + [Int] int '$.Int', + [Ints] nvarchar(max) '$.Ints' AS JSON, + [Name] nvarchar(max) '$.Name', + [String] nvarchar(max) '$.String' + ) AS [a] + WHERE [a].[Int] <> 8) = 2 +"""); + } + + public override async Task OrderBy_ElementAt() + { + await base.OrderBy_ElementAt(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE ( + SELECT [a].[Int] + FROM OPENJSON([r].[AssociateCollection], '$') WITH ( + [Id] int '$.Id', + [Int] int '$.Int', + [Ints] nvarchar(max) '$.Ints' AS JSON, + [Name] nvarchar(max) '$.Name', + [String] nvarchar(max) '$.String' + ) AS [a] + ORDER BY [a].[Id] + OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY) = 8 +"""); + } + + #region Distinct + + public override async Task Distinct() + { + await base.Distinct(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE ( + SELECT COUNT(*) + FROM ( + SELECT DISTINCT [r].[Id], [a].[Id] AS [Id0], [a].[Int], [a].[Ints], [a].[Name], [a].[String], [a].[NestedCollection] AS [c], [a].[OptionalNestedAssociate] AS [c0], [a].[RequiredNestedAssociate] AS [c1] + FROM OPENJSON([r].[AssociateCollection], '$') WITH ( + [Id] int '$.Id', + [Int] int '$.Int', + [Ints] nvarchar(max) '$.Ints' AS JSON, + [Name] nvarchar(max) '$.Name', + [String] nvarchar(max) '$.String', + [NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON, + [OptionalNestedAssociate] nvarchar(max) '$.OptionalNestedAssociate' AS JSON, + [RequiredNestedAssociate] nvarchar(max) '$.RequiredNestedAssociate' AS JSON + ) AS [a] + ) AS [a0]) = 2 +"""); + } + + public override async Task Distinct_projected(QueryTrackingBehavior queryTrackingBehavior) + { + if (queryTrackingBehavior is QueryTrackingBehavior.TrackAll) + { + await base.Distinct_projected(queryTrackingBehavior); + } + else + { + await base.Distinct_projected(queryTrackingBehavior); + + AssertSql( + """ +SELECT [r].[Id], [a0].[Id], [a0].[Id0], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[String], [a0].[c], [a0].[c0], [a0].[c1] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT DISTINCT [r].[Id], [a].[Id] AS [Id0], [a].[Int], [a].[Ints], [a].[Name], [a].[String], [a].[NestedCollection] AS [c], [a].[OptionalNestedAssociate] AS [c0], [a].[RequiredNestedAssociate] AS [c1] + FROM OPENJSON([r].[AssociateCollection], '$') WITH ( + [Id] int '$.Id', + [Int] int '$.Int', + [Ints] nvarchar(max) '$.Ints' AS JSON, + [Name] nvarchar(max) '$.Name', + [String] nvarchar(max) '$.String', + [NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON, + [OptionalNestedAssociate] nvarchar(max) '$.OptionalNestedAssociate' AS JSON, + [RequiredNestedAssociate] nvarchar(max) '$.RequiredNestedAssociate' AS JSON + ) AS [a] +) AS [a0] +ORDER BY [r].[Id], [a0].[Id0], [a0].[Int], [a0].[Ints], [a0].[Name] +"""); + } + } + + public override async Task Distinct_over_projected_nested_collection() + { + await base.Distinct_over_projected_nested_collection(); + + AssertSql(); + } + + public override async Task Distinct_over_projected_filtered_nested_collection() + { + await base.Distinct_over_projected_filtered_nested_collection(); + + AssertSql(); + } + + #endregion Distinct + + #region Index + + public override async Task Index_constant() + { + await base.Index_constant(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[AssociateCollection], '$[0].Int') AS int) = 8 +"""); + } + + + public override async Task Index_parameter() + { + await base.Index_parameter(); + + AssertSql( + """ +@i='0' + +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[AssociateCollection], '$[' + CAST(@i AS nvarchar(max)) + '].Int') AS int) = 8 +"""); + } + + public override async Task Index_column() + { + await base.Index_column(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[AssociateCollection], '$[' + CAST([r].[Id] - 1 AS nvarchar(max)) + '].Int') AS int) = 8 +"""); + } + + public override async Task Index_out_of_bounds() + { + await base.Index_out_of_bounds(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[AssociateCollection], '$[9999].Int') AS int) = 8 +"""); + } + + #endregion Index + + #region GroupBy + + [ConditionalFact] + public override async Task GroupBy() + { + await base.GroupBy(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE 16 IN ( + SELECT COALESCE(SUM([a0].[Int]), 0) + FROM ( + SELECT [a].[Id] AS [Id0], [a].[Int], [a].[Ints], [a].[Name], [a].[String], [a].[String] AS [Key0] + FROM OPENJSON([r].[AssociateCollection], '$') WITH ( + [Id] int '$.Id', + [Int] int '$.Int', + [Ints] nvarchar(max) '$.Ints' AS JSON, + [Name] nvarchar(max) '$.Name', + [String] nvarchar(max) '$.String' + ) AS [a] + ) AS [a0] + GROUP BY [a0].[Key0] +) +"""); + } + + #endregion GroupBy + + public override async Task Select_within_Select_within_Select_with_aggregates() + { + await base.Select_within_Select_within_Select_with_aggregates(); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(SUM([s].[value]), 0) + FROM OPENJSON([r].[AssociateCollection], '$') WITH ([NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON) AS [a] + OUTER APPLY ( + SELECT MAX([n].[Int]) AS [value] + FROM OPENJSON([a].[NestedCollection], '$') WITH ( + [Id] int '$.Id', + [Int] int '$.Int', + [Ints] nvarchar(max) '$.Ints' AS JSON, + [Name] nvarchar(max) '$.Name', + [String] nvarchar(max) '$.String' + ) AS [n] + ) AS [s]) +FROM [RootEntity] AS [r] +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonJetFixture.cs new file mode 100644 index 00000000..1fe7c50f --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonJetFixture.cs @@ -0,0 +1,18 @@ +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; +using Microsoft.EntityFrameworkCore.TestUtilities; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedJson; + +public class OwnedJsonJetFixture : OwnedJsonRelationalFixtureBase +{ + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; + + public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) + { + var options = base.AddOptions(builder); + return options; + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonMiscellaneousJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonMiscellaneousJetTest.cs new file mode 100644 index 00000000..a64f673d --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonMiscellaneousJetTest.cs @@ -0,0 +1,57 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedJson; + +public class OwnedJsonMiscellaneousJetTest( + OwnedJsonJetFixture fixture, + ITestOutputHelper testOutputHelper) + : OwnedJsonMiscellaneousRelationalTestBase(fixture, testOutputHelper) +{ + #region Simple filters + + public override async Task Where_on_associate_scalar_property() + { + await base.Where_on_associate_scalar_property(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[RequiredAssociate], '$.Int') AS int) = 8 +"""); + } + + public override async Task Where_on_optional_associate_scalar_property() + { + await base.Where_on_optional_associate_scalar_property(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[OptionalAssociate], '$.Int') AS int) = 8 +"""); + } + + public override async Task Where_on_nested_associate_scalar_property() + { + await base.Where_on_nested_associate_scalar_property(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[RequiredAssociate], '$.RequiredNestedAssociate.Int') AS int) = 8 +"""); + } + + #endregion Simple filters + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonPrimitiveCollectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonPrimitiveCollectionJetTest.cs new file mode 100644 index 00000000..b9500483 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonPrimitiveCollectionJetTest.cs @@ -0,0 +1,101 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedJson; + +public class OwnedJsonPrimitiveCollectionJetTest(OwnedJsonJetFixture fixture, ITestOutputHelper testOutputHelper) + : OwnedJsonPrimitiveCollectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Count() + { + await base.Count(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE ( + SELECT COUNT(*) + FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) AS [i]) = 3 +"""); + } + + public override async Task Index() + { + await base.Index(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE CAST(JSON_VALUE([r].[RequiredAssociate], '$.Ints[0]') AS int) = 1 +"""); + } + + public override async Task Contains() + { + await base.Contains(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE 3 IN ( + SELECT [i].[value] + FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) WITH ([value] int '$') AS [i] +) +"""); + } + + public override async Task Any_predicate() + { + await base.Any_predicate(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE 2 IN ( + SELECT [i].[value] + FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) WITH ([value] int '$') AS [i] +) +"""); + } + + public override async Task Nested_Count() + { + await base.Nested_Count(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE ( + SELECT COUNT(*) + FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate.Ints')) AS [i]) = 3 +"""); + } + + public override async Task Select_Sum() + { + await base.Select_Sum(); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(SUM([i0].[value]), 0) + FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) WITH ([value] int '$') AS [i0]) +FROM [RootEntity] AS [r] +WHERE ( + SELECT COALESCE(SUM([i].[value]), 0) + FROM OPENJSON(JSON_QUERY([r].[RequiredAssociate], '$.Ints')) WITH ([value] int '$') AS [i]) >= 6 +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionJetTest.cs new file mode 100644 index 00000000..73ac404b --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonProjectionJetTest.cs @@ -0,0 +1,372 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedJson; + +public class OwnedJsonProjectionJetTest(OwnedJsonJetFixture fixture, ITestOutputHelper testOutputHelper) + : OwnedJsonProjectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` +FROM `RootEntity` AS `r` +"""); + } + + #region Scalar properties + + public override async Task Select_scalar_property_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_scalar_property_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT JSON_VALUE([r].[RequiredAssociate], '$.String') +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Select_property_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_property_on_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT JSON_VALUE([r].[OptionalAssociate], '$.String') +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Select_value_type_property_on_null_associate_throws(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_value_type_property_on_null_associate_throws(queryTrackingBehavior); + + AssertSql( +); + } + + public override async Task Select_nullable_value_type_property_on_null_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nullable_value_type_property_on_null_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT CAST(JSON_VALUE([r].[OptionalAssociate], '$.Int') AS int) +FROM [RootEntity] AS [r] +"""); + } + + #endregion Scalar properties + + #region Structural properties + + public override async Task Select_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r`.`RequiredAssociate`, `r`.`Id` +FROM `RootEntity` AS `r` +"""); + } + } + + public override async Task Select_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r`.`OptionalAssociate`, `r`.`Id` +FROM `RootEntity` AS `r` +"""); + } + } + + public override async Task Select_required_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_nested_on_required_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT JSON_QUERY([r].[RequiredAssociate], '$.RequiredNestedAssociate'), [r].[Id] +FROM [RootEntity] AS [r] +"""); + } + } + + public override async Task Select_optional_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_nested_on_required_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT JSON_QUERY([r].[RequiredAssociate], '$.OptionalNestedAssociate'), [r].[Id] +FROM [RootEntity] AS [r] +"""); + } + } + + public override async Task Select_required_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_nested_on_optional_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT JSON_QUERY([r].[OptionalAssociate], '$.RequiredNestedAssociate'), [r].[Id] +FROM [RootEntity] AS [r] +"""); + } + } + + public override async Task Select_optional_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_nested_on_optional_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT JSON_QUERY([r].[OptionalAssociate], '$.OptionalNestedAssociate'), [r].[Id] +FROM [RootEntity] AS [r] +"""); + } + } + + public override async Task Select_required_associate_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_associate_via_optional_navigation(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r0`.`RequiredAssociate`, `r0`.`Id` +FROM `RootReferencingEntity` AS `r` +LEFT JOIN `RootEntity` AS `r0` ON `r`.`RootEntityId` = `r0`.`Id` +"""); + } + } + + public override async Task Select_unmapped_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_unmapped_associate_scalar_property(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r`.`RequiredAssociate`, `r`.`Id` +FROM `RootEntity` AS `r` +"""); + } + } + + public override async Task Select_untranslatable_method_on_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_untranslatable_method_on_associate_scalar_property(queryTrackingBehavior); + + AssertSql( + """ +SELECT CAST(JSON_VALUE([r].[RequiredAssociate], '$.Int') AS int) +FROM [RootEntity] AS [r] +"""); + } + + #endregion Structural properties + + #region Structural collection properties + + public override async Task Select_associate_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_associate_collection(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r`.`AssociateCollection`, `r`.`Id` +FROM `RootEntity` AS `r` +ORDER BY `r`.`Id` +"""); + } + } + + public override async Task Select_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nested_collection_on_required_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT JSON_QUERY([r].[RequiredAssociate], '$.NestedCollection'), [r].[Id] +FROM [RootEntity] AS [r] +ORDER BY [r].[Id] +"""); + } + } + + public override async Task Select_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nested_collection_on_optional_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT JSON_QUERY([r].[OptionalAssociate], '$.NestedCollection'), [r].[Id] +FROM [RootEntity] AS [r] +ORDER BY [r].[Id] +"""); + } + } + + public override async Task SelectMany_associate_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_associate_collection(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [r].[Id], [a].[Id], [a].[Int], [a].[Ints], [a].[Name], [a].[String], [a].[NestedCollection], [a].[OptionalNestedAssociate], [a].[RequiredNestedAssociate] +FROM [RootEntity] AS [r] +CROSS APPLY OPENJSON([r].[AssociateCollection], '$') WITH ( + [Id] int '$.Id', + [Int] int '$.Int', + [Ints] nvarchar(max) '$.Ints' AS JSON, + [Name] nvarchar(max) '$.Name', + [String] nvarchar(max) '$.String', + [NestedCollection] nvarchar(max) '$.NestedCollection' AS JSON, + [OptionalNestedAssociate] nvarchar(max) '$.OptionalNestedAssociate' AS JSON, + [RequiredNestedAssociate] nvarchar(max) '$.RequiredNestedAssociate' AS JSON +) AS [a] +"""); + } + } + + public override async Task SelectMany_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_nested_collection_on_required_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [r].[Id], [n].[Id], [n].[Int], [n].[Ints], [n].[Name], [n].[String] +FROM [RootEntity] AS [r] +CROSS APPLY OPENJSON([r].[RequiredAssociate], '$.NestedCollection') WITH ( + [Id] int '$.Id', + [Int] int '$.Int', + [Ints] nvarchar(max) '$.Ints' AS JSON, + [Name] nvarchar(max) '$.Name', + [String] nvarchar(max) '$.String' +) AS [n] +"""); + } + } + + public override async Task SelectMany_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_nested_collection_on_optional_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [r].[Id], [n].[Id], [n].[Int], [n].[Ints], [n].[Name], [n].[String] +FROM [RootEntity] AS [r] +CROSS APPLY OPENJSON([r].[OptionalAssociate], '$.NestedCollection') WITH ( + [Id] int '$.Id', + [Int] int '$.Int', + [Ints] nvarchar(max) '$.Ints' AS JSON, + [Name] nvarchar(max) '$.Name', + [String] nvarchar(max) '$.String' +) AS [n] +"""); + } + } + + #endregion Structural collection properties + + #region Multiple + + public override async Task Select_root_duplicated(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root_duplicated(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` +FROM `RootEntity` AS `r` +"""); + } + + #endregion Multiple + + #region Subquery + + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [r1].[c], [r1].[Id] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) JSON_QUERY([r0].[RequiredAssociate], '$.RequiredNestedAssociate') AS [c], [r0].[Id] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +"""); + } + } + + public override async Task Select_subquery_optional_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [r1].[c], [r1].[Id] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) JSON_QUERY([r0].[OptionalAssociate], '$.RequiredNestedAssociate') AS [c], [r0].[Id] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +"""); + } + } + + #endregion Subquery + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonStructuralEqualityJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonStructuralEqualityJetTest.cs new file mode 100644 index 00000000..56a32f30 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonStructuralEqualityJetTest.cs @@ -0,0 +1,165 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedJson; + +public class OwnedJsonStructuralEqualityJetTest( + OwnedJsonJetFixture fixture, + ITestOutputHelper testOutputHelper) + : OwnedJsonStructuralEqualityRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Two_associates() + { + await base.Two_associates(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` +FROM `RootEntity` AS `r` +WHERE FALSE +"""); + } + + public override async Task Two_nested_associates() + { + await base.Two_nested_associates(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` +FROM `RootEntity` AS `r` +WHERE FALSE +"""); + } + + public override async Task Not_equals() + { + await base.Not_equals(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` +FROM `RootEntity` AS `r` +WHERE FALSE +"""); + } + + public override async Task Associate_with_inline_null() + { + await base.Associate_with_inline_null(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` +FROM `RootEntity` AS `r` +WHERE (`r`.`OptionalAssociate`) IS NULL +"""); + } + + public override async Task Associate_with_parameter_null() + { + await base.Associate_with_parameter_null(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` +FROM `RootEntity` AS `r` +WHERE FALSE +"""); + } + + public override async Task Nested_associate_with_inline_null() + { + await base.Nested_associate_with_inline_null(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r].[AssociateCollection], [r].[OptionalAssociate], [r].[RequiredAssociate] +FROM [RootEntity] AS [r] +WHERE JSON_QUERY([r].[RequiredAssociate], '$.OptionalNestedAssociate') IS NULL +"""); + } + + public override async Task Nested_associate_with_inline() + { + await base.Nested_associate_with_inline(); + + AssertSql( + ); + } + + public override async Task Nested_associate_with_parameter() + { + await base.Nested_associate_with_parameter(); + + AssertSql( + ); + } + + public override async Task Two_nested_collections() + { + await base.Two_nested_collections(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r`.`AssociateCollection`, `r`.`OptionalAssociate`, `r`.`RequiredAssociate` +FROM `RootEntity` AS `r` +WHERE FALSE +"""); + } + + public override async Task Nested_collection_with_inline() + { + await base.Nested_collection_with_inline(); + + AssertSql( + ); + } + + public override async Task Nested_collection_with_parameter() + { + await base.Nested_collection_with_parameter(); + + AssertSql( + ); + } + + #region Contains + + public override async Task Contains_with_inline() + { + await base.Contains_with_inline(); + + AssertSql(); + } + + public override async Task Contains_with_parameter() + { + await base.Contains_with_parameter(); + + AssertSql(); + } + + public override async Task Contains_with_operators_composed_on_the_collection() + { + await base.Contains_with_operators_composed_on_the_collection(); + + AssertSql(); + } + + public override async Task Contains_with_nested_and_composed_operators() + { + await base.Contains_with_nested_and_composed_operators(); + + AssertSql(); + } + + #endregion Contains + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonTypeJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonTypeJetFixture.cs new file mode 100644 index 00000000..b43758dd --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedJson/OwnedJsonTypeJetFixture.cs @@ -0,0 +1,23 @@ +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedJson; +using Microsoft.EntityFrameworkCore.TestUtilities; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedJson; + +public class OwnedJsonTypeJetFixture : OwnedJsonRelationalFixtureBase +{ + protected override string StoreName + => "OwnedJsonTypeRelationshipsQueryTest"; + + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; + + // protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) + // { + // base.OnModelCreating(modelBuilder, context); + + // modelBuilder.Entity().OwnsOne(x => x.RequiredTrunk).HasColumnType("json"); + // modelBuilder.Entity().OwnsOne(x => x.OptionalTrunk).HasColumnType("json"); + // modelBuilder.Entity().OwnsMany(x => x.CollectionTrunk).HasColumnType("json"); + // } +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionJetTest.cs new file mode 100644 index 00000000..5a1b9167 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsCollectionJetTest.cs @@ -0,0 +1,279 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedNavigations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations; + +public class OwnedNavigationsCollectionJetTest(OwnedNavigationsJetFixture fixture, ITestOutputHelper testOutputHelper) + : OwnedNavigationsCollectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Count() + { + await base.Count(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r1`.`RootEntityId`, `r2`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeRootEntityId`, `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`, `o`.`Id`, `o`.`Int`, `o`.`Ints`, `o`.`Name`, `o`.`String`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `o2`.`Int`, `o2`.`Ints`, `o2`.`Name`, `o2`.`String`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String`, `o1`.`Id`, `o1`.`Int`, `o1`.`Ints`, `o1`.`Name`, `o1`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r8`.`AssociateTypeRootEntityId`, `r8`.`Id`, `r8`.`Int`, `r8`.`Ints`, `r8`.`Name`, `r8`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o1` ON `o`.`RootEntityId` = `o1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated` AS `r1` ON `r`.`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 ( + SELECT `r4`.`RootEntityId`, `r4`.`Id`, `r4`.`Int`, `r4`.`Ints`, `r4`.`Name`, `r4`.`String`, `r5`.`AssociateTypeRootEntityId`, `r5`.`AssociateTypeId`, `r6`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r6`.`AssociateTypeId` AS `AssociateTypeId0`, `r7`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r7`.`AssociateTypeId` AS `AssociateTypeId1`, `r7`.`Id` AS `Id0`, `r7`.`Int` AS `Int0`, `r7`.`Ints` AS `Ints0`, `r7`.`Name` AS `Name0`, `r7`.`String` AS `String0`, `r5`.`Id` AS `Id1`, `r5`.`Int` AS `Int1`, `r5`.`Ints` AS `Ints1`, `r5`.`Name` AS `Name1`, `r5`.`String` AS `String1`, `r6`.`Id` AS `Id2`, `r6`.`Int` AS `Int2`, `r6`.`Ints` AS `Ints2`, `r6`.`Name` AS `Name2`, `r6`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r4` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r5` ON `r4`.`RootEntityId` = `r5`.`AssociateTypeRootEntityId` AND `r4`.`Id` = `r5`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r6` ON `r4`.`RootEntityId` = `r6`.`AssociateTypeRootEntityId` AND `r4`.`Id` = `r6`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r7` ON `r4`.`RootEntityId` = `r7`.`AssociateTypeRootEntityId` AND `r4`.`Id` = `r7`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o2` ON `o`.`RootEntityId` = `o2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r8` ON `r1`.`RootEntityId` = `r8`.`AssociateTypeRootEntityId` +WHERE ( + SELECT COUNT(*) + FROM `RelatedCollection` AS `r0` + WHERE `r`.`Id` = `r0`.`RootEntityId`) = 2 +ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r1`.`RootEntityId`, `r2`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r8`.`AssociateTypeRootEntityId` +"""); + } + + public override async Task Where() + { + await base.Where(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r1`.`RootEntityId`, `r2`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeRootEntityId`, `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`, `o`.`Id`, `o`.`Int`, `o`.`Ints`, `o`.`Name`, `o`.`String`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `o2`.`Int`, `o2`.`Ints`, `o2`.`Name`, `o2`.`String`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String`, `o1`.`Id`, `o1`.`Int`, `o1`.`Ints`, `o1`.`Name`, `o1`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r8`.`AssociateTypeRootEntityId`, `r8`.`Id`, `r8`.`Int`, `r8`.`Ints`, `r8`.`Name`, `r8`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o1` ON `o`.`RootEntityId` = `o1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated` AS `r1` ON `r`.`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 ( + SELECT `r4`.`RootEntityId`, `r4`.`Id`, `r4`.`Int`, `r4`.`Ints`, `r4`.`Name`, `r4`.`String`, `r5`.`AssociateTypeRootEntityId`, `r5`.`AssociateTypeId`, `r6`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r6`.`AssociateTypeId` AS `AssociateTypeId0`, `r7`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r7`.`AssociateTypeId` AS `AssociateTypeId1`, `r7`.`Id` AS `Id0`, `r7`.`Int` AS `Int0`, `r7`.`Ints` AS `Ints0`, `r7`.`Name` AS `Name0`, `r7`.`String` AS `String0`, `r5`.`Id` AS `Id1`, `r5`.`Int` AS `Int1`, `r5`.`Ints` AS `Ints1`, `r5`.`Name` AS `Name1`, `r5`.`String` AS `String1`, `r6`.`Id` AS `Id2`, `r6`.`Int` AS `Int2`, `r6`.`Ints` AS `Ints2`, `r6`.`Name` AS `Name2`, `r6`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r4` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r5` ON `r4`.`RootEntityId` = `r5`.`AssociateTypeRootEntityId` AND `r4`.`Id` = `r5`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r6` ON `r4`.`RootEntityId` = `r6`.`AssociateTypeRootEntityId` AND `r4`.`Id` = `r6`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r7` ON `r4`.`RootEntityId` = `r7`.`AssociateTypeRootEntityId` AND `r4`.`Id` = `r7`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o2` ON `o`.`RootEntityId` = `o2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r8` ON `r1`.`RootEntityId` = `r8`.`AssociateTypeRootEntityId` +WHERE ( + SELECT COUNT(*) + FROM `RelatedCollection` AS `r0` + WHERE `r`.`Id` = `r0`.`RootEntityId` AND `r0`.`Int` <> 8) = 2 +ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r1`.`RootEntityId`, `r2`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r8`.`AssociateTypeRootEntityId` +"""); + } + + public override async Task OrderBy_ElementAt() + { + await base.OrderBy_ElementAt(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r1].[RootEntityId], [r2].[AssociateTypeRootEntityId], [r3].[AssociateTypeRootEntityId], [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], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [o2].[AssociateTypeRootEntityId], [o2].[Id], [o2].[Int], [o2].[Ints], [o2].[Name], [o2].[String], [o0].[Id], [o0].[Int], [o0].[Ints], [o0].[Name], [o0].[String], [o1].[Id], [o1].[Int], [o1].[Ints], [o1].[Name], [o1].[String], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r8].[AssociateTypeRootEntityId], [r8].[Id], [r8].[Int], [r8].[Ints], [r8].[Name], [r8].[String], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String] +FROM [RootEntity] AS [r] +LEFT JOIN [OptionalRelated] AS [o] ON [r].[Id] = [o].[RootEntityId] +LEFT JOIN [OptionalRelated_OptionalNested] AS [o0] ON [o].[RootEntityId] = [o0].[AssociateTypeRootEntityId] +LEFT JOIN [OptionalRelated_RequiredNested] AS [o1] ON [o].[RootEntityId] = [o1].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated] AS [r1] ON [r].[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 ( + SELECT [r4].[RootEntityId], [r4].[Id], [r4].[Int], [r4].[Ints], [r4].[Name], [r4].[String], [r5].[AssociateTypeRootEntityId], [r5].[AssociateTypeId], [r6].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId0], [r6].[AssociateTypeId] AS [AssociateTypeId0], [r7].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId1], [r7].[AssociateTypeId] AS [AssociateTypeId1], [r7].[Id] AS [Id0], [r7].[Int] AS [Int0], [r7].[Ints] AS [Ints0], [r7].[Name] AS [Name0], [r7].[String] AS [String0], [r5].[Id] AS [Id1], [r5].[Int] AS [Int1], [r5].[Ints] AS [Ints1], [r5].[Name] AS [Name1], [r5].[String] AS [String1], [r6].[Id] AS [Id2], [r6].[Int] AS [Int2], [r6].[Ints] AS [Ints2], [r6].[Name] AS [Name2], [r6].[String] AS [String2] + FROM [RelatedCollection] AS [r4] + LEFT JOIN [RelatedCollection_OptionalNested] AS [r5] ON [r4].[RootEntityId] = [r5].[AssociateTypeRootEntityId] AND [r4].[Id] = [r5].[AssociateTypeId] + LEFT JOIN [RelatedCollection_RequiredNested] AS [r6] ON [r4].[RootEntityId] = [r6].[AssociateTypeRootEntityId] AND [r4].[Id] = [r6].[AssociateTypeId] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r7] ON [r4].[RootEntityId] = [r7].[AssociateTypeRootEntityId] AND [r4].[Id] = [r7].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o2] ON [o].[RootEntityId] = [o2].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r8] ON [r1].[RootEntityId] = [r8].[AssociateTypeRootEntityId] +WHERE ( + SELECT [r0].[Int] + FROM [RelatedCollection] AS [r0] + WHERE [r].[Id] = [r0].[RootEntityId] + ORDER BY [r0].[Id] + OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY) = 8 +ORDER BY [r].[Id], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r1].[RootEntityId], [r2].[AssociateTypeRootEntityId], [r3].[AssociateTypeRootEntityId], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1], [s].[Id0], [o2].[AssociateTypeRootEntityId], [o2].[Id], [r8].[AssociateTypeRootEntityId] +"""); + } + + #region Distinct + + public override async Task Distinct() + { + await base.Distinct(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r2].[RootEntityId], [r3].[AssociateTypeRootEntityId], [r4].[AssociateTypeRootEntityId], [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], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [o2].[AssociateTypeRootEntityId], [o2].[Id], [o2].[Int], [o2].[Ints], [o2].[Name], [o2].[String], [o0].[Id], [o0].[Int], [o0].[Ints], [o0].[Name], [o0].[String], [o1].[Id], [o1].[Int], [o1].[Ints], [o1].[Name], [o1].[String], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r9].[AssociateTypeRootEntityId], [r9].[Id], [r9].[Int], [r9].[Ints], [r9].[Name], [r9].[String], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r4].[Id], [r4].[Int], [r4].[Ints], [r4].[Name], [r4].[String] +FROM [RootEntity] AS [r] +LEFT JOIN [OptionalRelated] AS [o] ON [r].[Id] = [o].[RootEntityId] +LEFT JOIN [OptionalRelated_OptionalNested] AS [o0] ON [o].[RootEntityId] = [o0].[AssociateTypeRootEntityId] +LEFT JOIN [OptionalRelated_RequiredNested] AS [o1] ON [o].[RootEntityId] = [o1].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated] AS [r2] ON [r].[Id] = [r2].[RootEntityId] +LEFT JOIN [RequiredRelated_OptionalNested] AS [r3] ON [r2].[RootEntityId] = [r3].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_RequiredNested] AS [r4] ON [r2].[RootEntityId] = [r4].[AssociateTypeRootEntityId] +LEFT JOIN ( + SELECT [r5].[RootEntityId], [r5].[Id], [r5].[Int], [r5].[Ints], [r5].[Name], [r5].[String], [r6].[AssociateTypeRootEntityId], [r6].[AssociateTypeId], [r7].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId0], [r7].[AssociateTypeId] AS [AssociateTypeId0], [r8].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId1], [r8].[AssociateTypeId] AS [AssociateTypeId1], [r8].[Id] AS [Id0], [r8].[Int] AS [Int0], [r8].[Ints] AS [Ints0], [r8].[Name] AS [Name0], [r8].[String] AS [String0], [r6].[Id] AS [Id1], [r6].[Int] AS [Int1], [r6].[Ints] AS [Ints1], [r6].[Name] AS [Name1], [r6].[String] AS [String1], [r7].[Id] AS [Id2], [r7].[Int] AS [Int2], [r7].[Ints] AS [Ints2], [r7].[Name] AS [Name2], [r7].[String] AS [String2] + FROM [RelatedCollection] AS [r5] + LEFT JOIN [RelatedCollection_OptionalNested] AS [r6] ON [r5].[RootEntityId] = [r6].[AssociateTypeRootEntityId] AND [r5].[Id] = [r6].[AssociateTypeId] + LEFT JOIN [RelatedCollection_RequiredNested] AS [r7] ON [r5].[RootEntityId] = [r7].[AssociateTypeRootEntityId] AND [r5].[Id] = [r7].[AssociateTypeId] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r8] ON [r5].[RootEntityId] = [r8].[AssociateTypeRootEntityId] AND [r5].[Id] = [r8].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o2] ON [o].[RootEntityId] = [o2].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r9] ON [r2].[RootEntityId] = [r9].[AssociateTypeRootEntityId] +WHERE ( + SELECT COUNT(*) + FROM ( + SELECT DISTINCT [r0].[RootEntityId], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String] + FROM [RelatedCollection] AS [r0] + WHERE [r].[Id] = [r0].[RootEntityId] + ) AS [r1]) = 2 +ORDER BY [r].[Id], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r2].[RootEntityId], [r3].[AssociateTypeRootEntityId], [r4].[AssociateTypeRootEntityId], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1], [s].[Id0], [o2].[AssociateTypeRootEntityId], [o2].[Id], [r9].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Distinct_projected(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Distinct_projected(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +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].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[Id00], [s].[Int00], [s].[Ints00], [s].[Name00], [s].[String00], [s].[AssociateTypeRootEntityId00], [s].[AssociateTypeId00], [s].[Id1], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT [r1].[RootEntityId], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r4].[AssociateTypeRootEntityId], [r4].[AssociateTypeId], [r4].[Id] AS [Id0], [r4].[Int] AS [Int0], [r4].[Ints] AS [Ints0], [r4].[Name] AS [Name0], [r4].[String] AS [String0], [r1].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId0], [r1].[AssociateTypeId] AS [AssociateTypeId0], [r1].[Id0] AS [Id00], [r1].[Int0] AS [Int00], [r1].[Ints0] AS [Ints00], [r1].[Name0] AS [Name00], [r1].[String0] AS [String00], [r1].[AssociateTypeRootEntityId0] AS [AssociateTypeRootEntityId00], [r1].[AssociateTypeId0] AS [AssociateTypeId00], [r1].[Id1], [r1].[Int1], [r1].[Ints1], [r1].[Name1], [r1].[String1] + FROM ( + SELECT DISTINCT [r0].[RootEntityId], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r2].[AssociateTypeRootEntityId], [r2].[AssociateTypeId], [r2].[Id] AS [Id0], [r2].[Int] AS [Int0], [r2].[Ints] AS [Ints0], [r2].[Name] AS [Name0], [r2].[String] AS [String0], [r3].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId0], [r3].[AssociateTypeId] AS [AssociateTypeId0], [r3].[Id] AS [Id1], [r3].[Int] AS [Int1], [r3].[Ints] AS [Ints1], [r3].[Name] AS [Name1], [r3].[String] AS [String1] + FROM [RelatedCollection] AS [r0] + LEFT JOIN [RelatedCollection_OptionalNested] AS [r2] ON [r0].[RootEntityId] = [r2].[AssociateTypeRootEntityId] AND [r0].[Id] = [r2].[AssociateTypeId] + LEFT JOIN [RelatedCollection_RequiredNested] AS [r3] ON [r0].[RootEntityId] = [r3].[AssociateTypeRootEntityId] AND [r0].[Id] = [r3].[AssociateTypeId] + WHERE [r].[Id] = [r0].[RootEntityId] + ) AS [r1] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r4] ON [r1].[RootEntityId] = [r4].[AssociateTypeRootEntityId] AND [r1].[Id] = [r4].[AssociateTypeId] +) AS [s] +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId] +"""); + } + } + + public override async Task Distinct_over_projected_nested_collection() + { + await base.Distinct_over_projected_nested_collection(); + + AssertSql(); + } + + public override async Task Distinct_over_projected_filtered_nested_collection() + { + await base.Distinct_over_projected_filtered_nested_collection(); + + AssertSql(); + } + + #endregion Distinct + + #region Index + + public override async Task Index_constant() + { + await base.Index_constant(); + + AssertSql(); + } + + public override async Task Index_parameter() + { + await base.Index_parameter(); + + AssertSql(); + } + + public override async Task Index_column() + { + await base.Index_column(); + + AssertSql(); + } + + public override async Task Index_out_of_bounds() + { + await base.Index_out_of_bounds(); + + AssertSql(); + } + + #endregion Index + + #region GroupBy + + [ConditionalFact] + public override async Task GroupBy() + { + await base.GroupBy(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r1`.`RootEntityId`, `r2`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeRootEntityId`, `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`, `o`.`Id`, `o`.`Int`, `o`.`Ints`, `o`.`Name`, `o`.`String`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `o2`.`Int`, `o2`.`Ints`, `o2`.`Name`, `o2`.`String`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String`, `o1`.`Id`, `o1`.`Int`, `o1`.`Ints`, `o1`.`Name`, `o1`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r8`.`AssociateTypeRootEntityId`, `r8`.`Id`, `r8`.`Int`, `r8`.`Ints`, `r8`.`Name`, `r8`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o1` ON `o`.`RootEntityId` = `o1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated` AS `r1` ON `r`.`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 ( + SELECT `r4`.`RootEntityId`, `r4`.`Id`, `r4`.`Int`, `r4`.`Ints`, `r4`.`Name`, `r4`.`String`, `r5`.`AssociateTypeRootEntityId`, `r5`.`AssociateTypeId`, `r6`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r6`.`AssociateTypeId` AS `AssociateTypeId0`, `r7`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r7`.`AssociateTypeId` AS `AssociateTypeId1`, `r7`.`Id` AS `Id0`, `r7`.`Int` AS `Int0`, `r7`.`Ints` AS `Ints0`, `r7`.`Name` AS `Name0`, `r7`.`String` AS `String0`, `r5`.`Id` AS `Id1`, `r5`.`Int` AS `Int1`, `r5`.`Ints` AS `Ints1`, `r5`.`Name` AS `Name1`, `r5`.`String` AS `String1`, `r6`.`Id` AS `Id2`, `r6`.`Int` AS `Int2`, `r6`.`Ints` AS `Ints2`, `r6`.`Name` AS `Name2`, `r6`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r4` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r5` ON `r4`.`RootEntityId` = `r5`.`AssociateTypeRootEntityId` AND `r4`.`Id` = `r5`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r6` ON `r4`.`RootEntityId` = `r6`.`AssociateTypeRootEntityId` AND `r4`.`Id` = `r6`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r7` ON `r4`.`RootEntityId` = `r7`.`AssociateTypeRootEntityId` AND `r4`.`Id` = `r7`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o2` ON `o`.`RootEntityId` = `o2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r8` ON `r1`.`RootEntityId` = `r8`.`AssociateTypeRootEntityId` +WHERE 16 IN ( + SELECT IIF(SUM(`r0`.`Int`) IS NULL, 0, SUM(`r0`.`Int`)) + FROM `RelatedCollection` AS `r0` + WHERE `r`.`Id` = `r0`.`RootEntityId` + GROUP BY `r0`.`String` +) +ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r1`.`RootEntityId`, `r2`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r8`.`AssociateTypeRootEntityId` +"""); + } + + #endregion GroupBy + + public override async Task Select_within_Select_within_Select_with_aggregates() + { + await base.Select_within_Select_within_Select_with_aggregates(); + + AssertSql( + """ +SELECT ( + SELECT IIF(SUM(( + SELECT MAX(`r1`.`Int`) + FROM `RelatedCollection_NestedCollection` AS `r1` + WHERE `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId` AND `r0`.`Id` = `r1`.`AssociateTypeId`)) IS NULL, 0, SUM(( + SELECT MAX(`r1`.`Int`) + FROM `RelatedCollection_NestedCollection` AS `r1` + WHERE `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId` AND `r0`.`Id` = `r1`.`AssociateTypeId`))) + FROM `RelatedCollection` AS `r0` + WHERE `r`.`Id` = `r0`.`RootEntityId`) +FROM `RootEntity` AS `r` +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsJetFixture.cs new file mode 100644 index 00000000..24d8a463 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsJetFixture.cs @@ -0,0 +1,11 @@ +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedNavigations; +using Microsoft.EntityFrameworkCore.TestUtilities; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations; + +public class OwnedNavigationsJetFixture : OwnedNavigationsRelationalFixtureBase +{ + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsMiscellaneousJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsMiscellaneousJetTest.cs new file mode 100644 index 00000000..8e93c52c --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsMiscellaneousJetTest.cs @@ -0,0 +1,105 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedNavigations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations; + +public class OwnedNavigationsMiscellaneousJetTest( + OwnedNavigationsJetFixture fixture, + ITestOutputHelper testOutputHelper) + : OwnedNavigationsMiscellaneousRelationalTestBase(fixture, testOutputHelper) +{ + #region Simple filters + + public override async Task Where_on_associate_scalar_property() + { + await base.Where_on_associate_scalar_property(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r0`.`RootEntityId`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `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`, `o`.`Id`, `o`.`Int`, `o`.`Ints`, `o`.`Name`, `o`.`String`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `o2`.`Int`, `o2`.`Ints`, `o2`.`Name`, `o2`.`String`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String`, `o1`.`Id`, `o1`.`Int`, `o1`.`Ints`, `o1`.`Name`, `o1`.`String`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r7`.`AssociateTypeRootEntityId`, `r7`.`Id`, `r7`.`Int`, `r7`.`Ints`, `r7`.`Name`, `r7`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o1` ON `o`.`RootEntityId` = `o1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_OptionalNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_RequiredNested` AS `r2` ON `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId`) +LEFT JOIN ( + SELECT `r3`.`RootEntityId`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String`, `r4`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeId`, `r5`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r5`.`AssociateTypeId` AS `AssociateTypeId0`, `r6`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r6`.`AssociateTypeId` AS `AssociateTypeId1`, `r6`.`Id` AS `Id0`, `r6`.`Int` AS `Int0`, `r6`.`Ints` AS `Ints0`, `r6`.`Name` AS `Name0`, `r6`.`String` AS `String0`, `r4`.`Id` AS `Id1`, `r4`.`Int` AS `Int1`, `r4`.`Ints` AS `Ints1`, `r4`.`Name` AS `Name1`, `r4`.`String` AS `String1`, `r5`.`Id` AS `Id2`, `r5`.`Int` AS `Int2`, `r5`.`Ints` AS `Ints2`, `r5`.`Name` AS `Name2`, `r5`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r3` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r4` ON `r3`.`RootEntityId` = `r4`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r4`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r5` ON `r3`.`RootEntityId` = `r5`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r5`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r6` ON `r3`.`RootEntityId` = `r6`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r6`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o2` ON `o`.`RootEntityId` = `o2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r7` ON `r0`.`RootEntityId` = `r7`.`AssociateTypeRootEntityId` +WHERE `r0`.`Int` = 8 +ORDER BY `r`.`Id`, `r0`.`RootEntityId`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r7`.`AssociateTypeRootEntityId` +"""); + } + + public override async Task Where_on_optional_associate_scalar_property() + { + await base.Where_on_optional_associate_scalar_property(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `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`, `o`.`Id`, `o`.`Int`, `o`.`Ints`, `o`.`Name`, `o`.`String`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `o2`.`Int`, `o2`.`Ints`, `o2`.`Name`, `o2`.`String`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String`, `o1`.`Id`, `o1`.`Int`, `o1`.`Ints`, `o1`.`Name`, `o1`.`String`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r7`.`AssociateTypeRootEntityId`, `r7`.`Id`, `r7`.`Int`, `r7`.`Ints`, `r7`.`Name`, `r7`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o1` ON `o`.`RootEntityId` = `o1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RequiredRelated_OptionalNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_RequiredNested` AS `r2` ON `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId`) +LEFT JOIN ( + SELECT `r3`.`RootEntityId`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String`, `r4`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeId`, `r5`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r5`.`AssociateTypeId` AS `AssociateTypeId0`, `r6`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r6`.`AssociateTypeId` AS `AssociateTypeId1`, `r6`.`Id` AS `Id0`, `r6`.`Int` AS `Int0`, `r6`.`Ints` AS `Ints0`, `r6`.`Name` AS `Name0`, `r6`.`String` AS `String0`, `r4`.`Id` AS `Id1`, `r4`.`Int` AS `Int1`, `r4`.`Ints` AS `Ints1`, `r4`.`Name` AS `Name1`, `r4`.`String` AS `String1`, `r5`.`Id` AS `Id2`, `r5`.`Int` AS `Int2`, `r5`.`Ints` AS `Ints2`, `r5`.`Name` AS `Name2`, `r5`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r3` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r4` ON `r3`.`RootEntityId` = `r4`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r4`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r5` ON `r3`.`RootEntityId` = `r5`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r5`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r6` ON `r3`.`RootEntityId` = `r6`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r6`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o2` ON `o`.`RootEntityId` = `o2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r7` ON `r0`.`RootEntityId` = `r7`.`AssociateTypeRootEntityId` +WHERE `o`.`Int` = 8 +ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r7`.`AssociateTypeRootEntityId` +"""); + } + + public override async Task Where_on_nested_associate_scalar_property() + { + await base.Where_on_nested_associate_scalar_property(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `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`, `o`.`Id`, `o`.`Int`, `o`.`Ints`, `o`.`Name`, `o`.`String`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `o2`.`Int`, `o2`.`Ints`, `o2`.`Name`, `o2`.`String`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String`, `o1`.`Id`, `o1`.`Int`, `o1`.`Ints`, `o1`.`Name`, `o1`.`String`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r7`.`AssociateTypeRootEntityId`, `r7`.`Id`, `r7`.`Int`, `r7`.`Ints`, `r7`.`Name`, `r7`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RequiredRelated_RequiredNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o1` ON `o`.`RootEntityId` = `o1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_OptionalNested` AS `r2` ON `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId`) +LEFT JOIN ( + SELECT `r3`.`RootEntityId`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String`, `r4`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeId`, `r5`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r5`.`AssociateTypeId` AS `AssociateTypeId0`, `r6`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r6`.`AssociateTypeId` AS `AssociateTypeId1`, `r6`.`Id` AS `Id0`, `r6`.`Int` AS `Int0`, `r6`.`Ints` AS `Ints0`, `r6`.`Name` AS `Name0`, `r6`.`String` AS `String0`, `r4`.`Id` AS `Id1`, `r4`.`Int` AS `Int1`, `r4`.`Ints` AS `Ints1`, `r4`.`Name` AS `Name1`, `r4`.`String` AS `String1`, `r5`.`Id` AS `Id2`, `r5`.`Int` AS `Int2`, `r5`.`Ints` AS `Ints2`, `r5`.`Name` AS `Name2`, `r5`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r3` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r4` ON `r3`.`RootEntityId` = `r4`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r4`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r5` ON `r3`.`RootEntityId` = `r5`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r5`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r6` ON `r3`.`RootEntityId` = `r6`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r6`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o2` ON `o`.`RootEntityId` = `o2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r7` ON `r0`.`RootEntityId` = `r7`.`AssociateTypeRootEntityId` +WHERE `r1`.`Int` = 8 +ORDER BY `r`.`Id`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r7`.`AssociateTypeRootEntityId` +"""); + } + + #endregion Simple filters + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsPrimitiveCollectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsPrimitiveCollectionJetTest.cs new file mode 100644 index 00000000..650032a9 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsPrimitiveCollectionJetTest.cs @@ -0,0 +1,182 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedNavigations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations; + +public class OwnedNavigationsPrimitiveCollectionJetTest(OwnedNavigationsJetFixture fixture, ITestOutputHelper testOutputHelper) + : OwnedNavigationsPrimitiveCollectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Count() + { + await base.Count(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r0].[RootEntityId], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r1].[AssociateTypeRootEntityId], [r2].[AssociateTypeRootEntityId], [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], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [o2].[AssociateTypeRootEntityId], [o2].[Id], [o2].[Int], [o2].[Ints], [o2].[Name], [o2].[String], [o0].[Id], [o0].[Int], [o0].[Ints], [o0].[Name], [o0].[String], [o1].[Id], [o1].[Int], [o1].[Ints], [o1].[Name], [o1].[String], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r7].[AssociateTypeRootEntityId], [r7].[Id], [r7].[Int], [r7].[Ints], [r7].[Name], [r7].[String], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String] +FROM [RootEntity] AS [r] +LEFT JOIN [RequiredRelated] AS [r0] ON [r].[Id] = [r0].[RootEntityId] +LEFT JOIN [OptionalRelated] AS [o] ON [r].[Id] = [o].[RootEntityId] +LEFT JOIN [OptionalRelated_OptionalNested] AS [o0] ON [o].[RootEntityId] = [o0].[AssociateTypeRootEntityId] +LEFT JOIN [OptionalRelated_RequiredNested] AS [o1] ON [o].[RootEntityId] = [o1].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_OptionalNested] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_RequiredNested] AS [r2] ON [r0].[RootEntityId] = [r2].[AssociateTypeRootEntityId] +LEFT JOIN ( + SELECT [r3].[RootEntityId], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r4].[AssociateTypeRootEntityId], [r4].[AssociateTypeId], [r5].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId0], [r5].[AssociateTypeId] AS [AssociateTypeId0], [r6].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId1], [r6].[AssociateTypeId] AS [AssociateTypeId1], [r6].[Id] AS [Id0], [r6].[Int] AS [Int0], [r6].[Ints] AS [Ints0], [r6].[Name] AS [Name0], [r6].[String] AS [String0], [r4].[Id] AS [Id1], [r4].[Int] AS [Int1], [r4].[Ints] AS [Ints1], [r4].[Name] AS [Name1], [r4].[String] AS [String1], [r5].[Id] AS [Id2], [r5].[Int] AS [Int2], [r5].[Ints] AS [Ints2], [r5].[Name] AS [Name2], [r5].[String] AS [String2] + FROM [RelatedCollection] AS [r3] + LEFT JOIN [RelatedCollection_OptionalNested] AS [r4] ON [r3].[RootEntityId] = [r4].[AssociateTypeRootEntityId] AND [r3].[Id] = [r4].[AssociateTypeId] + LEFT JOIN [RelatedCollection_RequiredNested] AS [r5] ON [r3].[RootEntityId] = [r5].[AssociateTypeRootEntityId] AND [r3].[Id] = [r5].[AssociateTypeId] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r6] ON [r3].[RootEntityId] = [r6].[AssociateTypeRootEntityId] AND [r3].[Id] = [r6].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o2] ON [o].[RootEntityId] = [o2].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r7] ON [r0].[RootEntityId] = [r7].[AssociateTypeRootEntityId] +WHERE ( + SELECT COUNT(*) + FROM OPENJSON([r0].[Ints]) AS [i]) = 3 +ORDER BY [r].[Id], [r0].[RootEntityId], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r1].[AssociateTypeRootEntityId], [r2].[AssociateTypeRootEntityId], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1], [s].[Id0], [o2].[AssociateTypeRootEntityId], [o2].[Id], [r7].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Index() + { + await base.Index(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r0].[RootEntityId], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r1].[AssociateTypeRootEntityId], [r2].[AssociateTypeRootEntityId], [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], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [o2].[AssociateTypeRootEntityId], [o2].[Id], [o2].[Int], [o2].[Ints], [o2].[Name], [o2].[String], [o0].[Id], [o0].[Int], [o0].[Ints], [o0].[Name], [o0].[String], [o1].[Id], [o1].[Int], [o1].[Ints], [o1].[Name], [o1].[String], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r7].[AssociateTypeRootEntityId], [r7].[Id], [r7].[Int], [r7].[Ints], [r7].[Name], [r7].[String], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String] +FROM [RootEntity] AS [r] +LEFT JOIN [RequiredRelated] AS [r0] ON [r].[Id] = [r0].[RootEntityId] +LEFT JOIN [OptionalRelated] AS [o] ON [r].[Id] = [o].[RootEntityId] +LEFT JOIN [OptionalRelated_OptionalNested] AS [o0] ON [o].[RootEntityId] = [o0].[AssociateTypeRootEntityId] +LEFT JOIN [OptionalRelated_RequiredNested] AS [o1] ON [o].[RootEntityId] = [o1].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_OptionalNested] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_RequiredNested] AS [r2] ON [r0].[RootEntityId] = [r2].[AssociateTypeRootEntityId] +LEFT JOIN ( + SELECT [r3].[RootEntityId], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r4].[AssociateTypeRootEntityId], [r4].[AssociateTypeId], [r5].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId0], [r5].[AssociateTypeId] AS [AssociateTypeId0], [r6].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId1], [r6].[AssociateTypeId] AS [AssociateTypeId1], [r6].[Id] AS [Id0], [r6].[Int] AS [Int0], [r6].[Ints] AS [Ints0], [r6].[Name] AS [Name0], [r6].[String] AS [String0], [r4].[Id] AS [Id1], [r4].[Int] AS [Int1], [r4].[Ints] AS [Ints1], [r4].[Name] AS [Name1], [r4].[String] AS [String1], [r5].[Id] AS [Id2], [r5].[Int] AS [Int2], [r5].[Ints] AS [Ints2], [r5].[Name] AS [Name2], [r5].[String] AS [String2] + FROM [RelatedCollection] AS [r3] + LEFT JOIN [RelatedCollection_OptionalNested] AS [r4] ON [r3].[RootEntityId] = [r4].[AssociateTypeRootEntityId] AND [r3].[Id] = [r4].[AssociateTypeId] + LEFT JOIN [RelatedCollection_RequiredNested] AS [r5] ON [r3].[RootEntityId] = [r5].[AssociateTypeRootEntityId] AND [r3].[Id] = [r5].[AssociateTypeId] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r6] ON [r3].[RootEntityId] = [r6].[AssociateTypeRootEntityId] AND [r3].[Id] = [r6].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o2] ON [o].[RootEntityId] = [o2].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r7] ON [r0].[RootEntityId] = [r7].[AssociateTypeRootEntityId] +WHERE CAST(JSON_VALUE([r0].[Ints], '$[0]') AS int) = 1 +ORDER BY [r].[Id], [r0].[RootEntityId], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r1].[AssociateTypeRootEntityId], [r2].[AssociateTypeRootEntityId], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1], [s].[Id0], [o2].[AssociateTypeRootEntityId], [o2].[Id], [r7].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Contains() + { + await base.Contains(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r0].[RootEntityId], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r1].[AssociateTypeRootEntityId], [r2].[AssociateTypeRootEntityId], [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], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [o2].[AssociateTypeRootEntityId], [o2].[Id], [o2].[Int], [o2].[Ints], [o2].[Name], [o2].[String], [o0].[Id], [o0].[Int], [o0].[Ints], [o0].[Name], [o0].[String], [o1].[Id], [o1].[Int], [o1].[Ints], [o1].[Name], [o1].[String], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r7].[AssociateTypeRootEntityId], [r7].[Id], [r7].[Int], [r7].[Ints], [r7].[Name], [r7].[String], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String] +FROM [RootEntity] AS [r] +LEFT JOIN [RequiredRelated] AS [r0] ON [r].[Id] = [r0].[RootEntityId] +LEFT JOIN [OptionalRelated] AS [o] ON [r].[Id] = [o].[RootEntityId] +LEFT JOIN [OptionalRelated_OptionalNested] AS [o0] ON [o].[RootEntityId] = [o0].[AssociateTypeRootEntityId] +LEFT JOIN [OptionalRelated_RequiredNested] AS [o1] ON [o].[RootEntityId] = [o1].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_OptionalNested] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_RequiredNested] AS [r2] ON [r0].[RootEntityId] = [r2].[AssociateTypeRootEntityId] +LEFT JOIN ( + SELECT [r3].[RootEntityId], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r4].[AssociateTypeRootEntityId], [r4].[AssociateTypeId], [r5].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId0], [r5].[AssociateTypeId] AS [AssociateTypeId0], [r6].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId1], [r6].[AssociateTypeId] AS [AssociateTypeId1], [r6].[Id] AS [Id0], [r6].[Int] AS [Int0], [r6].[Ints] AS [Ints0], [r6].[Name] AS [Name0], [r6].[String] AS [String0], [r4].[Id] AS [Id1], [r4].[Int] AS [Int1], [r4].[Ints] AS [Ints1], [r4].[Name] AS [Name1], [r4].[String] AS [String1], [r5].[Id] AS [Id2], [r5].[Int] AS [Int2], [r5].[Ints] AS [Ints2], [r5].[Name] AS [Name2], [r5].[String] AS [String2] + FROM [RelatedCollection] AS [r3] + LEFT JOIN [RelatedCollection_OptionalNested] AS [r4] ON [r3].[RootEntityId] = [r4].[AssociateTypeRootEntityId] AND [r3].[Id] = [r4].[AssociateTypeId] + LEFT JOIN [RelatedCollection_RequiredNested] AS [r5] ON [r3].[RootEntityId] = [r5].[AssociateTypeRootEntityId] AND [r3].[Id] = [r5].[AssociateTypeId] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r6] ON [r3].[RootEntityId] = [r6].[AssociateTypeRootEntityId] AND [r3].[Id] = [r6].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o2] ON [o].[RootEntityId] = [o2].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r7] ON [r0].[RootEntityId] = [r7].[AssociateTypeRootEntityId] +WHERE 3 IN ( + SELECT [i].[value] + FROM OPENJSON([r0].[Ints]) WITH ([value] int '$') AS [i] +) +ORDER BY [r].[Id], [r0].[RootEntityId], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r1].[AssociateTypeRootEntityId], [r2].[AssociateTypeRootEntityId], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1], [s].[Id0], [o2].[AssociateTypeRootEntityId], [o2].[Id], [r7].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Any_predicate() + { + await base.Any_predicate(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r0].[RootEntityId], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r1].[AssociateTypeRootEntityId], [r2].[AssociateTypeRootEntityId], [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], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [o2].[AssociateTypeRootEntityId], [o2].[Id], [o2].[Int], [o2].[Ints], [o2].[Name], [o2].[String], [o0].[Id], [o0].[Int], [o0].[Ints], [o0].[Name], [o0].[String], [o1].[Id], [o1].[Int], [o1].[Ints], [o1].[Name], [o1].[String], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r7].[AssociateTypeRootEntityId], [r7].[Id], [r7].[Int], [r7].[Ints], [r7].[Name], [r7].[String], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String] +FROM [RootEntity] AS [r] +LEFT JOIN [RequiredRelated] AS [r0] ON [r].[Id] = [r0].[RootEntityId] +LEFT JOIN [OptionalRelated] AS [o] ON [r].[Id] = [o].[RootEntityId] +LEFT JOIN [OptionalRelated_OptionalNested] AS [o0] ON [o].[RootEntityId] = [o0].[AssociateTypeRootEntityId] +LEFT JOIN [OptionalRelated_RequiredNested] AS [o1] ON [o].[RootEntityId] = [o1].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_OptionalNested] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_RequiredNested] AS [r2] ON [r0].[RootEntityId] = [r2].[AssociateTypeRootEntityId] +LEFT JOIN ( + SELECT [r3].[RootEntityId], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r4].[AssociateTypeRootEntityId], [r4].[AssociateTypeId], [r5].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId0], [r5].[AssociateTypeId] AS [AssociateTypeId0], [r6].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId1], [r6].[AssociateTypeId] AS [AssociateTypeId1], [r6].[Id] AS [Id0], [r6].[Int] AS [Int0], [r6].[Ints] AS [Ints0], [r6].[Name] AS [Name0], [r6].[String] AS [String0], [r4].[Id] AS [Id1], [r4].[Int] AS [Int1], [r4].[Ints] AS [Ints1], [r4].[Name] AS [Name1], [r4].[String] AS [String1], [r5].[Id] AS [Id2], [r5].[Int] AS [Int2], [r5].[Ints] AS [Ints2], [r5].[Name] AS [Name2], [r5].[String] AS [String2] + FROM [RelatedCollection] AS [r3] + LEFT JOIN [RelatedCollection_OptionalNested] AS [r4] ON [r3].[RootEntityId] = [r4].[AssociateTypeRootEntityId] AND [r3].[Id] = [r4].[AssociateTypeId] + LEFT JOIN [RelatedCollection_RequiredNested] AS [r5] ON [r3].[RootEntityId] = [r5].[AssociateTypeRootEntityId] AND [r3].[Id] = [r5].[AssociateTypeId] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r6] ON [r3].[RootEntityId] = [r6].[AssociateTypeRootEntityId] AND [r3].[Id] = [r6].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o2] ON [o].[RootEntityId] = [o2].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r7] ON [r0].[RootEntityId] = [r7].[AssociateTypeRootEntityId] +WHERE 2 IN ( + SELECT [i].[value] + FROM OPENJSON([r0].[Ints]) WITH ([value] int '$') AS [i] +) +ORDER BY [r].[Id], [r0].[RootEntityId], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r1].[AssociateTypeRootEntityId], [r2].[AssociateTypeRootEntityId], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1], [s].[Id0], [o2].[AssociateTypeRootEntityId], [o2].[Id], [r7].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Nested_Count() + { + await base.Nested_Count(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r0].[RootEntityId], [r1].[AssociateTypeRootEntityId], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r2].[AssociateTypeRootEntityId], [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], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [o2].[AssociateTypeRootEntityId], [o2].[Id], [o2].[Int], [o2].[Ints], [o2].[Name], [o2].[String], [o0].[Id], [o0].[Int], [o0].[Ints], [o0].[Name], [o0].[String], [o1].[Id], [o1].[Int], [o1].[Ints], [o1].[Name], [o1].[String], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r7].[AssociateTypeRootEntityId], [r7].[Id], [r7].[Int], [r7].[Ints], [r7].[Name], [r7].[String], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String] +FROM [RootEntity] AS [r] +LEFT JOIN [RequiredRelated] AS [r0] ON [r].[Id] = [r0].[RootEntityId] +LEFT JOIN [RequiredRelated_RequiredNested] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] +LEFT JOIN [OptionalRelated] AS [o] ON [r].[Id] = [o].[RootEntityId] +LEFT JOIN [OptionalRelated_OptionalNested] AS [o0] ON [o].[RootEntityId] = [o0].[AssociateTypeRootEntityId] +LEFT JOIN [OptionalRelated_RequiredNested] AS [o1] ON [o].[RootEntityId] = [o1].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_OptionalNested] AS [r2] ON [r0].[RootEntityId] = [r2].[AssociateTypeRootEntityId] +LEFT JOIN ( + SELECT [r3].[RootEntityId], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r4].[AssociateTypeRootEntityId], [r4].[AssociateTypeId], [r5].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId0], [r5].[AssociateTypeId] AS [AssociateTypeId0], [r6].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId1], [r6].[AssociateTypeId] AS [AssociateTypeId1], [r6].[Id] AS [Id0], [r6].[Int] AS [Int0], [r6].[Ints] AS [Ints0], [r6].[Name] AS [Name0], [r6].[String] AS [String0], [r4].[Id] AS [Id1], [r4].[Int] AS [Int1], [r4].[Ints] AS [Ints1], [r4].[Name] AS [Name1], [r4].[String] AS [String1], [r5].[Id] AS [Id2], [r5].[Int] AS [Int2], [r5].[Ints] AS [Ints2], [r5].[Name] AS [Name2], [r5].[String] AS [String2] + FROM [RelatedCollection] AS [r3] + LEFT JOIN [RelatedCollection_OptionalNested] AS [r4] ON [r3].[RootEntityId] = [r4].[AssociateTypeRootEntityId] AND [r3].[Id] = [r4].[AssociateTypeId] + LEFT JOIN [RelatedCollection_RequiredNested] AS [r5] ON [r3].[RootEntityId] = [r5].[AssociateTypeRootEntityId] AND [r3].[Id] = [r5].[AssociateTypeId] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r6] ON [r3].[RootEntityId] = [r6].[AssociateTypeRootEntityId] AND [r3].[Id] = [r6].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o2] ON [o].[RootEntityId] = [o2].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r7] ON [r0].[RootEntityId] = [r7].[AssociateTypeRootEntityId] +WHERE ( + SELECT COUNT(*) + FROM OPENJSON([r1].[Ints]) AS [i]) = 3 +ORDER BY [r].[Id], [r0].[RootEntityId], [r1].[AssociateTypeRootEntityId], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r2].[AssociateTypeRootEntityId], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1], [s].[Id0], [o2].[AssociateTypeRootEntityId], [o2].[Id], [r7].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Select_Sum() + { + await base.Select_Sum(); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(SUM([i0].[value]), 0) + FROM OPENJSON([r0].[Ints]) WITH ([value] int '$') AS [i0]) +FROM [RootEntity] AS [r] +LEFT JOIN [RequiredRelated] AS [r0] ON [r].[Id] = [r0].[RootEntityId] +WHERE ( + SELECT COALESCE(SUM([i].[value]), 0) + FROM OPENJSON([r0].[Ints]) WITH ([value] int '$') AS [i]) >= 6 +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionJetTest.cs new file mode 100644 index 00000000..5be4a352 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionJetTest.cs @@ -0,0 +1,451 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedNavigations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations; + +public class OwnedNavigationsProjectionJetTest(OwnedNavigationsJetFixture fixture, ITestOutputHelper testOutputHelper) + : OwnedNavigationsProjectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `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`, `o`.`Id`, `o`.`Int`, `o`.`Ints`, `o`.`Name`, `o`.`String`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `o2`.`Int`, `o2`.`Ints`, `o2`.`Name`, `o2`.`String`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String`, `o1`.`Id`, `o1`.`Int`, `o1`.`Ints`, `o1`.`Name`, `o1`.`String`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r7`.`AssociateTypeRootEntityId`, `r7`.`Id`, `r7`.`Int`, `r7`.`Ints`, `r7`.`Name`, `r7`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o1` ON `o`.`RootEntityId` = `o1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RequiredRelated_OptionalNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_RequiredNested` AS `r2` ON `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId`) +LEFT JOIN ( + SELECT `r3`.`RootEntityId`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String`, `r4`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeId`, `r5`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r5`.`AssociateTypeId` AS `AssociateTypeId0`, `r6`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r6`.`AssociateTypeId` AS `AssociateTypeId1`, `r6`.`Id` AS `Id0`, `r6`.`Int` AS `Int0`, `r6`.`Ints` AS `Ints0`, `r6`.`Name` AS `Name0`, `r6`.`String` AS `String0`, `r4`.`Id` AS `Id1`, `r4`.`Int` AS `Int1`, `r4`.`Ints` AS `Ints1`, `r4`.`Name` AS `Name1`, `r4`.`String` AS `String1`, `r5`.`Id` AS `Id2`, `r5`.`Int` AS `Int2`, `r5`.`Ints` AS `Ints2`, `r5`.`Name` AS `Name2`, `r5`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r3` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r4` ON `r3`.`RootEntityId` = `r4`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r4`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r5` ON `r3`.`RootEntityId` = `r5`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r5`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r6` ON `r3`.`RootEntityId` = `r6`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r6`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o2` ON `o`.`RootEntityId` = `o2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r7` ON `r0`.`RootEntityId` = `r7`.`AssociateTypeRootEntityId` +ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r7`.`AssociateTypeRootEntityId` +"""); + } + + #region Scalar properties + + public override async Task Select_scalar_property_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_scalar_property_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r0`.`String` +FROM `RootEntity` AS `r` +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId` +"""); + } + + public override async Task Select_property_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_property_on_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `o`.`String` +FROM `RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId` +"""); + } + + public override async Task Select_value_type_property_on_null_associate_throws(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_value_type_property_on_null_associate_throws(queryTrackingBehavior); + + AssertSql( + """ +SELECT `o`.`Int` +FROM `RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId` +"""); + } + + public override async Task Select_nullable_value_type_property_on_null_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nullable_value_type_property_on_null_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `o`.`Int` +FROM `RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId` +"""); + } + + #endregion Scalar properties + + #region Structural properties + + public override async Task Select_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r0`.`RootEntityId`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r`.`Id`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeRootEntityId`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String` +FROM (((`RootEntity` AS `r` +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RequiredRelated_OptionalNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_RequiredNested` AS `r2` ON `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r3` ON `r0`.`RootEntityId` = `r3`.`AssociateTypeRootEntityId` +ORDER BY `r`.`Id`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeRootEntityId` +"""); + } + } + + public override async Task Select_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `o`.`RootEntityId`, `o`.`Id`, `o`.`Int`, `o`.`Ints`, `o`.`Name`, `o`.`String`, `r`.`Id`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `o2`.`Int`, `o2`.`Ints`, `o2`.`Name`, `o2`.`String`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String`, `o1`.`Id`, `o1`.`Int`, `o1`.`Ints`, `o1`.`Name`, `o1`.`String` +FROM (((`RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o1` ON `o`.`RootEntityId` = `o1`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o2` ON `o`.`RootEntityId` = `o2`.`AssociateTypeRootEntityId` +ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `o2`.`AssociateTypeRootEntityId` +"""); + } + } + + public override async Task Select_required_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_nested_on_required_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r1`.`AssociateTypeRootEntityId`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String` +FROM (`RootEntity` AS `r` +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RequiredRelated_RequiredNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId` +"""); + } + } + + public override async Task Select_optional_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_nested_on_required_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r1`.`AssociateTypeRootEntityId`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String` +FROM (`RootEntity` AS `r` +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RequiredRelated_OptionalNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId` +"""); + } + } + + public override async Task Select_required_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_nested_on_optional_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `o0`.`AssociateTypeRootEntityId`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String` +FROM (`RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId` +"""); + } + } + + public override async Task Select_optional_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_nested_on_optional_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `o0`.`AssociateTypeRootEntityId`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String` +FROM (`RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId` +"""); + } + } + + public override async Task Select_required_associate_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_associate_via_optional_navigation(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + 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` +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` +"""); + } + } + + public override async Task Select_unmapped_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_unmapped_associate_scalar_property(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r0`.`RootEntityId`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r`.`Id`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeRootEntityId`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String` +FROM (((`RootEntity` AS `r` +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RequiredRelated_OptionalNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_RequiredNested` AS `r2` ON `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r3` ON `r0`.`RootEntityId` = `r3`.`AssociateTypeRootEntityId` +ORDER BY `r`.`Id`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeRootEntityId` +"""); + } + } + + public override async Task Select_untranslatable_method_on_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_untranslatable_method_on_associate_scalar_property(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r0`.`Int` +FROM `RootEntity` AS `r` +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId` +"""); + } + + #endregion Structural properties + + #region Structural collection properties + + public override async Task Select_associate_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_associate_collection(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +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` +FROM `RootEntity` AS `r` +LEFT JOIN ( + SELECT `r0`.`RootEntityId`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r1`.`AssociateTypeRootEntityId`, `r1`.`AssociateTypeId`, `r2`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r2`.`AssociateTypeId` AS `AssociateTypeId0`, `r3`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r3`.`AssociateTypeId` AS `AssociateTypeId1`, `r3`.`Id` AS `Id0`, `r3`.`Int` AS `Int0`, `r3`.`Ints` AS `Ints0`, `r3`.`Name` AS `Name0`, `r3`.`String` AS `String0`, `r1`.`Id` AS `Id1`, `r1`.`Int` AS `Int1`, `r1`.`Ints` AS `Ints1`, `r1`.`Name` AS `Name1`, `r1`.`String` AS `String1`, `r2`.`Id` AS `Id2`, `r2`.`Int` AS `Int2`, `r2`.`Ints` AS `Ints2`, `r2`.`Name` AS `Name2`, `r2`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r0` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId` AND `r0`.`Id` = `r1`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r2` ON `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId` AND `r0`.`Id` = `r2`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r3` ON `r0`.`RootEntityId` = `r3`.`AssociateTypeRootEntityId` AND `r0`.`Id` = `r3`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId` +ORDER BY `r`.`Id`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1` +"""); + } + } + + public override async Task Select_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nested_collection_on_required_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r`.`Id`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String` +FROM (`RootEntity` AS `r` +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId` +ORDER BY `r`.`Id`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId` +"""); + } + } + + public override async Task Select_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nested_collection_on_optional_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String` +FROM (`RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId` +ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId` +"""); + } + } + + public override async Task SelectMany_associate_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_associate_collection(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r0`.`RootEntityId`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r`.`Id`, `r1`.`AssociateTypeRootEntityId`, `r1`.`AssociateTypeId`, `r2`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeId`, `r3`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeId`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String` +FROM (((`RootEntity` AS `r` +INNER JOIN `RelatedCollection` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RelatedCollection_OptionalNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId` AND `r0`.`Id` = `r1`.`AssociateTypeId`) +LEFT JOIN `RelatedCollection_RequiredNested` AS `r2` ON `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId` AND `r0`.`Id` = `r2`.`AssociateTypeId`) +LEFT JOIN `RelatedCollection_NestedCollection` AS `r3` ON `r0`.`RootEntityId` = `r3`.`AssociateTypeRootEntityId` AND `r0`.`Id` = `r3`.`AssociateTypeId` +ORDER BY `r`.`Id`, `r0`.`RootEntityId`, `r0`.`Id`, `r1`.`AssociateTypeRootEntityId`, `r1`.`AssociateTypeId`, `r2`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeId`, `r3`.`AssociateTypeRootEntityId`, `r3`.`AssociateTypeId` +"""); + } + } + + public override async Task SelectMany_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_nested_collection_on_required_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r1`.`AssociateTypeRootEntityId`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String` +FROM (`RootEntity` AS `r` +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId` +WHERE `r0`.`RootEntityId` IS NOT NULL AND `r1`.`AssociateTypeRootEntityId` IS NOT NULL +"""); + } + } + + public override async Task SelectMany_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_nested_collection_on_optional_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `o0`.`AssociateTypeRootEntityId`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String` +FROM (`RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId` +WHERE `o`.`RootEntityId` IS NOT NULL AND `o0`.`AssociateTypeRootEntityId` IS NOT NULL +"""); + } + } + + #endregion Structural collection properties + + #region Multiple + + public override async Task Select_root_duplicated(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root_duplicated(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `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`, `o`.`Id`, `o`.`Int`, `o`.`Ints`, `o`.`Name`, `o`.`String`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `o2`.`Int`, `o2`.`Ints`, `o2`.`Name`, `o2`.`String`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String`, `o1`.`Id`, `o1`.`Int`, `o1`.`Ints`, `o1`.`Name`, `o1`.`String`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r7`.`AssociateTypeRootEntityId`, `r7`.`Id`, `r7`.`Int`, `r7`.`Ints`, `r7`.`Name`, `r7`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String`, `s0`.`RootEntityId`, `s0`.`Id`, `s0`.`Int`, `s0`.`Ints`, `s0`.`Name`, `s0`.`String`, `s0`.`AssociateTypeRootEntityId`, `s0`.`AssociateTypeId`, `s0`.`AssociateTypeRootEntityId0`, `s0`.`AssociateTypeId0`, `s0`.`AssociateTypeRootEntityId1`, `s0`.`AssociateTypeId1`, `s0`.`Id0`, `s0`.`Int0`, `s0`.`Ints0`, `s0`.`Name0`, `s0`.`String0`, `s0`.`Id1`, `s0`.`Int1`, `s0`.`Ints1`, `s0`.`Name1`, `s0`.`String1`, `s0`.`Id2`, `s0`.`Int2`, `s0`.`Ints2`, `s0`.`Name2`, `s0`.`String2`, `o3`.`AssociateTypeRootEntityId`, `o3`.`Id`, `o3`.`Int`, `o3`.`Ints`, `o3`.`Name`, `o3`.`String`, `r12`.`AssociateTypeRootEntityId`, `r12`.`Id`, `r12`.`Int`, `r12`.`Ints`, `r12`.`Name`, `r12`.`String` +FROM (((((((((((`RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o1` ON `o`.`RootEntityId` = `o1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RequiredRelated_OptionalNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_RequiredNested` AS `r2` ON `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId`) +LEFT JOIN ( + SELECT `r3`.`RootEntityId`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String`, `r4`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeId`, `r5`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r5`.`AssociateTypeId` AS `AssociateTypeId0`, `r6`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r6`.`AssociateTypeId` AS `AssociateTypeId1`, `r6`.`Id` AS `Id0`, `r6`.`Int` AS `Int0`, `r6`.`Ints` AS `Ints0`, `r6`.`Name` AS `Name0`, `r6`.`String` AS `String0`, `r4`.`Id` AS `Id1`, `r4`.`Int` AS `Int1`, `r4`.`Ints` AS `Ints1`, `r4`.`Name` AS `Name1`, `r4`.`String` AS `String1`, `r5`.`Id` AS `Id2`, `r5`.`Int` AS `Int2`, `r5`.`Ints` AS `Ints2`, `r5`.`Name` AS `Name2`, `r5`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r3` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r4` ON `r3`.`RootEntityId` = `r4`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r4`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r5` ON `r3`.`RootEntityId` = `r5`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r5`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r6` ON `r3`.`RootEntityId` = `r6`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r6`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o2` ON `o`.`RootEntityId` = `o2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r7` ON `r0`.`RootEntityId` = `r7`.`AssociateTypeRootEntityId`) +LEFT JOIN ( + SELECT `r8`.`RootEntityId`, `r8`.`Id`, `r8`.`Int`, `r8`.`Ints`, `r8`.`Name`, `r8`.`String`, `r9`.`AssociateTypeRootEntityId`, `r9`.`AssociateTypeId`, `r10`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r10`.`AssociateTypeId` AS `AssociateTypeId0`, `r11`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r11`.`AssociateTypeId` AS `AssociateTypeId1`, `r11`.`Id` AS `Id0`, `r11`.`Int` AS `Int0`, `r11`.`Ints` AS `Ints0`, `r11`.`Name` AS `Name0`, `r11`.`String` AS `String0`, `r9`.`Id` AS `Id1`, `r9`.`Int` AS `Int1`, `r9`.`Ints` AS `Ints1`, `r9`.`Name` AS `Name1`, `r9`.`String` AS `String1`, `r10`.`Id` AS `Id2`, `r10`.`Int` AS `Int2`, `r10`.`Ints` AS `Ints2`, `r10`.`Name` AS `Name2`, `r10`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r8` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r9` ON `r8`.`RootEntityId` = `r9`.`AssociateTypeRootEntityId` AND `r8`.`Id` = `r9`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r10` ON `r8`.`RootEntityId` = `r10`.`AssociateTypeRootEntityId` AND `r8`.`Id` = `r10`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r11` ON `r8`.`RootEntityId` = `r11`.`AssociateTypeRootEntityId` AND `r8`.`Id` = `r11`.`AssociateTypeId` +) AS `s0` ON `r`.`Id` = `s0`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o3` ON `o`.`RootEntityId` = `o3`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r12` ON `r0`.`RootEntityId` = `r12`.`AssociateTypeRootEntityId` +ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r7`.`AssociateTypeRootEntityId`, `r7`.`Id`, `s0`.`RootEntityId`, `s0`.`Id`, `s0`.`AssociateTypeRootEntityId`, `s0`.`AssociateTypeId`, `s0`.`AssociateTypeRootEntityId0`, `s0`.`AssociateTypeId0`, `s0`.`AssociateTypeRootEntityId1`, `s0`.`AssociateTypeId1`, `s0`.`Id0`, `o3`.`AssociateTypeRootEntityId`, `o3`.`Id`, `r12`.`AssociateTypeRootEntityId` +"""); + } + + #endregion Multiple + + #region Subquery + + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [s].[AssociateTypeRootEntityId], [s].[Id], [s].[Int], [s].[Ints], [s].[Name], [s].[String] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) [r2].[AssociateTypeRootEntityId], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String] + FROM [RootEntity] AS [r0] + LEFT JOIN [RequiredRelated] AS [r1] ON [r0].[Id] = [r1].[RootEntityId] + LEFT JOIN [RequiredRelated_RequiredNested] AS [r2] ON [r1].[RootEntityId] = [r2].[AssociateTypeRootEntityId] + ORDER BY [r0].[Id] +) AS [s] +"""); + } + } + + public override async Task Select_subquery_optional_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [s].[AssociateTypeRootEntityId], [s].[Id], [s].[Int], [s].[Ints], [s].[Name], [s].[String] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) [o0].[AssociateTypeRootEntityId], [o0].[Id], [o0].[Int], [o0].[Ints], [o0].[Name], [o0].[String] + FROM [RootEntity] AS [r0] + LEFT JOIN [OptionalRelated] AS [o] ON [r0].[Id] = [o].[RootEntityId] + LEFT JOIN [OptionalRelated_RequiredNested] AS [o0] ON [o].[RootEntityId] = [o0].[AssociateTypeRootEntityId] + ORDER BY [r0].[Id] +) AS [s] +"""); + } + } + + #endregion Subquery + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsSetOperationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsSetOperationsJetTest.cs new file mode 100644 index 00000000..bdf4b03a --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsSetOperationsJetTest.cs @@ -0,0 +1,131 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedNavigations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations; + +public class OwnedNavigationsSetOperationsJetTest( + OwnedNavigationsJetFixture fixture, + ITestOutputHelper testOutputHelper) + : OwnedNavigationsSetOperationsRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Over_associate_collections() + { + await base.Over_associate_collections(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r2].[RootEntityId], [r3].[AssociateTypeRootEntityId], [r4].[AssociateTypeRootEntityId], [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], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [o2].[AssociateTypeRootEntityId], [o2].[Id], [o2].[Int], [o2].[Ints], [o2].[Name], [o2].[String], [o0].[Id], [o0].[Int], [o0].[Ints], [o0].[Name], [o0].[String], [o1].[Id], [o1].[Int], [o1].[Ints], [o1].[Name], [o1].[String], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r9].[AssociateTypeRootEntityId], [r9].[Id], [r9].[Int], [r9].[Ints], [r9].[Name], [r9].[String], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r4].[Id], [r4].[Int], [r4].[Ints], [r4].[Name], [r4].[String] +FROM [RootEntity] AS [r] +LEFT JOIN [OptionalRelated] AS [o] ON [r].[Id] = [o].[RootEntityId] +LEFT JOIN [OptionalRelated_OptionalNested] AS [o0] ON [o].[RootEntityId] = [o0].[AssociateTypeRootEntityId] +LEFT JOIN [OptionalRelated_RequiredNested] AS [o1] ON [o].[RootEntityId] = [o1].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated] AS [r2] ON [r].[Id] = [r2].[RootEntityId] +LEFT JOIN [RequiredRelated_OptionalNested] AS [r3] ON [r2].[RootEntityId] = [r3].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_RequiredNested] AS [r4] ON [r2].[RootEntityId] = [r4].[AssociateTypeRootEntityId] +LEFT JOIN ( + SELECT [r5].[RootEntityId], [r5].[Id], [r5].[Int], [r5].[Ints], [r5].[Name], [r5].[String], [r6].[AssociateTypeRootEntityId], [r6].[AssociateTypeId], [r7].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId0], [r7].[AssociateTypeId] AS [AssociateTypeId0], [r8].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId1], [r8].[AssociateTypeId] AS [AssociateTypeId1], [r8].[Id] AS [Id0], [r8].[Int] AS [Int0], [r8].[Ints] AS [Ints0], [r8].[Name] AS [Name0], [r8].[String] AS [String0], [r6].[Id] AS [Id1], [r6].[Int] AS [Int1], [r6].[Ints] AS [Ints1], [r6].[Name] AS [Name1], [r6].[String] AS [String1], [r7].[Id] AS [Id2], [r7].[Int] AS [Int2], [r7].[Ints] AS [Ints2], [r7].[Name] AS [Name2], [r7].[String] AS [String2] + FROM [RelatedCollection] AS [r5] + LEFT JOIN [RelatedCollection_OptionalNested] AS [r6] ON [r5].[RootEntityId] = [r6].[AssociateTypeRootEntityId] AND [r5].[Id] = [r6].[AssociateTypeId] + LEFT JOIN [RelatedCollection_RequiredNested] AS [r7] ON [r5].[RootEntityId] = [r7].[AssociateTypeRootEntityId] AND [r5].[Id] = [r7].[AssociateTypeId] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r8] ON [r5].[RootEntityId] = [r8].[AssociateTypeRootEntityId] AND [r5].[Id] = [r8].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o2] ON [o].[RootEntityId] = [o2].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r9] ON [r2].[RootEntityId] = [r9].[AssociateTypeRootEntityId] +WHERE ( + SELECT COUNT(*) + FROM ( + SELECT 1 AS empty + FROM [RelatedCollection] AS [r0] + WHERE [r].[Id] = [r0].[RootEntityId] AND [r0].[Int] = 8 + UNION ALL + SELECT 1 AS empty + FROM [RelatedCollection] AS [r1] + WHERE [r].[Id] = [r1].[RootEntityId] AND [r1].[String] = N'foo' + ) AS [u]) = 4 +ORDER BY [r].[Id], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r2].[RootEntityId], [r3].[AssociateTypeRootEntityId], [r4].[AssociateTypeRootEntityId], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1], [s].[Id0], [o2].[AssociateTypeRootEntityId], [o2].[Id], [r9].[AssociateTypeRootEntityId] +"""); + } + + public override Task Over_associate_collection_projected(QueryTrackingBehavior queryTrackingBehavior) + => Assert.ThrowsAnyAsync(() => base.Over_associate_collection_projected(queryTrackingBehavior)); + + public override async Task Over_assocate_collection_Select_nested_with_aggregates_projected(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Over_assocate_collection_Select_nested_with_aggregates_projected(queryTrackingBehavior); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(SUM([s].[value]), 0) + FROM ( + SELECT [r0].[RootEntityId], [r0].[Id] + FROM [RelatedCollection] AS [r0] + WHERE [r].[Id] = [r0].[RootEntityId] AND [r0].[Int] = 8 + UNION ALL + SELECT [r1].[RootEntityId], [r1].[Id] + FROM [RelatedCollection] AS [r1] + WHERE [r].[Id] = [r1].[RootEntityId] AND [r1].[String] = N'foo' + ) AS [u] + OUTER APPLY ( + SELECT COALESCE(SUM([r2].[Int]), 0) AS [value] + FROM [RelatedCollection_NestedCollection] AS [r2] + WHERE [u].[RootEntityId] = [r2].[AssociateTypeRootEntityId] AND [u].[Id] = [r2].[AssociateTypeId] + ) AS [s]) +FROM [RootEntity] AS [r] +"""); + } + + public override async Task Over_nested_associate_collection() + { + await base.Over_nested_associate_collection(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [r0].[RootEntityId], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r3].[AssociateTypeRootEntityId], [r4].[AssociateTypeRootEntityId], [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], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [o2].[AssociateTypeRootEntityId], [o2].[Id], [o2].[Int], [o2].[Ints], [o2].[Name], [o2].[String], [o0].[Id], [o0].[Int], [o0].[Ints], [o0].[Name], [o0].[String], [o1].[Id], [o1].[Int], [o1].[Ints], [o1].[Name], [o1].[String], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r9].[AssociateTypeRootEntityId], [r9].[Id], [r9].[Int], [r9].[Ints], [r9].[Name], [r9].[String], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r4].[Id], [r4].[Int], [r4].[Ints], [r4].[Name], [r4].[String] +FROM [RootEntity] AS [r] +LEFT JOIN [RequiredRelated] AS [r0] ON [r].[Id] = [r0].[RootEntityId] +LEFT JOIN [OptionalRelated] AS [o] ON [r].[Id] = [o].[RootEntityId] +LEFT JOIN [OptionalRelated_OptionalNested] AS [o0] ON [o].[RootEntityId] = [o0].[AssociateTypeRootEntityId] +LEFT JOIN [OptionalRelated_RequiredNested] AS [o1] ON [o].[RootEntityId] = [o1].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_OptionalNested] AS [r3] ON [r0].[RootEntityId] = [r3].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_RequiredNested] AS [r4] ON [r0].[RootEntityId] = [r4].[AssociateTypeRootEntityId] +LEFT JOIN ( + SELECT [r5].[RootEntityId], [r5].[Id], [r5].[Int], [r5].[Ints], [r5].[Name], [r5].[String], [r6].[AssociateTypeRootEntityId], [r6].[AssociateTypeId], [r7].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId0], [r7].[AssociateTypeId] AS [AssociateTypeId0], [r8].[AssociateTypeRootEntityId] AS [AssociateTypeRootEntityId1], [r8].[AssociateTypeId] AS [AssociateTypeId1], [r8].[Id] AS [Id0], [r8].[Int] AS [Int0], [r8].[Ints] AS [Ints0], [r8].[Name] AS [Name0], [r8].[String] AS [String0], [r6].[Id] AS [Id1], [r6].[Int] AS [Int1], [r6].[Ints] AS [Ints1], [r6].[Name] AS [Name1], [r6].[String] AS [String1], [r7].[Id] AS [Id2], [r7].[Int] AS [Int2], [r7].[Ints] AS [Ints2], [r7].[Name] AS [Name2], [r7].[String] AS [String2] + FROM [RelatedCollection] AS [r5] + LEFT JOIN [RelatedCollection_OptionalNested] AS [r6] ON [r5].[RootEntityId] = [r6].[AssociateTypeRootEntityId] AND [r5].[Id] = [r6].[AssociateTypeId] + LEFT JOIN [RelatedCollection_RequiredNested] AS [r7] ON [r5].[RootEntityId] = [r7].[AssociateTypeRootEntityId] AND [r5].[Id] = [r7].[AssociateTypeId] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r8] ON [r5].[RootEntityId] = [r8].[AssociateTypeRootEntityId] AND [r5].[Id] = [r8].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o2] ON [o].[RootEntityId] = [o2].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r9] ON [r0].[RootEntityId] = [r9].[AssociateTypeRootEntityId] +WHERE ( + SELECT COUNT(*) + FROM ( + SELECT 1 AS empty + FROM [RequiredRelated_NestedCollection] AS [r1] + WHERE [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] AND [r1].[Int] = 8 + UNION ALL + SELECT 1 AS empty + FROM [RequiredRelated_NestedCollection] AS [r2] + WHERE [r0].[RootEntityId] = [r2].[AssociateTypeRootEntityId] AND [r2].[String] = N'foo' + ) AS [u]) = 4 +ORDER BY [r].[Id], [r0].[RootEntityId], [o].[RootEntityId], [o0].[AssociateTypeRootEntityId], [o1].[AssociateTypeRootEntityId], [r3].[AssociateTypeRootEntityId], [r4].[AssociateTypeRootEntityId], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1], [s].[Id0], [o2].[AssociateTypeRootEntityId], [o2].[Id], [r9].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Over_different_collection_properties() + { + await base.Over_different_collection_properties(); + + AssertSql(); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsStructuralEqualityJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsStructuralEqualityJetTest.cs new file mode 100644 index 00000000..69a82b67 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsStructuralEqualityJetTest.cs @@ -0,0 +1,275 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedNavigations; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedNavigations; + +public class OwnedNavigationsStructuralEqualityJetTest( + OwnedNavigationsJetFixture fixture, + ITestOutputHelper testOutputHelper) + : OwnedNavigationsStructuralEqualityRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Two_associates() + { + await base.Two_associates(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r0`.`RootEntityId`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `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`, `o`.`Id`, `o`.`Int`, `o`.`Ints`, `o`.`Name`, `o`.`String`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `o2`.`Int`, `o2`.`Ints`, `o2`.`Name`, `o2`.`String`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String`, `o1`.`Id`, `o1`.`Int`, `o1`.`Ints`, `o1`.`Name`, `o1`.`String`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r7`.`AssociateTypeRootEntityId`, `r7`.`Id`, `r7`.`Int`, `r7`.`Ints`, `r7`.`Name`, `r7`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o1` ON `o`.`RootEntityId` = `o1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_OptionalNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_RequiredNested` AS `r2` ON `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId`) +LEFT JOIN ( + SELECT `r3`.`RootEntityId`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String`, `r4`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeId`, `r5`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r5`.`AssociateTypeId` AS `AssociateTypeId0`, `r6`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r6`.`AssociateTypeId` AS `AssociateTypeId1`, `r6`.`Id` AS `Id0`, `r6`.`Int` AS `Int0`, `r6`.`Ints` AS `Ints0`, `r6`.`Name` AS `Name0`, `r6`.`String` AS `String0`, `r4`.`Id` AS `Id1`, `r4`.`Int` AS `Int1`, `r4`.`Ints` AS `Ints1`, `r4`.`Name` AS `Name1`, `r4`.`String` AS `String1`, `r5`.`Id` AS `Id2`, `r5`.`Int` AS `Int2`, `r5`.`Ints` AS `Ints2`, `r5`.`Name` AS `Name2`, `r5`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r3` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r4` ON `r3`.`RootEntityId` = `r4`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r4`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r5` ON `r3`.`RootEntityId` = `r5`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r5`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r6` ON `r3`.`RootEntityId` = `r6`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r6`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o2` ON `o`.`RootEntityId` = `o2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r7` ON `r0`.`RootEntityId` = `r7`.`AssociateTypeRootEntityId` +WHERE FALSE +ORDER BY `r`.`Id`, `r0`.`RootEntityId`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r7`.`AssociateTypeRootEntityId` +"""); + } + + public override async Task Two_nested_associates() + { + await base.Two_nested_associates(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `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`, `o`.`Id`, `o`.`Int`, `o`.`Ints`, `o`.`Name`, `o`.`String`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `o2`.`Int`, `o2`.`Ints`, `o2`.`Name`, `o2`.`String`, `o1`.`Id`, `o1`.`Int`, `o1`.`Ints`, `o1`.`Name`, `o1`.`String`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r7`.`AssociateTypeRootEntityId`, `r7`.`Id`, `r7`.`Int`, `r7`.`Ints`, `r7`.`Name`, `r7`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RequiredRelated_RequiredNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o1` ON `o`.`RootEntityId` = `o1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_OptionalNested` AS `r2` ON `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId`) +LEFT JOIN ( + SELECT `r3`.`RootEntityId`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String`, `r4`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeId`, `r5`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r5`.`AssociateTypeId` AS `AssociateTypeId0`, `r6`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r6`.`AssociateTypeId` AS `AssociateTypeId1`, `r6`.`Id` AS `Id0`, `r6`.`Int` AS `Int0`, `r6`.`Ints` AS `Ints0`, `r6`.`Name` AS `Name0`, `r6`.`String` AS `String0`, `r4`.`Id` AS `Id1`, `r4`.`Int` AS `Int1`, `r4`.`Ints` AS `Ints1`, `r4`.`Name` AS `Name1`, `r4`.`String` AS `String1`, `r5`.`Id` AS `Id2`, `r5`.`Int` AS `Int2`, `r5`.`Ints` AS `Ints2`, `r5`.`Name` AS `Name2`, `r5`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r3` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r4` ON `r3`.`RootEntityId` = `r4`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r4`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r5` ON `r3`.`RootEntityId` = `r5`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r5`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r6` ON `r3`.`RootEntityId` = `r6`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r6`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o2` ON `o`.`RootEntityId` = `o2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r7` ON `r0`.`RootEntityId` = `r7`.`AssociateTypeRootEntityId` +WHERE FALSE +ORDER BY `r`.`Id`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r7`.`AssociateTypeRootEntityId` +"""); + } + + public override async Task Not_equals() + { + await base.Not_equals(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r0`.`RootEntityId`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `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`, `o`.`Id`, `o`.`Int`, `o`.`Ints`, `o`.`Name`, `o`.`String`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `o2`.`Int`, `o2`.`Ints`, `o2`.`Name`, `o2`.`String`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String`, `o1`.`Id`, `o1`.`Int`, `o1`.`Ints`, `o1`.`Name`, `o1`.`String`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r7`.`AssociateTypeRootEntityId`, `r7`.`Id`, `r7`.`Int`, `r7`.`Ints`, `r7`.`Name`, `r7`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o1` ON `o`.`RootEntityId` = `o1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_OptionalNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_RequiredNested` AS `r2` ON `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId`) +LEFT JOIN ( + SELECT `r3`.`RootEntityId`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String`, `r4`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeId`, `r5`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r5`.`AssociateTypeId` AS `AssociateTypeId0`, `r6`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r6`.`AssociateTypeId` AS `AssociateTypeId1`, `r6`.`Id` AS `Id0`, `r6`.`Int` AS `Int0`, `r6`.`Ints` AS `Ints0`, `r6`.`Name` AS `Name0`, `r6`.`String` AS `String0`, `r4`.`Id` AS `Id1`, `r4`.`Int` AS `Int1`, `r4`.`Ints` AS `Ints1`, `r4`.`Name` AS `Name1`, `r4`.`String` AS `String1`, `r5`.`Id` AS `Id2`, `r5`.`Int` AS `Int2`, `r5`.`Ints` AS `Ints2`, `r5`.`Name` AS `Name2`, `r5`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r3` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r4` ON `r3`.`RootEntityId` = `r4`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r4`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r5` ON `r3`.`RootEntityId` = `r5`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r5`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r6` ON `r3`.`RootEntityId` = `r6`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r6`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o2` ON `o`.`RootEntityId` = `o2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r7` ON `r0`.`RootEntityId` = `r7`.`AssociateTypeRootEntityId` +WHERE FALSE +ORDER BY `r`.`Id`, `r0`.`RootEntityId`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r7`.`AssociateTypeRootEntityId` +"""); + } + + public override async Task Associate_with_inline_null() + { + await base.Associate_with_inline_null(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `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`, `o`.`Id`, `o`.`Int`, `o`.`Ints`, `o`.`Name`, `o`.`String`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `o2`.`Int`, `o2`.`Ints`, `o2`.`Name`, `o2`.`String`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String`, `o1`.`Id`, `o1`.`Int`, `o1`.`Ints`, `o1`.`Name`, `o1`.`String`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r7`.`AssociateTypeRootEntityId`, `r7`.`Id`, `r7`.`Int`, `r7`.`Ints`, `r7`.`Name`, `r7`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o1` ON `o`.`RootEntityId` = `o1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RequiredRelated_OptionalNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_RequiredNested` AS `r2` ON `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId`) +LEFT JOIN ( + SELECT `r3`.`RootEntityId`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String`, `r4`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeId`, `r5`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r5`.`AssociateTypeId` AS `AssociateTypeId0`, `r6`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r6`.`AssociateTypeId` AS `AssociateTypeId1`, `r6`.`Id` AS `Id0`, `r6`.`Int` AS `Int0`, `r6`.`Ints` AS `Ints0`, `r6`.`Name` AS `Name0`, `r6`.`String` AS `String0`, `r4`.`Id` AS `Id1`, `r4`.`Int` AS `Int1`, `r4`.`Ints` AS `Ints1`, `r4`.`Name` AS `Name1`, `r4`.`String` AS `String1`, `r5`.`Id` AS `Id2`, `r5`.`Int` AS `Int2`, `r5`.`Ints` AS `Ints2`, `r5`.`Name` AS `Name2`, `r5`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r3` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r4` ON `r3`.`RootEntityId` = `r4`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r4`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r5` ON `r3`.`RootEntityId` = `r5`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r5`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r6` ON `r3`.`RootEntityId` = `r6`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r6`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o2` ON `o`.`RootEntityId` = `o2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r7` ON `r0`.`RootEntityId` = `r7`.`AssociateTypeRootEntityId` +WHERE `o`.`RootEntityId` IS NULL +ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r7`.`AssociateTypeRootEntityId` +"""); + } + + public override async Task Associate_with_parameter_null() + { + await base.Associate_with_parameter_null(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `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`, `o`.`Id`, `o`.`Int`, `o`.`Ints`, `o`.`Name`, `o`.`String`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `o2`.`Int`, `o2`.`Ints`, `o2`.`Name`, `o2`.`String`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String`, `o1`.`Id`, `o1`.`Int`, `o1`.`Ints`, `o1`.`Name`, `o1`.`String`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r7`.`AssociateTypeRootEntityId`, `r7`.`Id`, `r7`.`Int`, `r7`.`Ints`, `r7`.`Name`, `r7`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o1` ON `o`.`RootEntityId` = `o1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RequiredRelated_OptionalNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_RequiredNested` AS `r2` ON `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId`) +LEFT JOIN ( + SELECT `r3`.`RootEntityId`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String`, `r4`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeId`, `r5`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r5`.`AssociateTypeId` AS `AssociateTypeId0`, `r6`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r6`.`AssociateTypeId` AS `AssociateTypeId1`, `r6`.`Id` AS `Id0`, `r6`.`Int` AS `Int0`, `r6`.`Ints` AS `Ints0`, `r6`.`Name` AS `Name0`, `r6`.`String` AS `String0`, `r4`.`Id` AS `Id1`, `r4`.`Int` AS `Int1`, `r4`.`Ints` AS `Ints1`, `r4`.`Name` AS `Name1`, `r4`.`String` AS `String1`, `r5`.`Id` AS `Id2`, `r5`.`Int` AS `Int2`, `r5`.`Ints` AS `Ints2`, `r5`.`Name` AS `Name2`, `r5`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r3` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r4` ON `r3`.`RootEntityId` = `r4`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r4`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r5` ON `r3`.`RootEntityId` = `r5`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r5`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r6` ON `r3`.`RootEntityId` = `r6`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r6`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o2` ON `o`.`RootEntityId` = `o2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r7` ON `r0`.`RootEntityId` = `r7`.`AssociateTypeRootEntityId` +WHERE `o`.`RootEntityId` IS NULL +ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r7`.`AssociateTypeRootEntityId` +"""); + } + + public override async Task Nested_associate_with_inline_null() + { + await base.Nested_associate_with_inline_null(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `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`, `o`.`Id`, `o`.`Int`, `o`.`Ints`, `o`.`Name`, `o`.`String`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `o2`.`Int`, `o2`.`Ints`, `o2`.`Name`, `o2`.`String`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String`, `o1`.`Id`, `o1`.`Int`, `o1`.`Ints`, `o1`.`Name`, `o1`.`String`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r7`.`AssociateTypeRootEntityId`, `r7`.`Id`, `r7`.`Int`, `r7`.`Ints`, `r7`.`Name`, `r7`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RequiredRelated_OptionalNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o1` ON `o`.`RootEntityId` = `o1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_RequiredNested` AS `r2` ON `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId`) +LEFT JOIN ( + SELECT `r3`.`RootEntityId`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String`, `r4`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeId`, `r5`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r5`.`AssociateTypeId` AS `AssociateTypeId0`, `r6`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r6`.`AssociateTypeId` AS `AssociateTypeId1`, `r6`.`Id` AS `Id0`, `r6`.`Int` AS `Int0`, `r6`.`Ints` AS `Ints0`, `r6`.`Name` AS `Name0`, `r6`.`String` AS `String0`, `r4`.`Id` AS `Id1`, `r4`.`Int` AS `Int1`, `r4`.`Ints` AS `Ints1`, `r4`.`Name` AS `Name1`, `r4`.`String` AS `String1`, `r5`.`Id` AS `Id2`, `r5`.`Int` AS `Int2`, `r5`.`Ints` AS `Ints2`, `r5`.`Name` AS `Name2`, `r5`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r3` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r4` ON `r3`.`RootEntityId` = `r4`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r4`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r5` ON `r3`.`RootEntityId` = `r5`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r5`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r6` ON `r3`.`RootEntityId` = `r6`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r6`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o2` ON `o`.`RootEntityId` = `o2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r7` ON `r0`.`RootEntityId` = `r7`.`AssociateTypeRootEntityId` +WHERE `r1`.`AssociateTypeRootEntityId` IS NULL +ORDER BY `r`.`Id`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r7`.`AssociateTypeRootEntityId` +"""); + } + + public override async Task Nested_associate_with_inline() + { + await base.Nested_associate_with_inline(); + + AssertSql( + ); + } + + public override async Task Nested_associate_with_parameter() + { + await base.Nested_associate_with_parameter(); + + AssertSql( + ); + } + + public override async Task Two_nested_collections() + { + await base.Two_nested_collections(); + + AssertSql( + """ +SELECT `r`.`Id`, `r`.`Name`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `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`, `o`.`Id`, `o`.`Int`, `o`.`Ints`, `o`.`Name`, `o`.`String`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `o2`.`Int`, `o2`.`Ints`, `o2`.`Name`, `o2`.`String`, `o0`.`Id`, `o0`.`Int`, `o0`.`Ints`, `o0`.`Name`, `o0`.`String`, `o1`.`Id`, `o1`.`Int`, `o1`.`Ints`, `o1`.`Name`, `o1`.`String`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r7`.`AssociateTypeRootEntityId`, `r7`.`Id`, `r7`.`Int`, `r7`.`Ints`, `r7`.`Name`, `r7`.`String`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r2`.`Id`, `r2`.`Int`, `r2`.`Ints`, `r2`.`Name`, `r2`.`String` +FROM ((((((((`RootEntity` AS `r` +LEFT JOIN `OptionalRelated` AS `o` ON `r`.`Id` = `o`.`RootEntityId`) +LEFT JOIN `OptionalRelated_OptionalNested` AS `o0` ON `o`.`RootEntityId` = `o0`.`AssociateTypeRootEntityId`) +LEFT JOIN `OptionalRelated_RequiredNested` AS `o1` ON `o`.`RootEntityId` = `o1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RequiredRelated_OptionalNested` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_RequiredNested` AS `r2` ON `r0`.`RootEntityId` = `r2`.`AssociateTypeRootEntityId`) +LEFT JOIN ( + SELECT `r3`.`RootEntityId`, `r3`.`Id`, `r3`.`Int`, `r3`.`Ints`, `r3`.`Name`, `r3`.`String`, `r4`.`AssociateTypeRootEntityId`, `r4`.`AssociateTypeId`, `r5`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId0`, `r5`.`AssociateTypeId` AS `AssociateTypeId0`, `r6`.`AssociateTypeRootEntityId` AS `AssociateTypeRootEntityId1`, `r6`.`AssociateTypeId` AS `AssociateTypeId1`, `r6`.`Id` AS `Id0`, `r6`.`Int` AS `Int0`, `r6`.`Ints` AS `Ints0`, `r6`.`Name` AS `Name0`, `r6`.`String` AS `String0`, `r4`.`Id` AS `Id1`, `r4`.`Int` AS `Int1`, `r4`.`Ints` AS `Ints1`, `r4`.`Name` AS `Name1`, `r4`.`String` AS `String1`, `r5`.`Id` AS `Id2`, `r5`.`Int` AS `Int2`, `r5`.`Ints` AS `Ints2`, `r5`.`Name` AS `Name2`, `r5`.`String` AS `String2` + FROM ((`RelatedCollection` AS `r3` + LEFT JOIN `RelatedCollection_OptionalNested` AS `r4` ON `r3`.`RootEntityId` = `r4`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r4`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_RequiredNested` AS `r5` ON `r3`.`RootEntityId` = `r5`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r5`.`AssociateTypeId`) + LEFT JOIN `RelatedCollection_NestedCollection` AS `r6` ON `r3`.`RootEntityId` = `r6`.`AssociateTypeRootEntityId` AND `r3`.`Id` = `r6`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId`) +LEFT JOIN `OptionalRelated_NestedCollection` AS `o2` ON `o`.`RootEntityId` = `o2`.`AssociateTypeRootEntityId`) +LEFT JOIN `RequiredRelated_NestedCollection` AS `r7` ON `r0`.`RootEntityId` = `r7`.`AssociateTypeRootEntityId` +WHERE FALSE +ORDER BY `r`.`Id`, `o`.`RootEntityId`, `o0`.`AssociateTypeRootEntityId`, `o1`.`AssociateTypeRootEntityId`, `r0`.`RootEntityId`, `r1`.`AssociateTypeRootEntityId`, `r2`.`AssociateTypeRootEntityId`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId`, `s`.`AssociateTypeRootEntityId0`, `s`.`AssociateTypeId0`, `s`.`AssociateTypeRootEntityId1`, `s`.`AssociateTypeId1`, `s`.`Id0`, `o2`.`AssociateTypeRootEntityId`, `o2`.`Id`, `r7`.`AssociateTypeRootEntityId` +"""); + } + + public override async Task Nested_collection_with_inline() + { + await base.Nested_collection_with_inline(); + + AssertSql(); + } + + public override async Task Nested_collection_with_parameter() + { + await base.Nested_collection_with_parameter(); + + AssertSql(); + } + + #region Contains + + public override async Task Contains_with_inline() + { + await base.Contains_with_inline(); + + AssertSql(); + } + + public override async Task Contains_with_parameter() + { + await base.Contains_with_parameter(); + + AssertSql(); + } + + public override async Task Contains_with_operators_composed_on_the_collection() + { + await base.Contains_with_operators_composed_on_the_collection(); + + AssertSql(); + } + + public override async Task Contains_with_nested_and_composed_operators() + { + await base.Contains_with_nested_and_composed_operators(); + + AssertSql(); + } + + #endregion Contains + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingJetFixture.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingJetFixture.cs new file mode 100644 index 00000000..485f7a0d --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingJetFixture.cs @@ -0,0 +1,11 @@ +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedTableSplitting; +using Microsoft.EntityFrameworkCore.TestUtilities; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedTableSplitting; + +public class OwnedTableSplittingJetFixture : OwnedTableSplittingRelationalFixtureBase +{ + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingMiscellaneousJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingMiscellaneousJetTest.cs new file mode 100644 index 00000000..47eb5523 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingMiscellaneousJetTest.cs @@ -0,0 +1,87 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedTableSplitting; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedTableSplitting; + +public class OwnedTableSplittingMiscellaneousJetTest( + OwnedTableSplittingJetFixture fixture, + ITestOutputHelper testOutputHelper) + : OwnedTableSplittingMiscellaneousRelationalTestBase(fixture, testOutputHelper) +{ + #region Simple filters + + public override async Task Where_on_associate_scalar_property() + { + await base.Where_on_associate_scalar_property(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r2].[AssociateTypeRootEntityId], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r0].[RootEntityId], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r1].[AssociateTypeRootEntityId], [r1].[AssociateTypeId], [r1].[Id] AS [Id0], [r1].[Int] AS [Int0], [r1].[Ints] AS [Ints0], [r1].[Name] AS [Name0], [r1].[String] AS [String0], [r0].[OptionalNestedAssociate_Id], [r0].[OptionalNestedAssociate_Int], [r0].[OptionalNestedAssociate_Ints], [r0].[OptionalNestedAssociate_Name], [r0].[OptionalNestedAssociate_String], [r0].[RequiredNestedAssociate_Id], [r0].[RequiredNestedAssociate_Int], [r0].[RequiredNestedAssociate_Ints], [r0].[RequiredNestedAssociate_Name], [r0].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r0] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] AND [r0].[Id] = [r1].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r2] ON [r].[Id] = [r2].[AssociateTypeRootEntityId] +WHERE [r].[RequiredAssociate_Int] = 8 +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r2].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Where_on_optional_associate_scalar_property() + { + await base.Where_on_optional_associate_scalar_property(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r2].[AssociateTypeRootEntityId], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r0].[RootEntityId], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r1].[AssociateTypeRootEntityId], [r1].[AssociateTypeId], [r1].[Id] AS [Id0], [r1].[Int] AS [Int0], [r1].[Ints] AS [Ints0], [r1].[Name] AS [Name0], [r1].[String] AS [String0], [r0].[OptionalNestedAssociate_Id], [r0].[OptionalNestedAssociate_Int], [r0].[OptionalNestedAssociate_Ints], [r0].[OptionalNestedAssociate_Name], [r0].[OptionalNestedAssociate_String], [r0].[RequiredNestedAssociate_Id], [r0].[RequiredNestedAssociate_Int], [r0].[RequiredNestedAssociate_Ints], [r0].[RequiredNestedAssociate_Name], [r0].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r0] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] AND [r0].[Id] = [r1].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r2] ON [r].[Id] = [r2].[AssociateTypeRootEntityId] +WHERE [r].[OptionalAssociate_Int] = 8 +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r2].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Where_on_nested_associate_scalar_property() + { + await base.Where_on_nested_associate_scalar_property(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r2].[AssociateTypeRootEntityId], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r0].[RootEntityId], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r1].[AssociateTypeRootEntityId], [r1].[AssociateTypeId], [r1].[Id] AS [Id0], [r1].[Int] AS [Int0], [r1].[Ints] AS [Ints0], [r1].[Name] AS [Name0], [r1].[String] AS [String0], [r0].[OptionalNestedAssociate_Id], [r0].[OptionalNestedAssociate_Int], [r0].[OptionalNestedAssociate_Ints], [r0].[OptionalNestedAssociate_Name], [r0].[OptionalNestedAssociate_String], [r0].[RequiredNestedAssociate_Id], [r0].[RequiredNestedAssociate_Int], [r0].[RequiredNestedAssociate_Ints], [r0].[RequiredNestedAssociate_Name], [r0].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r0] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] AND [r0].[Id] = [r1].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r2] ON [r].[Id] = [r2].[AssociateTypeRootEntityId] +WHERE [r].[RequiredAssociate_RequiredNestedAssociate_Int] = 8 +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r2].[AssociateTypeRootEntityId] +"""); + } + + #endregion Simple filters + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingPrimitiveCollectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingPrimitiveCollectionJetTest.cs new file mode 100644 index 00000000..ed041afb --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingPrimitiveCollectionJetTest.cs @@ -0,0 +1,153 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedTableSplitting; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedTableSplitting; + +public class OwnedTableSplittingPrimitiveCollectionJetTest( + OwnedTableSplittingJetFixture fixture, + ITestOutputHelper testOutputHelper) + : OwnedTableSplittingPrimitiveCollectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Count() + { + await base.Count(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r3].[AssociateTypeRootEntityId], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r1].[RootEntityId], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r2].[AssociateTypeRootEntityId], [r2].[AssociateTypeId], [r2].[Id] AS [Id0], [r2].[Int] AS [Int0], [r2].[Ints] AS [Ints0], [r2].[Name] AS [Name0], [r2].[String] AS [String0], [r1].[OptionalNestedAssociate_Id], [r1].[OptionalNestedAssociate_Int], [r1].[OptionalNestedAssociate_Ints], [r1].[OptionalNestedAssociate_Name], [r1].[OptionalNestedAssociate_String], [r1].[RequiredNestedAssociate_Id], [r1].[RequiredNestedAssociate_Int], [r1].[RequiredNestedAssociate_Ints], [r1].[RequiredNestedAssociate_Name], [r1].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r1] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r2] ON [r1].[RootEntityId] = [r2].[AssociateTypeRootEntityId] AND [r1].[Id] = [r2].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r3] ON [r].[Id] = [r3].[AssociateTypeRootEntityId] +WHERE ( + SELECT COUNT(*) + FROM OPENJSON([r].[RequiredAssociate_Ints]) AS [r0]) = 3 +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r3].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Index() + { + await base.Index(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r2].[AssociateTypeRootEntityId], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r0].[RootEntityId], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r1].[AssociateTypeRootEntityId], [r1].[AssociateTypeId], [r1].[Id] AS [Id0], [r1].[Int] AS [Int0], [r1].[Ints] AS [Ints0], [r1].[Name] AS [Name0], [r1].[String] AS [String0], [r0].[OptionalNestedAssociate_Id], [r0].[OptionalNestedAssociate_Int], [r0].[OptionalNestedAssociate_Ints], [r0].[OptionalNestedAssociate_Name], [r0].[OptionalNestedAssociate_String], [r0].[RequiredNestedAssociate_Id], [r0].[RequiredNestedAssociate_Int], [r0].[RequiredNestedAssociate_Ints], [r0].[RequiredNestedAssociate_Name], [r0].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r0] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] AND [r0].[Id] = [r1].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r2] ON [r].[Id] = [r2].[AssociateTypeRootEntityId] +WHERE CAST(JSON_VALUE([r].[RequiredAssociate_Ints], '$[0]') AS int) = 1 +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r2].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Contains() + { + await base.Contains(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r3].[AssociateTypeRootEntityId], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r1].[RootEntityId], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r2].[AssociateTypeRootEntityId], [r2].[AssociateTypeId], [r2].[Id] AS [Id0], [r2].[Int] AS [Int0], [r2].[Ints] AS [Ints0], [r2].[Name] AS [Name0], [r2].[String] AS [String0], [r1].[OptionalNestedAssociate_Id], [r1].[OptionalNestedAssociate_Int], [r1].[OptionalNestedAssociate_Ints], [r1].[OptionalNestedAssociate_Name], [r1].[OptionalNestedAssociate_String], [r1].[RequiredNestedAssociate_Id], [r1].[RequiredNestedAssociate_Int], [r1].[RequiredNestedAssociate_Ints], [r1].[RequiredNestedAssociate_Name], [r1].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r1] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r2] ON [r1].[RootEntityId] = [r2].[AssociateTypeRootEntityId] AND [r1].[Id] = [r2].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r3] ON [r].[Id] = [r3].[AssociateTypeRootEntityId] +WHERE 3 IN ( + SELECT [r0].[value] + FROM OPENJSON([r].[RequiredAssociate_Ints]) WITH ([value] int '$') AS [r0] +) +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r3].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Any_predicate() + { + await base.Any_predicate(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r3].[AssociateTypeRootEntityId], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r1].[RootEntityId], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r2].[AssociateTypeRootEntityId], [r2].[AssociateTypeId], [r2].[Id] AS [Id0], [r2].[Int] AS [Int0], [r2].[Ints] AS [Ints0], [r2].[Name] AS [Name0], [r2].[String] AS [String0], [r1].[OptionalNestedAssociate_Id], [r1].[OptionalNestedAssociate_Int], [r1].[OptionalNestedAssociate_Ints], [r1].[OptionalNestedAssociate_Name], [r1].[OptionalNestedAssociate_String], [r1].[RequiredNestedAssociate_Id], [r1].[RequiredNestedAssociate_Int], [r1].[RequiredNestedAssociate_Ints], [r1].[RequiredNestedAssociate_Name], [r1].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r1] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r2] ON [r1].[RootEntityId] = [r2].[AssociateTypeRootEntityId] AND [r1].[Id] = [r2].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r3] ON [r].[Id] = [r3].[AssociateTypeRootEntityId] +WHERE 2 IN ( + SELECT [r0].[value] + FROM OPENJSON([r].[RequiredAssociate_Ints]) WITH ([value] int '$') AS [r0] +) +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r3].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Nested_Count() + { + await base.Nested_Count(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r3].[AssociateTypeRootEntityId], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r1].[RootEntityId], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r2].[AssociateTypeRootEntityId], [r2].[AssociateTypeId], [r2].[Id] AS [Id0], [r2].[Int] AS [Int0], [r2].[Ints] AS [Ints0], [r2].[Name] AS [Name0], [r2].[String] AS [String0], [r1].[OptionalNestedAssociate_Id], [r1].[OptionalNestedAssociate_Int], [r1].[OptionalNestedAssociate_Ints], [r1].[OptionalNestedAssociate_Name], [r1].[OptionalNestedAssociate_String], [r1].[RequiredNestedAssociate_Id], [r1].[RequiredNestedAssociate_Int], [r1].[RequiredNestedAssociate_Ints], [r1].[RequiredNestedAssociate_Name], [r1].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r1] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r2] ON [r1].[RootEntityId] = [r2].[AssociateTypeRootEntityId] AND [r1].[Id] = [r2].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r3] ON [r].[Id] = [r3].[AssociateTypeRootEntityId] +WHERE ( + SELECT COUNT(*) + FROM OPENJSON([r].[RequiredAssociate_RequiredNestedAssociate_Ints]) AS [r0]) = 3 +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r3].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Select_Sum() + { + await base.Select_Sum(); + + AssertSql( + """ +SELECT ( + SELECT COALESCE(SUM([r1].[value]), 0) + FROM OPENJSON([r].[RequiredAssociate_Ints]) WITH ([value] int '$') AS [r1]) +FROM [RootEntity] AS [r] +WHERE ( + SELECT COALESCE(SUM([r0].[value]), 0) + FROM OPENJSON([r].[RequiredAssociate_Ints]) WITH ([value] int '$') AS [r0]) >= 6 +"""); + } + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionJetTest.cs new file mode 100644 index 00000000..c62c6768 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionJetTest.cs @@ -0,0 +1,406 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedTableSplitting; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedTableSplitting; + +public class OwnedTableSplittingProjectionJetTest(OwnedTableSplittingJetFixture fixture, ITestOutputHelper testOutputHelper) + : OwnedTableSplittingProjectionRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root(queryTrackingBehavior); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r2].[AssociateTypeRootEntityId], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r0].[RootEntityId], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r1].[AssociateTypeRootEntityId], [r1].[AssociateTypeId], [r1].[Id] AS [Id0], [r1].[Int] AS [Int0], [r1].[Ints] AS [Ints0], [r1].[Name] AS [Name0], [r1].[String] AS [String0], [r0].[OptionalNestedAssociate_Id], [r0].[OptionalNestedAssociate_Int], [r0].[OptionalNestedAssociate_Ints], [r0].[OptionalNestedAssociate_Name], [r0].[OptionalNestedAssociate_String], [r0].[RequiredNestedAssociate_Id], [r0].[RequiredNestedAssociate_Int], [r0].[RequiredNestedAssociate_Ints], [r0].[RequiredNestedAssociate_Name], [r0].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r0] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] AND [r0].[Id] = [r1].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r2] ON [r].[Id] = [r2].[AssociateTypeRootEntityId] +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r2].[AssociateTypeRootEntityId] +"""); + } + + #region Scalar properties + + public override async Task Select_scalar_property_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_scalar_property_on_required_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`RequiredAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + + public override async Task Select_property_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_property_on_optional_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`OptionalAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + + public override async Task Select_value_type_property_on_null_associate_throws(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_value_type_property_on_null_associate_throws(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`OptionalAssociate_Int` +FROM `RootEntity` AS `r` +"""); + } + + public override async Task Select_nullable_value_type_property_on_null_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nullable_value_type_property_on_null_associate(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`OptionalAssociate_Int` +FROM `RootEntity` AS `r` +"""); + } + + #endregion Scalar properties + + #region Structural properties + + public override async Task Select_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r`.`Id`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r0`.`AssociateTypeRootEntityId`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +LEFT JOIN `RequiredRelated_NestedCollection` AS `r0` ON `r`.`Id` = `r0`.`AssociateTypeRootEntityId` +ORDER BY `r`.`Id`, `r0`.`AssociateTypeRootEntityId` +"""); + } + } + + public override async Task Select_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [r].[Id], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +ORDER BY [r].[Id], [o].[AssociateTypeRootEntityId] +"""); + } + } + + public override async Task Select_required_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_nested_on_required_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r`.`Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + } + + public override async Task Select_optional_nested_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_nested_on_required_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r`.`Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + } + + public override async Task Select_required_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_nested_on_optional_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r`.`Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Id`, `r`.`OptionalAssociate_RequiredNestedAssociate_Int`, `r`.`OptionalAssociate_RequiredNestedAssociate_Ints`, `r`.`OptionalAssociate_RequiredNestedAssociate_Name`, `r`.`OptionalAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + } + + public override async Task Select_optional_nested_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_optional_nested_on_optional_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r`.`Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Id`, `r`.`OptionalAssociate_OptionalNestedAssociate_Int`, `r`.`OptionalAssociate_OptionalNestedAssociate_Ints`, `r`.`OptionalAssociate_OptionalNestedAssociate_Name`, `r`.`OptionalAssociate_OptionalNestedAssociate_String` +FROM `RootEntity` AS `r` +"""); + } + } + + public override async Task Select_required_associate_via_optional_navigation(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_required_associate_via_optional_navigation(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r0`.`Id`, `r0`.`RequiredAssociate_Id`, `r0`.`RequiredAssociate_Int`, `r0`.`RequiredAssociate_Ints`, `r0`.`RequiredAssociate_Name`, `r0`.`RequiredAssociate_String`, `r`.`Id`, `r1`.`AssociateTypeRootEntityId`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r0`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r0`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r0`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r0`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r0`.`RequiredAssociate_OptionalNestedAssociate_String`, `r0`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r0`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r0`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r0`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r0`.`RequiredAssociate_RequiredNestedAssociate_String` +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` +"""); + } + } + + public override async Task Select_unmapped_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_unmapped_associate_scalar_property(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r`.`Id`, `r`.`RequiredAssociate_Id`, `r`.`RequiredAssociate_Int`, `r`.`RequiredAssociate_Ints`, `r`.`RequiredAssociate_Name`, `r`.`RequiredAssociate_String`, `r0`.`AssociateTypeRootEntityId`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r`.`RequiredAssociate_OptionalNestedAssociate_Id`, `r`.`RequiredAssociate_OptionalNestedAssociate_Int`, `r`.`RequiredAssociate_OptionalNestedAssociate_Ints`, `r`.`RequiredAssociate_OptionalNestedAssociate_Name`, `r`.`RequiredAssociate_OptionalNestedAssociate_String`, `r`.`RequiredAssociate_RequiredNestedAssociate_Id`, `r`.`RequiredAssociate_RequiredNestedAssociate_Int`, `r`.`RequiredAssociate_RequiredNestedAssociate_Ints`, `r`.`RequiredAssociate_RequiredNestedAssociate_Name`, `r`.`RequiredAssociate_RequiredNestedAssociate_String` +FROM `RootEntity` AS `r` +LEFT JOIN `RequiredRelated_NestedCollection` AS `r0` ON `r`.`Id` = `r0`.`AssociateTypeRootEntityId` +ORDER BY `r`.`Id`, `r0`.`AssociateTypeRootEntityId` +"""); + } + } + + public override async Task Select_untranslatable_method_on_associate_scalar_property(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_untranslatable_method_on_associate_scalar_property(queryTrackingBehavior); + + AssertSql( + """ +SELECT `r`.`RequiredAssociate_Int` +FROM `RootEntity` AS `r` +"""); + } + + #endregion Structural properties + + #region Structural collection properties + + public override async Task Select_associate_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_associate_collection(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +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` +FROM `RootEntity` AS `r` +LEFT JOIN ( + SELECT `r0`.`RootEntityId`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r1`.`AssociateTypeRootEntityId`, `r1`.`AssociateTypeId`, `r1`.`Id` AS `Id0`, `r1`.`Int` AS `Int0`, `r1`.`Ints` AS `Ints0`, `r1`.`Name` AS `Name0`, `r1`.`String` AS `String0`, `r0`.`OptionalNestedAssociate_Id`, `r0`.`OptionalNestedAssociate_Int`, `r0`.`OptionalNestedAssociate_Ints`, `r0`.`OptionalNestedAssociate_Name`, `r0`.`OptionalNestedAssociate_String`, `r0`.`RequiredNestedAssociate_Id`, `r0`.`RequiredNestedAssociate_Int`, `r0`.`RequiredNestedAssociate_Ints`, `r0`.`RequiredNestedAssociate_Name`, `r0`.`RequiredNestedAssociate_String` + FROM `RelatedCollection` AS `r0` + LEFT JOIN `RelatedCollection_NestedCollection` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId` AND `r0`.`Id` = `r1`.`AssociateTypeId` +) AS `s` ON `r`.`Id` = `s`.`RootEntityId` +ORDER BY `r`.`Id`, `s`.`RootEntityId`, `s`.`Id`, `s`.`AssociateTypeRootEntityId`, `s`.`AssociateTypeId` +"""); + } + } + + public override async Task Select_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nested_collection_on_required_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r`.`Id`, `r0`.`AssociateTypeRootEntityId`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String` +FROM `RootEntity` AS `r` +LEFT JOIN `RequiredRelated_NestedCollection` AS `r0` ON `r`.`Id` = `r0`.`AssociateTypeRootEntityId` +ORDER BY `r`.`Id`, `r0`.`AssociateTypeRootEntityId` +"""); + } + } + + public override async Task Select_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_nested_collection_on_optional_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [r].[Id], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String] +FROM [RootEntity] AS [r] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +ORDER BY [r].[Id], [o].[AssociateTypeRootEntityId] +"""); + } + } + + public override async Task SelectMany_associate_collection(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_associate_collection(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r0`.`RootEntityId`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String`, `r`.`Id`, `r1`.`AssociateTypeRootEntityId`, `r1`.`AssociateTypeId`, `r1`.`Id`, `r1`.`Int`, `r1`.`Ints`, `r1`.`Name`, `r1`.`String`, `r0`.`OptionalNestedAssociate_Id`, `r0`.`OptionalNestedAssociate_Int`, `r0`.`OptionalNestedAssociate_Ints`, `r0`.`OptionalNestedAssociate_Name`, `r0`.`OptionalNestedAssociate_String`, `r0`.`RequiredNestedAssociate_Id`, `r0`.`RequiredNestedAssociate_Int`, `r0`.`RequiredNestedAssociate_Ints`, `r0`.`RequiredNestedAssociate_Name`, `r0`.`RequiredNestedAssociate_String` +FROM (`RootEntity` AS `r` +INNER JOIN `RelatedCollection` AS `r0` ON `r`.`Id` = `r0`.`RootEntityId`) +LEFT JOIN `RelatedCollection_NestedCollection` AS `r1` ON `r0`.`RootEntityId` = `r1`.`AssociateTypeRootEntityId` AND `r0`.`Id` = `r1`.`AssociateTypeId` +ORDER BY `r`.`Id`, `r0`.`RootEntityId`, `r0`.`Id`, `r1`.`AssociateTypeRootEntityId`, `r1`.`AssociateTypeId` +"""); + } + } + + public override async Task SelectMany_nested_collection_on_required_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_nested_collection_on_required_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT `r0`.`AssociateTypeRootEntityId`, `r0`.`Id`, `r0`.`Int`, `r0`.`Ints`, `r0`.`Name`, `r0`.`String` +FROM `RootEntity` AS `r` +INNER JOIN `RequiredRelated_NestedCollection` AS `r0` ON `r`.`Id` = `r0`.`AssociateTypeRootEntityId` +"""); + } + } + + public override async Task SelectMany_nested_collection_on_optional_associate(QueryTrackingBehavior queryTrackingBehavior) + { + await base.SelectMany_nested_collection_on_optional_associate(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String] +FROM [RootEntity] AS [r] +INNER JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +"""); + } + } + + #endregion Structural collection properties + + #region Multiple + + public override async Task Select_root_duplicated(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_root_duplicated(queryTrackingBehavior); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r2].[AssociateTypeRootEntityId], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String], [s0].[RootEntityId], [s0].[Id], [s0].[Int], [s0].[Ints], [s0].[Name], [s0].[String], [s0].[AssociateTypeRootEntityId], [s0].[AssociateTypeId], [s0].[Id0], [s0].[Int0], [s0].[Ints0], [s0].[Name0], [s0].[String0], [s0].[OptionalNestedAssociate_Id], [s0].[OptionalNestedAssociate_Int], [s0].[OptionalNestedAssociate_Ints], [s0].[OptionalNestedAssociate_Name], [s0].[OptionalNestedAssociate_String], [s0].[RequiredNestedAssociate_Id], [s0].[RequiredNestedAssociate_Int], [s0].[RequiredNestedAssociate_Ints], [s0].[RequiredNestedAssociate_Name], [s0].[RequiredNestedAssociate_String], [o0].[AssociateTypeRootEntityId], [o0].[Id], [o0].[Int], [o0].[Ints], [o0].[Name], [o0].[String], [r5].[AssociateTypeRootEntityId], [r5].[Id], [r5].[Int], [r5].[Ints], [r5].[Name], [r5].[String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r0].[RootEntityId], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r1].[AssociateTypeRootEntityId], [r1].[AssociateTypeId], [r1].[Id] AS [Id0], [r1].[Int] AS [Int0], [r1].[Ints] AS [Ints0], [r1].[Name] AS [Name0], [r1].[String] AS [String0], [r0].[OptionalNestedAssociate_Id], [r0].[OptionalNestedAssociate_Int], [r0].[OptionalNestedAssociate_Ints], [r0].[OptionalNestedAssociate_Name], [r0].[OptionalNestedAssociate_String], [r0].[RequiredNestedAssociate_Id], [r0].[RequiredNestedAssociate_Int], [r0].[RequiredNestedAssociate_Ints], [r0].[RequiredNestedAssociate_Name], [r0].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r0] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] AND [r0].[Id] = [r1].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r2] ON [r].[Id] = [r2].[AssociateTypeRootEntityId] +LEFT JOIN ( + SELECT [r3].[RootEntityId], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String], [r4].[AssociateTypeRootEntityId], [r4].[AssociateTypeId], [r4].[Id] AS [Id0], [r4].[Int] AS [Int0], [r4].[Ints] AS [Ints0], [r4].[Name] AS [Name0], [r4].[String] AS [String0], [r3].[OptionalNestedAssociate_Id], [r3].[OptionalNestedAssociate_Int], [r3].[OptionalNestedAssociate_Ints], [r3].[OptionalNestedAssociate_Name], [r3].[OptionalNestedAssociate_String], [r3].[RequiredNestedAssociate_Id], [r3].[RequiredNestedAssociate_Int], [r3].[RequiredNestedAssociate_Ints], [r3].[RequiredNestedAssociate_Name], [r3].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r3] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r4] ON [r3].[RootEntityId] = [r4].[AssociateTypeRootEntityId] AND [r3].[Id] = [r4].[AssociateTypeId] +) AS [s0] ON [r].[Id] = [s0].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o0] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o0].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r5] ON [r].[Id] = [r5].[AssociateTypeRootEntityId] +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r2].[AssociateTypeRootEntityId], [r2].[Id], [s0].[RootEntityId], [s0].[Id], [s0].[AssociateTypeRootEntityId], [s0].[AssociateTypeId], [s0].[Id0], [o0].[AssociateTypeRootEntityId], [o0].[Id], [r5].[AssociateTypeRootEntityId] +"""); + } + + #endregion Multiple + + #region Subquery + + public override async Task Select_subquery_required_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_required_related_FirstOrDefault(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [r1].[Id], [r1].[RequiredAssociate_RequiredNestedAssociate_Id], [r1].[RequiredAssociate_RequiredNestedAssociate_Int], [r1].[RequiredAssociate_RequiredNestedAssociate_Ints], [r1].[RequiredAssociate_RequiredNestedAssociate_Name], [r1].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) [r0].[Id], [r0].[RequiredAssociate_RequiredNestedAssociate_Id], [r0].[RequiredAssociate_RequiredNestedAssociate_Int], [r0].[RequiredAssociate_RequiredNestedAssociate_Ints], [r0].[RequiredAssociate_RequiredNestedAssociate_Name], [r0].[RequiredAssociate_RequiredNestedAssociate_String] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +"""); + } + } + + public override async Task Select_subquery_optional_related_FirstOrDefault(QueryTrackingBehavior queryTrackingBehavior) + { + await base.Select_subquery_optional_related_FirstOrDefault(queryTrackingBehavior); + + if (queryTrackingBehavior is not QueryTrackingBehavior.TrackAll) + { + AssertSql( + """ +SELECT [r1].[Id], [r1].[OptionalAssociate_RequiredNestedAssociate_Id], [r1].[OptionalAssociate_RequiredNestedAssociate_Int], [r1].[OptionalAssociate_RequiredNestedAssociate_Ints], [r1].[OptionalAssociate_RequiredNestedAssociate_Name], [r1].[OptionalAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +OUTER APPLY ( + SELECT TOP(1) [r0].[Id], [r0].[OptionalAssociate_RequiredNestedAssociate_Id], [r0].[OptionalAssociate_RequiredNestedAssociate_Int], [r0].[OptionalAssociate_RequiredNestedAssociate_Ints], [r0].[OptionalAssociate_RequiredNestedAssociate_Name], [r0].[OptionalAssociate_RequiredNestedAssociate_String] + FROM [RootEntity] AS [r0] + ORDER BY [r0].[Id] +) AS [r1] +"""); + } + } + + #endregion Subquery + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingStructuralEqualityJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingStructuralEqualityJetTest.cs new file mode 100644 index 00000000..74933456 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingStructuralEqualityJetTest.cs @@ -0,0 +1,235 @@ +using Microsoft.EntityFrameworkCore.Query.Associations.OwnedTableSplitting; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Query.Associations.OwnedTableSplitting; + +public class OwnedTableSplittingStructuralEqualityJetTest( + OwnedTableSplittingJetFixture fixture, + ITestOutputHelper testOutputHelper) + : OwnedTableSplittingStructuralEqualityRelationalTestBase(fixture, testOutputHelper) +{ + public override async Task Two_associates() + { + await base.Two_associates(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r2].[AssociateTypeRootEntityId], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r0].[RootEntityId], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r1].[AssociateTypeRootEntityId], [r1].[AssociateTypeId], [r1].[Id] AS [Id0], [r1].[Int] AS [Int0], [r1].[Ints] AS [Ints0], [r1].[Name] AS [Name0], [r1].[String] AS [String0], [r0].[OptionalNestedAssociate_Id], [r0].[OptionalNestedAssociate_Int], [r0].[OptionalNestedAssociate_Ints], [r0].[OptionalNestedAssociate_Name], [r0].[OptionalNestedAssociate_String], [r0].[RequiredNestedAssociate_Id], [r0].[RequiredNestedAssociate_Int], [r0].[RequiredNestedAssociate_Ints], [r0].[RequiredNestedAssociate_Name], [r0].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r0] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] AND [r0].[Id] = [r1].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r2] ON [r].[Id] = [r2].[AssociateTypeRootEntityId] +WHERE 0 = 1 +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r2].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Two_nested_associates() + { + await base.Two_nested_associates(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r2].[AssociateTypeRootEntityId], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r0].[RootEntityId], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r1].[AssociateTypeRootEntityId], [r1].[AssociateTypeId], [r1].[Id] AS [Id0], [r1].[Int] AS [Int0], [r1].[Ints] AS [Ints0], [r1].[Name] AS [Name0], [r1].[String] AS [String0], [r0].[OptionalNestedAssociate_Id], [r0].[OptionalNestedAssociate_Int], [r0].[OptionalNestedAssociate_Ints], [r0].[OptionalNestedAssociate_Name], [r0].[OptionalNestedAssociate_String], [r0].[RequiredNestedAssociate_Id], [r0].[RequiredNestedAssociate_Int], [r0].[RequiredNestedAssociate_Ints], [r0].[RequiredNestedAssociate_Name], [r0].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r0] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] AND [r0].[Id] = [r1].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r2] ON [r].[Id] = [r2].[AssociateTypeRootEntityId] +WHERE 0 = 1 +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r2].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Not_equals() + { + await base.Not_equals(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r2].[AssociateTypeRootEntityId], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r0].[RootEntityId], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r1].[AssociateTypeRootEntityId], [r1].[AssociateTypeId], [r1].[Id] AS [Id0], [r1].[Int] AS [Int0], [r1].[Ints] AS [Ints0], [r1].[Name] AS [Name0], [r1].[String] AS [String0], [r0].[OptionalNestedAssociate_Id], [r0].[OptionalNestedAssociate_Int], [r0].[OptionalNestedAssociate_Ints], [r0].[OptionalNestedAssociate_Name], [r0].[OptionalNestedAssociate_String], [r0].[RequiredNestedAssociate_Id], [r0].[RequiredNestedAssociate_Int], [r0].[RequiredNestedAssociate_Ints], [r0].[RequiredNestedAssociate_Name], [r0].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r0] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] AND [r0].[Id] = [r1].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r2] ON [r].[Id] = [r2].[AssociateTypeRootEntityId] +WHERE 0 = 1 +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r2].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Associate_with_inline_null() + { + await base.Associate_with_inline_null(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r2].[AssociateTypeRootEntityId], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r0].[RootEntityId], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r1].[AssociateTypeRootEntityId], [r1].[AssociateTypeId], [r1].[Id] AS [Id0], [r1].[Int] AS [Int0], [r1].[Ints] AS [Ints0], [r1].[Name] AS [Name0], [r1].[String] AS [String0], [r0].[OptionalNestedAssociate_Id], [r0].[OptionalNestedAssociate_Int], [r0].[OptionalNestedAssociate_Ints], [r0].[OptionalNestedAssociate_Name], [r0].[OptionalNestedAssociate_String], [r0].[RequiredNestedAssociate_Id], [r0].[RequiredNestedAssociate_Int], [r0].[RequiredNestedAssociate_Ints], [r0].[RequiredNestedAssociate_Name], [r0].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r0] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] AND [r0].[Id] = [r1].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r2] ON [r].[Id] = [r2].[AssociateTypeRootEntityId] +WHERE [r].[OptionalAssociate_Id] IS NULL OR [r].[OptionalAssociate_Int] IS NULL OR [r].[OptionalAssociate_Ints] IS NULL OR [r].[OptionalAssociate_Name] IS NULL OR [r].[OptionalAssociate_String] IS NULL +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r2].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Associate_with_parameter_null() + { + await base.Associate_with_parameter_null(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r2].[AssociateTypeRootEntityId], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r0].[RootEntityId], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r1].[AssociateTypeRootEntityId], [r1].[AssociateTypeId], [r1].[Id] AS [Id0], [r1].[Int] AS [Int0], [r1].[Ints] AS [Ints0], [r1].[Name] AS [Name0], [r1].[String] AS [String0], [r0].[OptionalNestedAssociate_Id], [r0].[OptionalNestedAssociate_Int], [r0].[OptionalNestedAssociate_Ints], [r0].[OptionalNestedAssociate_Name], [r0].[OptionalNestedAssociate_String], [r0].[RequiredNestedAssociate_Id], [r0].[RequiredNestedAssociate_Int], [r0].[RequiredNestedAssociate_Ints], [r0].[RequiredNestedAssociate_Name], [r0].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r0] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] AND [r0].[Id] = [r1].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r2] ON [r].[Id] = [r2].[AssociateTypeRootEntityId] +WHERE CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END IS NULL +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r2].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Nested_associate_with_inline_null() + { + await base.Nested_associate_with_inline_null(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r2].[AssociateTypeRootEntityId], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r0].[RootEntityId], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r1].[AssociateTypeRootEntityId], [r1].[AssociateTypeId], [r1].[Id] AS [Id0], [r1].[Int] AS [Int0], [r1].[Ints] AS [Ints0], [r1].[Name] AS [Name0], [r1].[String] AS [String0], [r0].[OptionalNestedAssociate_Id], [r0].[OptionalNestedAssociate_Int], [r0].[OptionalNestedAssociate_Ints], [r0].[OptionalNestedAssociate_Name], [r0].[OptionalNestedAssociate_String], [r0].[RequiredNestedAssociate_Id], [r0].[RequiredNestedAssociate_Int], [r0].[RequiredNestedAssociate_Ints], [r0].[RequiredNestedAssociate_Name], [r0].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r0] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] AND [r0].[Id] = [r1].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r2] ON [r].[Id] = [r2].[AssociateTypeRootEntityId] +WHERE [r].[RequiredAssociate_OptionalNestedAssociate_Id] IS NULL OR [r].[RequiredAssociate_OptionalNestedAssociate_Int] IS NULL OR [r].[RequiredAssociate_OptionalNestedAssociate_Ints] IS NULL OR [r].[RequiredAssociate_OptionalNestedAssociate_Name] IS NULL OR [r].[RequiredAssociate_OptionalNestedAssociate_String] IS NULL +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r2].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Nested_associate_with_inline() + { + await base.Nested_associate_with_inline(); + + AssertSql( + ); + } + + public override async Task Nested_associate_with_parameter() + { + await base.Nested_associate_with_parameter(); + + AssertSql( + ); + } + + public override async Task Two_nested_collections() + { + await base.Two_nested_collections(); + + AssertSql( + """ +SELECT [r].[Id], [r].[Name], [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], [r].[OptionalAssociate_Id], [r].[OptionalAssociate_Int], [r].[OptionalAssociate_Ints], [r].[OptionalAssociate_Name], [r].[OptionalAssociate_String], [o].[AssociateTypeRootEntityId], [o].[Id], [o].[Int], [o].[Ints], [o].[Name], [o].[String], [r].[OptionalAssociate_OptionalNestedAssociate_Id], [r].[OptionalAssociate_OptionalNestedAssociate_Int], [r].[OptionalAssociate_OptionalNestedAssociate_Ints], [r].[OptionalAssociate_OptionalNestedAssociate_Name], [r].[OptionalAssociate_OptionalNestedAssociate_String], [r].[OptionalAssociate_RequiredNestedAssociate_Id], [r].[OptionalAssociate_RequiredNestedAssociate_Int], [r].[OptionalAssociate_RequiredNestedAssociate_Ints], [r].[OptionalAssociate_RequiredNestedAssociate_Name], [r].[OptionalAssociate_RequiredNestedAssociate_String], [r].[RequiredAssociate_Id], [r].[RequiredAssociate_Int], [r].[RequiredAssociate_Ints], [r].[RequiredAssociate_Name], [r].[RequiredAssociate_String], [r2].[AssociateTypeRootEntityId], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r].[RequiredAssociate_OptionalNestedAssociate_Id], [r].[RequiredAssociate_OptionalNestedAssociate_Int], [r].[RequiredAssociate_OptionalNestedAssociate_Ints], [r].[RequiredAssociate_OptionalNestedAssociate_Name], [r].[RequiredAssociate_OptionalNestedAssociate_String], [r].[RequiredAssociate_RequiredNestedAssociate_Id], [r].[RequiredAssociate_RequiredNestedAssociate_Int], [r].[RequiredAssociate_RequiredNestedAssociate_Ints], [r].[RequiredAssociate_RequiredNestedAssociate_Name], [r].[RequiredAssociate_RequiredNestedAssociate_String] +FROM [RootEntity] AS [r] +LEFT JOIN ( + SELECT [r0].[RootEntityId], [r0].[Id], [r0].[Int], [r0].[Ints], [r0].[Name], [r0].[String], [r1].[AssociateTypeRootEntityId], [r1].[AssociateTypeId], [r1].[Id] AS [Id0], [r1].[Int] AS [Int0], [r1].[Ints] AS [Ints0], [r1].[Name] AS [Name0], [r1].[String] AS [String0], [r0].[OptionalNestedAssociate_Id], [r0].[OptionalNestedAssociate_Int], [r0].[OptionalNestedAssociate_Ints], [r0].[OptionalNestedAssociate_Name], [r0].[OptionalNestedAssociate_String], [r0].[RequiredNestedAssociate_Id], [r0].[RequiredNestedAssociate_Int], [r0].[RequiredNestedAssociate_Ints], [r0].[RequiredNestedAssociate_Name], [r0].[RequiredNestedAssociate_String] + FROM [RelatedCollection] AS [r0] + LEFT JOIN [RelatedCollection_NestedCollection] AS [r1] ON [r0].[RootEntityId] = [r1].[AssociateTypeRootEntityId] AND [r0].[Id] = [r1].[AssociateTypeId] +) AS [s] ON [r].[Id] = [s].[RootEntityId] +LEFT JOIN [OptionalRelated_NestedCollection] AS [o] ON CASE + WHEN [r].[OptionalAssociate_Id] IS NOT NULL AND [r].[OptionalAssociate_Int] IS NOT NULL AND [r].[OptionalAssociate_Ints] IS NOT NULL AND [r].[OptionalAssociate_Name] IS NOT NULL AND [r].[OptionalAssociate_String] IS NOT NULL THEN [r].[Id] +END = [o].[AssociateTypeRootEntityId] +LEFT JOIN [RequiredRelated_NestedCollection] AS [r2] ON [r].[Id] = [r2].[AssociateTypeRootEntityId] +WHERE 0 = 1 +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [o].[AssociateTypeRootEntityId], [o].[Id], [r2].[AssociateTypeRootEntityId] +"""); + } + + public override async Task Nested_collection_with_inline() + { + await base.Nested_collection_with_inline(); + + AssertSql(); + } + + public override async Task Nested_collection_with_parameter() + { + await base.Nested_collection_with_parameter(); + + AssertSql(); + } + + #region Contains + + public override async Task Contains_with_inline() + { + await base.Contains_with_inline(); + + AssertSql(); + } + + public override async Task Contains_with_parameter() + { + await base.Contains_with_parameter(); + + AssertSql(); + } + + public override async Task Contains_with_operators_composed_on_the_collection() + { + await base.Contains_with_operators_composed_on_the_collection(); + + AssertSql(); + } + + public override async Task Contains_with_nested_and_composed_operators() + { + await base.Contains_with_nested_and_composed_operators(); + + AssertSql(); + } + + #endregion Contains + + [ConditionalFact] + public virtual void Check_all_tests_overridden() + => TestHelpers.AssertAllMethodsOverridden(GetType()); +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs index 2db81f5a..d0849614 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs @@ -467,6 +467,18 @@ public override async Task Project_struct_complex_type_via_optional_navigation(b """); } + public override async Task Project_nullable_struct_complex_type_via_optional_navigation(bool async) + { + await base.Project_nullable_struct_complex_type_via_optional_navigation(async); + + AssertSql( + """ +SELECT `v0`.`ShippingAddress_AddressLine1`, `v0`.`ShippingAddress_AddressLine2`, `v0`.`ShippingAddress_ZipCode`, `v0`.`ShippingAddress_Country_Code`, `v0`.`ShippingAddress_Country_FullName` +FROM `ValuedCustomerGroup` AS `v` +LEFT JOIN `ValuedCustomer` AS `v0` ON `v`.`OptionalCustomerId` = `v0`.`Id` +"""); + } + public override async Task Project_struct_complex_type_via_required_navigation(bool async) { await base.Project_struct_complex_type_via_required_navigation(async); diff --git a/test/EFCore.Jet.FunctionalTests/Query/DbFunctionsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/DbFunctionsJetTest.cs index 2052f20b..7bec0cbb 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/DbFunctionsJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/DbFunctionsJetTest.cs @@ -452,9 +452,9 @@ await AssertQueryScalar( AssertSql( """ -SELECT CBOOL(ISDATE(`o`.`CustomerID`)) +SELECT CBOOL(ISDATE(`o`.`CustomerID`)) * -1 FROM `Orders` AS `o` -WHERE NOT (CBOOL(ISDATE(`o`.`CustomerID`))) +WHERE NOT (CBOOL(ISDATE(`o`.`CustomerID`)) * -1) """); } @@ -471,9 +471,9 @@ await AssertQueryScalar( AssertSql( """ -SELECT CBOOL(ISDATE(IIF((`o`.`OrderDate` & '') IS NULL, '', (`o`.`OrderDate` & '')))) +SELECT CBOOL(ISDATE(IIF((`o`.`OrderDate` & '') IS NULL, '', (`o`.`OrderDate` & '')))) * -1 FROM `Orders` AS `o` -WHERE CBOOL(ISDATE(IIF((`o`.`OrderDate` & '') IS NULL, '', (`o`.`OrderDate` & '')))) +WHERE CBOOL(ISDATE(IIF((`o`.`OrderDate` & '') IS NULL, '', (`o`.`OrderDate` & '')))) * -1 """); } @@ -492,7 +492,7 @@ await AssertCount( """ SELECT COUNT(*) FROM `Orders` AS `o` -WHERE CBOOL(ISDATE(IIF(`o`.`CustomerID` IS NULL, '', `o`.`CustomerID`) & (`o`.`OrderID` & ''))) +WHERE CBOOL(ISDATE(IIF(`o`.`CustomerID` IS NULL, '', `o`.`CustomerID`) & (`o`.`OrderID` & ''))) * -1 """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs index 1b2d871e..3be7ae50 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs @@ -7363,6 +7363,21 @@ ORDER BY `g`.`Nickname` """); } + public override async Task Enum_array_contains(bool async) + { + await base.Enum_array_contains(async); + + AssertSql( + """ +@types1='1' + +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM `Weapons` AS `w` +LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +WHERE `w0`.`Id` IS NOT NULL AND (`w0`.`AmmunitionType` IS NULL OR `w0`.`AmmunitionType` = @types1) +"""); + } + public override async Task Coalesce_with_non_root_evaluatable_Convert(bool async) { await base.Coalesce_with_non_root_evaluatable_Convert(async); diff --git a/test/EFCore.Jet.FunctionalTests/Query/LazyLoadProxyJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/LazyLoadProxyJetTest.cs new file mode 100644 index 00000000..14645b1f --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/LazyLoadProxyJetTest.cs @@ -0,0 +1,545 @@ +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System; +using System.IO; +using System.Threading.Tasks; +using Xunit; + +namespace Microsoft.EntityFrameworkCore; + +#nullable disable + +public class LazyLoadProxyJetTest : LazyLoadProxyRelationalTestBase +{ + public LazyLoadProxyJetTest(LoadJetFixture fixture) + : base(fixture) + => fixture.TestSqlLoggerFactory.Clear(); + + public override void Lazy_load_collection(EntityState state, bool useAttach, bool useDetach) + { + base.Lazy_load_collection(state, useAttach, useDetach); + + AssertSql( + state == EntityState.Detached && useAttach + ? "" + : """ +@p='707' (Nullable = true) + +SELECT `c`.`Id`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` +FROM `Child` AS `c` +WHERE `c`.`ParentId` = @p +"""); + } + + public override void Lazy_load_many_to_one_reference_to_principal(EntityState state, bool useAttach, bool useDetach) + { + base.Lazy_load_many_to_one_reference_to_principal(state, useAttach, useDetach); + + AssertSql( + state == EntityState.Detached && useAttach + ? "" + : """ +@p='707' + +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +FROM `Parent` AS `p` +WHERE `p`.`Id` = @p +"""); + } + + public override void Lazy_load_one_to_one_reference_to_principal(EntityState state, bool useAttach, bool useDetach) + { + base.Lazy_load_one_to_one_reference_to_principal(state, useAttach, useDetach); + + AssertSql( + state == EntityState.Detached && useAttach + ? "" + : """ +@p='707' + +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +FROM `Parent` AS `p` +WHERE `p`.`Id` = @p +"""); + } + + public override void Lazy_load_one_to_one_reference_to_dependent(EntityState state, bool useAttach, bool useDetach) + { + base.Lazy_load_one_to_one_reference_to_dependent(state, useAttach, useDetach); + + AssertSql( + state == EntityState.Detached && useAttach + ? "" + : """ +@p='707' (Nullable = true) + +SELECT TOP 1 `s`.`Id`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` +FROM `Single` AS `s` +WHERE `s`.`ParentId` = @p +"""); + } + + public override void Lazy_load_one_to_one_PK_to_PK_reference_to_principal(EntityState state) + { + base.Lazy_load_one_to_one_PK_to_PK_reference_to_principal(state); + + AssertSql( + """ +@p='707' + +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +FROM `Parent` AS `p` +WHERE `p`.`Id` = @p +"""); + } + + public override void Lazy_load_one_to_one_PK_to_PK_reference_to_dependent(EntityState state) + { + base.Lazy_load_one_to_one_PK_to_PK_reference_to_dependent(state); + + AssertSql( + """ +@p='707' + +SELECT TOP 1 `s`.`Id`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` +FROM `SinglePkToPk` AS `s` +WHERE `s`.`Id` = @p +"""); + } + + public override void Lazy_load_many_to_one_reference_to_principal_null_FK(EntityState state) + { + base.Lazy_load_many_to_one_reference_to_principal_null_FK(state); + + AssertSql(@""); + } + + public override void Lazy_load_one_to_one_reference_to_principal_null_FK(EntityState state) + { + base.Lazy_load_one_to_one_reference_to_principal_null_FK(state); + + AssertSql(@""); + } + + public override void Lazy_load_collection_not_found(EntityState state) + { + base.Lazy_load_collection_not_found(state); + + AssertSql( + """ +@p='767' (Nullable = true) + +SELECT `c`.`Id`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` +FROM `Child` AS `c` +WHERE `c`.`ParentId` = @p +"""); + } + + public override void Lazy_load_many_to_one_reference_to_principal_not_found(EntityState state) + { + base.Lazy_load_many_to_one_reference_to_principal_not_found(state); + + AssertSql( + """ +@p='787' + +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +FROM `Parent` AS `p` +WHERE `p`.`Id` = @p +"""); + } + + public override void Lazy_load_one_to_one_reference_to_principal_not_found(EntityState state) + { + base.Lazy_load_one_to_one_reference_to_principal_not_found(state); + + AssertSql( + """ +@p='787' + +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +FROM `Parent` AS `p` +WHERE `p`.`Id` = @p +"""); + } + + public override void Lazy_load_one_to_one_reference_to_dependent_not_found(EntityState state) + { + base.Lazy_load_one_to_one_reference_to_dependent_not_found(state); + + AssertSql( + """ +@p='767' (Nullable = true) + +SELECT TOP 1 `s`.`Id`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` +FROM `Single` AS `s` +WHERE `s`.`ParentId` = @p +"""); + } + + public override void Lazy_load_collection_already_loaded(EntityState state, CascadeTiming cascadeDeleteTiming) + { + base.Lazy_load_collection_already_loaded(state, cascadeDeleteTiming); + + AssertSql(@""); + } + + public override void Lazy_load_many_to_one_reference_to_principal_already_loaded( + EntityState state, + CascadeTiming cascadeDeleteTiming) + { + base.Lazy_load_many_to_one_reference_to_principal_already_loaded(state, cascadeDeleteTiming); + + AssertSql(@""); + } + + public override void Lazy_load_one_to_one_reference_to_principal_already_loaded(EntityState state) + { + base.Lazy_load_one_to_one_reference_to_principal_already_loaded(state); + + AssertSql(@""); + } + + public override void Lazy_load_one_to_one_reference_to_dependent_already_loaded( + EntityState state, + CascadeTiming cascadeDeleteTiming) + { + base.Lazy_load_one_to_one_reference_to_dependent_already_loaded(state, cascadeDeleteTiming); + + AssertSql(@""); + } + + public override void Lazy_load_one_to_one_PK_to_PK_reference_to_principal_already_loaded(EntityState state) + { + base.Lazy_load_one_to_one_PK_to_PK_reference_to_principal_already_loaded(state); + + AssertSql(@""); + } + + public override void Lazy_load_one_to_one_PK_to_PK_reference_to_dependent_already_loaded(EntityState state) + { + base.Lazy_load_one_to_one_PK_to_PK_reference_to_dependent_already_loaded(state); + + AssertSql(@""); + } + + public override void Lazy_load_many_to_one_reference_to_principal_alternate_key(EntityState state) + { + base.Lazy_load_many_to_one_reference_to_principal_alternate_key(state); + + AssertSql( + """ +@p='Root' (Size = 255) + +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +FROM `Parent` AS `p` +WHERE `p`.`AlternateId` = @p +"""); + } + + public override void Lazy_load_one_to_one_reference_to_principal_alternate_key(EntityState state) + { + base.Lazy_load_one_to_one_reference_to_principal_alternate_key(state); + + AssertSql( + """ +@p='Root' (Size = 255) + +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +FROM `Parent` AS `p` +WHERE `p`.`AlternateId` = @p +"""); + } + + public override void Lazy_load_one_to_one_reference_to_dependent_alternate_key(EntityState state) + { + base.Lazy_load_one_to_one_reference_to_dependent_alternate_key(state); + + AssertSql( + """ +@p='Root' (Size = 255) + +SELECT TOP 1 `s`.`Id`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` +FROM `SingleAk` AS `s` +WHERE `s`.`ParentId` = @p +"""); + } + + public override void Lazy_load_many_to_one_reference_to_principal_null_FK_alternate_key(EntityState state) + { + base.Lazy_load_many_to_one_reference_to_principal_null_FK_alternate_key(state); + + AssertSql(@""); + } + + public override void Lazy_load_one_to_one_reference_to_principal_null_FK_alternate_key(EntityState state) + { + base.Lazy_load_one_to_one_reference_to_principal_null_FK_alternate_key(state); + + AssertSql(@""); + } + + public override void Lazy_load_collection_shadow_fk(EntityState state) + { + base.Lazy_load_collection_shadow_fk(state); + + AssertSql( + """ +@p='707' (Nullable = true) + +SELECT `c`.`Id`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` +FROM `ChildShadowFk` AS `c` +WHERE `c`.`ParentId` = @p +"""); + } + + public override void Lazy_load_many_to_one_reference_to_principal_shadow_fk(EntityState state) + { + base.Lazy_load_many_to_one_reference_to_principal_shadow_fk(state); + + AssertSql( + state == EntityState.Detached + ? "" + : """ +@p='707' + +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +FROM `Parent` AS `p` +WHERE `p`.`Id` = @p +"""); + } + + public override void Lazy_load_one_to_one_reference_to_principal_shadow_fk(EntityState state) + { + base.Lazy_load_one_to_one_reference_to_principal_shadow_fk(state); + + AssertSql( + state == EntityState.Detached + ? "" + : """ +@p='707' + +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +FROM `Parent` AS `p` +WHERE `p`.`Id` = @p +"""); + } + + public override void Lazy_load_one_to_one_reference_to_dependent_shadow_fk(EntityState state) + { + base.Lazy_load_one_to_one_reference_to_dependent_shadow_fk(state); + + AssertSql( + """ +@p='707' (Nullable = true) + +SELECT TOP 1 `s`.`Id`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` +FROM `SingleShadowFk` AS `s` +WHERE `s`.`ParentId` = @p +"""); + } + + public override void Lazy_load_many_to_one_reference_to_principal_null_FK_shadow_fk(EntityState state) + { + base.Lazy_load_many_to_one_reference_to_principal_null_FK_shadow_fk(state); + + AssertSql(@""); + } + + public override void Lazy_load_one_to_one_reference_to_principal_null_FK_shadow_fk(EntityState state) + { + base.Lazy_load_one_to_one_reference_to_principal_null_FK_shadow_fk(state); + + AssertSql(@""); + } + + public override void Lazy_load_collection_composite_key(EntityState state) + { + base.Lazy_load_collection_composite_key(state); + + AssertSql( + """ +@p='Root' (Size = 255) +@p0='707' (Nullable = true) + +SELECT `c`.`Id`, `c`.`ParentAlternateId`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` +FROM `ChildCompositeKey` AS `c` +WHERE `c`.`ParentAlternateId` = @p AND `c`.`ParentId` = @p0 +"""); + } + + public override void Lazy_load_many_to_one_reference_to_principal_composite_key(EntityState state) + { + base.Lazy_load_many_to_one_reference_to_principal_composite_key(state); + + AssertSql( + """ +@p='Root' (Size = 255) +@p0='707' + +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +FROM `Parent` AS `p` +WHERE `p`.`AlternateId` = @p AND `p`.`Id` = @p0 +"""); + } + + public override void Lazy_load_one_to_one_reference_to_principal_composite_key(EntityState state) + { + base.Lazy_load_one_to_one_reference_to_principal_composite_key(state); + + AssertSql( + """ +@p='Root' (Size = 255) +@p0='707' + +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +FROM `Parent` AS `p` +WHERE `p`.`AlternateId` = @p AND `p`.`Id` = @p0 +"""); + } + + public override void Lazy_load_one_to_one_reference_to_dependent_composite_key(EntityState state) + { + base.Lazy_load_one_to_one_reference_to_dependent_composite_key(state); + + AssertSql( + """ +@p='Root' (Size = 255) +@p0='707' (Nullable = true) + +SELECT TOP 1 `s`.`Id`, `s`.`ParentAlternateId`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` +FROM `SingleCompositeKey` AS `s` +WHERE `s`.`ParentAlternateId` = @p AND `s`.`ParentId` = @p0 +"""); + } + + public override void Lazy_load_many_to_one_reference_to_principal_null_FK_composite_key(EntityState state) + { + base.Lazy_load_many_to_one_reference_to_principal_null_FK_composite_key(state); + + AssertSql(@""); + } + + public override void Lazy_load_one_to_one_reference_to_principal_null_FK_composite_key(EntityState state) + { + base.Lazy_load_one_to_one_reference_to_principal_null_FK_composite_key(state); + + AssertSql(@""); + } + + public override async Task Load_collection(EntityState state, bool async) + { + await base.Load_collection(state, async); + + if (!async) + { + AssertSql( + """ +@p='707' (Nullable = true) + +SELECT `c`.`Id`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` +FROM `Child` AS `c` +WHERE `c`.`ParentId` = @p +"""); + } + } + + [ConditionalFact] + public override void Top_level_projection_track_entities_before_passing_to_client_method() + { + base.Top_level_projection_track_entities_before_passing_to_client_method(); + + AssertSql( + """ +SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` +FROM `Parent` AS `p` +ORDER BY `p`.`Id` + +@p='707' (Nullable = true) + +SELECT TOP 1 `s`.`Id`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` +FROM `Single` AS `s` +WHERE `s`.`ParentId` = @p +"""); + } + + public override async Task Entity_equality_with_proxy_parameter(bool async) + { + await base.Entity_equality_with_proxy_parameter(async); + + AssertSql( + """ +@entity_equality_called_Id='707' (Nullable = true) + +SELECT `c`.`Id`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` +FROM `Child` AS `c` +LEFT JOIN `Parent` AS `p` ON `c`.`ParentId` = `p`.`Id` +WHERE `p`.`Id` = @entity_equality_called_Id +"""); + } + + protected override void ClearLog() + => Fixture.TestSqlLoggerFactory.Clear(); + + protected override void RecordLog() + => Sql = Fixture.TestSqlLoggerFactory.Sql; + + private const string FileNewLine = @" +"; + + private void AssertSql(string expected) + { + expected ??= ""; + var sql = Sql ?? ""; + try + { + Assert.Equal( + expected, sql, ignoreLineEndingDifferences: true); + } + catch + { + var methodCallLine = Environment.StackTrace.Split( + [Environment.NewLine], + StringSplitOptions.RemoveEmptyEntries)[2][6..]; + + var indexMethodEnding = methodCallLine.IndexOf(')') + 1; + var testName = methodCallLine.Substring(0, indexMethodEnding); + var parts = methodCallLine[indexMethodEnding..].Split(" ", StringSplitOptions.RemoveEmptyEntries); + var fileName = parts[1][..^5]; + var lineNumber = int.Parse(parts[2]); + + var currentDirectory = Directory.GetCurrentDirectory(); + var logFile = currentDirectory.Substring( + 0, + currentDirectory.LastIndexOf( + $"{Path.DirectorySeparatorChar}artifacts{Path.DirectorySeparatorChar}", + StringComparison.Ordinal) + + 1) + + "QueryBaseline.txt"; + + var testInfo = testName + " : " + lineNumber + FileNewLine; + var newBaseLine = $@" AssertSql( + {"@\"" + sql.Replace("\"", "\"\"") + "\""}); + +"; + + var contents = testInfo + newBaseLine + FileNewLine + "--------------------" + FileNewLine; + + File.AppendAllText(logFile, contents); + + throw; + } + } + + private string Sql { get; set; } + + public class LoadJetFixture : LoadRelationalFixtureBase + { + public TestSqlLoggerFactory TestSqlLoggerFactory + => (TestSqlLoggerFactory)ListLoggerFactory; + + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs index 94231cf9..ea6f180f 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs @@ -44,6 +44,9 @@ public override async Task LastOrDefault_when_no_order_by(bool async) AssertSql(); } + public override async Task Contains_with_local_tuple_array_closure(bool async) + => await AssertTranslationFailed(() => base.Contains_with_local_tuple_array_closure(async)); + public override async Task Array_cast_to_IEnumerable_Contains_with_constant(bool async) { await base.Array_cast_to_IEnumerable_Contains_with_constant(async); @@ -152,6 +155,60 @@ SELECT MIN(`o`.`OrderID` - 10248) """); } + public override async Task Average_after_DefaultIfEmpty_does_not_throw(bool async) + { + await base.Average_after_DefaultIfEmpty_does_not_throw(async); + + AssertSql( + """ +SELECT AVG(CAST(COALESCE([o0].[OrderID], 0) AS float)) +FROM ( + SELECT 1 AS empty +) AS [e] +LEFT JOIN ( + SELECT [o].[OrderID] + FROM [Orders] AS [o] + WHERE [o].[OrderID] = 10243 +) AS [o0] ON 1 = 1 +"""); + } + + public override async Task Max_after_DefaultIfEmpty_does_not_throw(bool async) + { + await base.Max_after_DefaultIfEmpty_does_not_throw(async); + + AssertSql( + """ +SELECT MAX(COALESCE([o0].[OrderID], 0)) +FROM ( + SELECT 1 AS empty +) AS [e] +LEFT JOIN ( + SELECT [o].[OrderID] + FROM [Orders] AS [o] + WHERE [o].[OrderID] = 10243 +) AS [o0] ON 1 = 1 +"""); + } + + public override async Task Min_after_DefaultIfEmpty_does_not_throw(bool async) + { + await base.Min_after_DefaultIfEmpty_does_not_throw(async); + + AssertSql( + """ +SELECT MIN(COALESCE([o0].[OrderID], 0)) +FROM ( + SELECT 1 AS empty +) AS [e] +LEFT JOIN ( + SELECT [o].[OrderID] + FROM [Orders] AS [o] + WHERE [o].[OrderID] = 10243 +) AS [o0] ON 1 = 1 +"""); + } + public override async Task Sum_with_no_data_cast_to_nullable(bool async) { await base.Sum_with_no_data_cast_to_nullable(async); @@ -1594,6 +1651,29 @@ public override async Task Contains_with_local_uint_array_closure(bool isAsync) """ @ids1='0' +SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` +FROM `Employees` AS `e` +WHERE `e`.`EmployeeID` = @ids1 +"""); + } + + public override async Task Contains_with_local_nullable_uint_array_closure(bool async) + { + await base.Contains_with_local_nullable_uint_array_closure(async); + + AssertSql( + """ +@ids1='0' +@ids2='1' + +SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` +FROM `Employees` AS `e` +WHERE `e`.`EmployeeID` IN (@ids1, @ids2) +""", + // + """ +@ids1='0' + SELECT `e`.`EmployeeID`, `e`.`City`, `e`.`Country`, `e`.`FirstName`, `e`.`ReportsTo`, `e`.`Title` FROM `Employees` AS `e` WHERE `e`.`EmployeeID` = @ids1 @@ -2088,6 +2168,13 @@ SELECT @p IN ( """); } + public override async Task Contains_with_local_anonymous_type_array_closure(bool async) + { + await AssertTranslationFailed(() => base.Contains_with_local_anonymous_type_array_closure(async)); + + AssertSql(); + } + public override async Task OfType_Select(bool async) { await base.OfType_Select(async); diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs index 7b0d56a1..5324ad2f 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs @@ -420,6 +420,125 @@ SELECT TOP 1 `o1`.`ProductID` """); } + public override async Task DefaultIfEmpty_top_level(bool async) + { + await base.DefaultIfEmpty_top_level(async); + + AssertSql( + """ +SELECT [e1].[EmployeeID], [e1].[City], [e1].[Country], [e1].[FirstName], [e1].[ReportsTo], [e1].[Title] +FROM ( + SELECT 1 AS empty +) AS [e0] +LEFT JOIN ( + SELECT [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] + FROM [Employees] AS [e] + WHERE [e].[EmployeeID] = -1 +) AS [e1] ON 1 = 1 +"""); + } + + public override async Task Join_with_DefaultIfEmpty_on_both_sources(bool async) + { + await base.Join_with_DefaultIfEmpty_on_both_sources(async); + + AssertSql( + """ +SELECT [e1].[EmployeeID], [e1].[City], [e1].[Country], [e1].[FirstName], [e1].[ReportsTo], [e1].[Title] +FROM ( + SELECT 1 AS empty +) AS [e0] +LEFT JOIN ( + SELECT [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] + FROM [Employees] AS [e] + WHERE [e].[EmployeeID] = -1 +) AS [e1] ON 1 = 1 +INNER JOIN ( + SELECT [e4].[EmployeeID] + FROM ( + SELECT 1 AS empty + ) AS [e3] + LEFT JOIN ( + SELECT [e2].[EmployeeID] + FROM [Employees] AS [e2] + WHERE [e2].[EmployeeID] = -1 + ) AS [e4] ON 1 = 1 +) AS [s] ON [e1].[EmployeeID] = [s].[EmployeeID] +"""); + } + + public override async Task DefaultIfEmpty_top_level_followed_by_constant_Select(bool async) + { + await base.DefaultIfEmpty_top_level_followed_by_constant_Select(async); + + AssertSql( + """ +SELECT N'Foo' +FROM ( + SELECT 1 AS empty +) AS [e0] +LEFT JOIN ( + SELECT 1 AS empty + FROM [Employees] AS [e] + WHERE [e].[EmployeeID] = -1 +) AS [e1] ON 1 = 1 +"""); + } + + public override async Task DefaultIfEmpty_top_level_preceded_by_constant_Select(bool async) + { + await base.DefaultIfEmpty_top_level_preceded_by_constant_Select(async); + + AssertSql( + """ +SELECT [e1].[c] +FROM ( + SELECT 1 AS empty +) AS [e0] +LEFT JOIN ( + SELECT N'Foo' AS [c] + FROM [Employees] AS [e] + WHERE [e].[EmployeeID] = -1 +) AS [e1] ON 1 = 1 +"""); + } + + public override async Task DefaultIfEmpty_top_level_positive(bool async) + { + await base.DefaultIfEmpty_top_level_positive(async); + + AssertSql( + """ +SELECT [e1].[EmployeeID], [e1].[City], [e1].[Country], [e1].[FirstName], [e1].[ReportsTo], [e1].[Title] +FROM ( + SELECT 1 AS empty +) AS [e0] +LEFT JOIN ( + SELECT [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] + FROM [Employees] AS [e] + WHERE [e].[EmployeeID] > 0 +) AS [e1] ON 1 = 1 +"""); + } + + public override async Task DefaultIfEmpty_top_level_projection(bool async) + { + await base.DefaultIfEmpty_top_level_projection(async); + + AssertSql( + """ +SELECT COALESCE([e1].[EmployeeID], 0) +FROM ( + SELECT 1 AS empty +) AS [e0] +LEFT JOIN ( + SELECT [e].[EmployeeID] + FROM [Employees] AS [e] + WHERE [e].[EmployeeID] = -1 +) AS [e1] ON 1 = 1 +"""); + } + public override async Task Where_query_composition(bool isAsync) { await base.Where_query_composition(isAsync); @@ -6213,6 +6332,38 @@ public override async Task SelectMany_correlated_subquery_simple(bool async) """); } + public override async Task SelectMany_correlated_with_DefaultIfEmpty_and_Select_value_type_in_selector_throws(bool async) + { + await base.SelectMany_correlated_with_DefaultIfEmpty_and_Select_value_type_in_selector_throws(async); + + AssertSql( + """ +SELECT `o0`.`OrderID` +FROM `Customers` AS `c` +LEFT JOIN ( + SELECT `o`.`OrderID`, `o`.`CustomerID` + FROM `Orders` AS `o` + WHERE `o`.`CustomerID` = 'NONEXISTENT' +) AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` +"""); + } + + public override async Task SelectMany_correlated_with_Select_value_type_and_DefaultIfEmpty_in_selector(bool async) + { + await base.SelectMany_correlated_with_Select_value_type_and_DefaultIfEmpty_in_selector(async); + + AssertSql( + """ +SELECT COALESCE([o0].[OrderID], 0) +FROM [Customers] AS [c] +OUTER APPLY ( + SELECT TOP(2) [o].[OrderID] + FROM [Orders] AS [o] + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[CustomerID] = N'NONEXISTENT' +) AS [o0] +"""); + } + public override async Task Select_Property_when_shadow_unconstrained_generic_method(bool async) { await base.Select_Property_when_shadow_unconstrained_generic_method(async); @@ -6685,6 +6836,20 @@ public override async Task SelectMany_mixed(bool async) AssertSql(); } + public override async Task DefaultIfEmpty_top_level_arg(bool async) + { + await base.DefaultIfEmpty_top_level_arg(async); + + AssertSql(); + } + + public override async Task DefaultIfEmpty_top_level_arg_followed_by_projecting_constant(bool async) + { + await base.DefaultIfEmpty_top_level_arg_followed_by_projecting_constant(async); + + AssertSql(); + } + public override async Task OrderBy_client_mixed(bool async) { await base.OrderBy_client_mixed(async); diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs index aa0c48ee..ce8c2c0e 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs @@ -799,6 +799,25 @@ ORDER BY `o`.`OrderID` """); } + public override async Task Project_single_element_from_collection_with_OrderBy_Take_OrderBy_and_FirstOrDefault(bool async) + { + await base.Project_single_element_from_collection_with_OrderBy_Take_OrderBy_and_FirstOrDefault(async); + + AssertSql( + """ +SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate] +FROM [Customers] AS [c] +LEFT JOIN ( + SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] + FROM ( + SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o].[CustomerID] ORDER BY [o].[OrderID]) AS [row] + FROM [Orders] AS [o] + ) AS [o0] + WHERE [o0].[row] <= 1 +) AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] +"""); + } + [ConditionalTheory(Skip = "`SELECT (SELECT TOP 1) FROM` is not supported by Jet.")] public override async Task Project_single_element_from_collection_with_OrderBy_Skip_and_FirstOrDefault(bool isAsync) { @@ -1373,22 +1392,22 @@ FROM [Orders] AS [o] """); } - /*public override async Task SelectMany_with_nested_DefaultIfEmpty(bool async) + public override async Task SelectMany_with_nested_DefaultIfEmpty(bool async) { await base.SelectMany_with_nested_DefaultIfEmpty(async); AssertSql( """ -SELECT [s].[OrderID], [s].[ProductID], [s].[Discount], [s].[Quantity], [s].[UnitPrice] -FROM [Customers] AS [c] +SELECT `s`.`OrderID`, `s`.`ProductID`, `s`.`Discount`, `s`.`Quantity`, `s`.`UnitPrice` +FROM `Customers` AS `c` INNER JOIN ( - SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [o].[CustomerID] - FROM [Orders] AS [o] - LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] - WHERE 0 = 1 -) AS [s] ON [c].[CustomerID] = [s].[CustomerID] + SELECT `o0`.`OrderID`, `o0`.`ProductID`, `o0`.`Discount`, `o0`.`Quantity`, `o0`.`UnitPrice`, `o`.`CustomerID` + FROM `Orders` AS `o` + LEFT JOIN `Order Details` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` + WHERE FALSE +) AS `s` ON `c`.`CustomerID` = `s`.`CustomerID` """); - }*/ + } public override async Task Select_with_multiple_Take(bool async) { diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs index fac7b013..1306c241 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs @@ -1690,12 +1690,27 @@ public override async Task Two_parameters_with_same_name_get_uniquified(bool asy AssertSql( """ -@p='11' -@p0='12' +@customerId='ANATR' (Size = 5) +@customerId0='ALFKI' (Size = 5) SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` -WHERE ((`c`.`CustomerID` & (@p & '')) & (`c`.`CustomerID` & (@p0 & ''))) = 'ALFKI11ALFKI12' +WHERE `c`.`CustomerID` = @customerId OR `c`.`CustomerID` = @customerId0 +"""); + } + + public override async Task Two_parameters_with_same_case_insensitive_name_get_uniquified(bool async) + { + await base.Two_parameters_with_same_case_insensitive_name_get_uniquified(async); + + AssertSql( + """ +@customerID='ANATR' (Size = 5) +@customerId0='ALFKI' (Size = 5) + +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = @customerID OR `c`.`CustomerID` = @customerId0 """); } @@ -1913,6 +1928,25 @@ SELECT COUNT(*) """); } + public override async Task Where_collection_navigation_ToArray_Contains(bool async) + { + await base.Where_collection_navigation_ToArray_Contains(async); + + AssertSql( + """ +@entity_equality_order_OrderID='10248' (Nullable = true) + +SELECT `c`.`CustomerID`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` +FROM `Customers` AS `c` +LEFT JOIN `Orders` AS `o0` ON `c`.`CustomerID` = `o0`.`CustomerID` +WHERE EXISTS ( + SELECT 1 + FROM `Orders` AS `o` + WHERE `c`.`CustomerID` = `o`.`CustomerID` AND `o`.`OrderID` = @entity_equality_order_OrderID) +ORDER BY `c`.`CustomerID`, `o0`.`OrderID` +"""); + } + public override async Task Where_collection_navigation_AsEnumerable_Count(bool async) { await base.Where_collection_navigation_AsEnumerable_Count(async); @@ -1992,6 +2026,21 @@ public override async Task Where_list_object_contains_over_value_type(bool async @orderIds1='10248' @orderIds2='10249' +SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` +FROM `Orders` AS `o` +WHERE `o`.`OrderID` IN (@orderIds1, @orderIds2) +"""); + } + + public override async Task Where_array_of_object_contains_over_value_type(bool async) + { + await base.Where_array_of_object_contains_over_value_type(async); + + AssertSql( + """ +@orderIds1='10248' +@orderIds2='10249' + SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate` FROM `Orders` AS `o` WHERE `o`.`OrderID` IN (@orderIds1, @orderIds2) @@ -2917,6 +2966,13 @@ public override async Task Simplifiable_coalesce_over_nullable(bool async) """); } + public override async Task EF_MultipleParameters_with_non_evaluatable_argument_throws(bool async) + { + await base.EF_MultipleParameters_with_non_evaluatable_argument_throws(async); + + AssertSql(); + } + #region Evaluation order of predicates public override async Task Take_and_Where_evaluation_order(bool async) diff --git a/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs index adffa4b3..0542e871 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs @@ -42,6 +42,30 @@ public override async Task Inline_collection_of_ints_Contains() """); } + public override async Task Inline_collection_of_nullable_ints_Contains() + { + await base.Inline_collection_of_nullable_ints_Contains(); + + AssertSql( + """ +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`NullableInt` IN (10, 999) +"""); + } + + public override async Task Inline_collection_of_nullable_ints_Contains_null() + { + await base.Inline_collection_of_nullable_ints_Contains_null(); + + AssertSql( + """ +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`NullableInt` IS NULL OR `p`.`NullableInt` = 999 +"""); + } + public override async Task Inline_collection_Count_with_zero_values() { await base.Inline_collection_Count_with_zero_values(); @@ -581,6 +605,52 @@ public override async Task Parameter_collection_of_ints_Contains_nullable_int() """); } + public override async Task Parameter_collection_of_nullable_ints_Contains_int() + { + await base.Parameter_collection_of_nullable_ints_Contains_int(); + + AssertSql( + """ +@nullableInts1='10' +@nullableInts2='999' + +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`Int` IN (@nullableInts1, @nullableInts2) +""", + // + """ +@nullableInts1='10' +@nullableInts2='999' + +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`Int` NOT IN (@nullableInts1, @nullableInts2) +"""); + } + + public override async Task Parameter_collection_of_nullable_ints_Contains_nullable_int() + { + await base.Parameter_collection_of_nullable_ints_Contains_nullable_int(); + + AssertSql( + """ +@nullableInts1='999' + +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`NullableInt` IS NULL OR `p`.`NullableInt` = @nullableInts1 +""", + // + """ +@nullableInts1='999' + +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`NullableInt` IS NOT NULL AND `p`.`NullableInt` <> @nullableInts1 +"""); + } + public override async Task Parameter_collection_of_strings_Contains_string() { await base.Parameter_collection_of_strings_Contains_string(); @@ -702,6 +772,21 @@ public override async Task Parameter_collection_of_bools_Contains() """); } + public override async Task Parameter_collection_of_enums_Contains() + { + await base.Parameter_collection_of_enums_Contains(); + + AssertSql( + """ +@enums1='0' +@enums2='3' + +SELECT `p`.`Id`, `p`.`Bool`, `p`.`Bools`, `p`.`DateTime`, `p`.`DateTimes`, `p`.`Enum`, `p`.`Enums`, `p`.`Int`, `p`.`Ints`, `p`.`NullableInt`, `p`.`NullableInts`, `p`.`NullableString`, `p`.`NullableStrings`, `p`.`NullableWrappedId`, `p`.`NullableWrappedIdWithNullableComparer`, `p`.`String`, `p`.`Strings`, `p`.`WrappedId` +FROM `PrimitiveCollectionsEntity` AS `p` +WHERE `p`.`Enum` IN (@enums1, @enums2) +"""); + } + public override async Task Parameter_collection_null_Contains() { await base.Parameter_collection_null_Contains(); @@ -770,9 +855,84 @@ SELECT 1000 AS `Value` """); } + public override async Task Parameter_collection_Count_with_huge_number_of_values() + { + await base.Parameter_collection_Count_with_huge_number_of_values(); + + Assert.Contains("VALUES", Fixture.TestSqlLoggerFactory.SqlStatements[0], StringComparison.Ordinal); + } + + public override async Task Parameter_collection_of_ints_Contains_int_with_huge_number_of_values() + { + await base.Parameter_collection_of_ints_Contains_int_with_huge_number_of_values(); + + Assert.DoesNotContain("OPENJSON", Fixture.TestSqlLoggerFactory.SqlStatements[0], StringComparison.Ordinal); + Assert.DoesNotContain("OPENJSON", Fixture.TestSqlLoggerFactory.SqlStatements[1], StringComparison.Ordinal); + } + + /*public override async Task Static_readonly_collection_List_of_ints_Contains_int() + { + await base.Static_readonly_collection_List_of_ints_Contains_int(); + + AssertSql( + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] IN (10, 999) +""", + // + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] NOT IN (10, 999) +"""); + } + + public override async Task Static_readonly_collection_FrozenSet_of_ints_Contains_int() + { + await base.Static_readonly_collection_FrozenSet_of_ints_Contains_int(); + + AssertSql( + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] IN (10, 999) +""", + // + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] NOT IN (10, 999) +"""); + } + + public override async Task Static_readonly_collection_ImmutableArray_of_ints_Contains_int() + { + await base.Static_readonly_collection_ImmutableArray_of_ints_Contains_int(); + + AssertSql( + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] IN (10, 999) +""", + // + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE [p].[Int] NOT IN (10, 999) +"""); + }*/ + public override Task Column_collection_of_ints_Contains() => AssertTranslationFailedWithDetails(() => base.Column_collection_of_ints_Contains(), JetStrings.QueryingIntoJsonCollectionsNotSupported()); + public override Task Column_collection_of_nullable_ints_Contains() + => AssertTranslationFailed(() => base.Column_collection_of_nullable_ints_Contains()); + + public override Task Column_collection_of_nullable_ints_Contains_null() + => AssertTranslationFailed(() => base.Column_collection_of_nullable_ints_Contains_null()); + public override Task Column_collection_of_strings_contains_null() => AssertTranslationFailed(() => base.Column_collection_of_strings_contains_null()); @@ -837,6 +997,22 @@ ORDER BY [v].[_ord] """); } + public override async Task Inline_collection_index_Column_with_EF_Constant() + { + await base.Inline_collection_index_Column_with_EF_Constant(); + + AssertSql( + """ +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE ( + SELECT [i].[Value] + FROM (VALUES (0, CAST(1 AS int)), (1, 2), (2, 3)) AS [i]([_ord], [Value]) + ORDER BY [i].[_ord] + OFFSET [p].[Int] ROWS FETCH NEXT 1 ROWS ONLY) = 1 +"""); + } + public override async Task Inline_collection_value_index_Column() { await base.Inline_collection_value_index_Column(); diff --git a/test/EFCore.Jet.FunctionalTests/Query/PropertyValuesJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/PropertyValuesJetTest.cs new file mode 100644 index 00000000..6385bc93 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Query/PropertyValuesJetTest.cs @@ -0,0 +1,27 @@ +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore.TestUtilities; + +namespace Microsoft.EntityFrameworkCore; + +#nullable disable + +public class PropertyValuesJetTest(PropertyValuesJetTest.PropertyValuesJetFixture fixture) + : PropertyValuesRelationalTestBase(fixture) +{ + public class PropertyValuesJetFixture : PropertyValuesRelationalFixture + { + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; + + protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) + { + base.OnModelCreating(modelBuilder, context); + + modelBuilder.Entity() + .Property(b => b.Value).HasColumnType("decimal(18,2)"); + + modelBuilder.Entity() + .Property(ce => ce.LeaveBalance).HasColumnType("decimal(18,2)"); + } + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs index eef0dd9e..bb1c306f 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs @@ -9986,6 +9986,21 @@ ORDER BY `u`.`Nickname` """); } + public override async Task Enum_array_contains(bool async) + { + await base.Enum_array_contains(async); + + AssertSql( + """ +@types1='1' + +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM `Weapons` AS `w` +LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +WHERE `w0`.`Id` IS NOT NULL AND (`w0`.`AmmunitionType` IS NULL OR `w0`.`AmmunitionType` = @types1) +"""); + } + public override async Task Coalesce_with_non_root_evaluatable_Convert(bool async) { await base.Coalesce_with_non_root_evaluatable_Convert(async); diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetTest.cs index 00dc15e0..57714cc7 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetTest.cs @@ -622,7 +622,7 @@ public override async Task Setting_foreign_key_to_a_different_type_throws() WHERE `a`.`Discriminator` = 'Kiwi' """, // - $""" + """ @p0='0' @p1='Eagle' (Nullable = false) (Size = 8) @p2='2' (Nullable = true) @@ -632,7 +632,7 @@ public override async Task Setting_foreign_key_to_a_different_type_throws() @p6='Haliaeetus leucocephalus' (Size = 100) INSERT INTO `Animals` (`CountryId`, `Discriminator`, `EagleId`, `Group`, `IsFlightless`, `Name`, `Species`) -VALUES ({AssertSqlHelper.Parameter("@p0")}, {AssertSqlHelper.Parameter("@p1")}, {AssertSqlHelper.Parameter("@p2")}, {AssertSqlHelper.Parameter("@p3")}, {AssertSqlHelper.Parameter("@p4")}, {AssertSqlHelper.Parameter("@p5")}, {AssertSqlHelper.Parameter("@p6")}); +VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6); SELECT `Id` FROM `Animals` WHERE @@ROWCOUNT = 1 AND `Id` = @@identity; diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs index cffb5d10..0bc28f91 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs @@ -7977,6 +7977,21 @@ ORDER BY `g`.`Nickname` """); } + public override async Task Enum_array_contains(bool async) + { + await base.Enum_array_contains(async); + + AssertSql( + """ +@types1='1' + +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +FROM `Weapons` AS `w` +LEFT JOIN `Weapons` AS `w0` ON `w`.`SynergyWithId` = `w0`.`Id` +WHERE `w0`.`Id` IS NOT NULL AND (`w0`.`AmmunitionType` IS NULL OR `w0`.`AmmunitionType` = @types1) +"""); + } + public override async Task Coalesce_with_non_root_evaluatable_Convert(bool async) { await base.Coalesce_with_non_root_evaluatable_Convert(async); diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/MathTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/MathTranslationsJetTest.cs index 2ced8059..b637118b 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Translations/MathTranslationsJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/MathTranslationsJetTest.cs @@ -492,23 +492,77 @@ WHERE SGN(`b`.`Float`) > 0 """); } - public override Task Max() - => AssertTranslationFailed(() => base.Max()); + public override async Task Max() + { + await base.Max(); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(`b`.`Int` > (`b`.`Short` - 3), `b`.`Int`, `b`.`Short` - 3) = `b`.`Int` +"""); + } + + public override async Task Max_nested() + { + await base.Max_nested(); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(IIF((`b`.`Short` - 3) > `b`.`Int`, `b`.`Short` - 3, `b`.`Int`) > 1, IIF((`b`.`Short` - 3) > `b`.`Int`, `b`.`Short` - 3, `b`.`Int`), 1) = `b`.`Int` +"""); + } + + public override async Task Max_nested_twice() + { + await base.Max_nested_twice(); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(IIF(IIF(1 > `b`.`Int`, 1, `b`.`Int`) > 2, IIF(1 > `b`.`Int`, 1, `b`.`Int`), 2) > (`b`.`Short` - 3), IIF(IIF(1 > `b`.`Int`, 1, `b`.`Int`) > 2, IIF(1 > `b`.`Int`, 1, `b`.`Int`), 2), `b`.`Short` - 3) = `b`.`Int` +"""); + } + + public override async Task Min() + { + await base.Min(); - public override Task Max_nested() - => AssertTranslationFailed(() => base.Max_nested()); + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(`b`.`Int` < (`b`.`Short` + 3), `b`.`Int`, `b`.`Short` + 3) = `b`.`Int` +"""); + } - public override Task Max_nested_twice() - => AssertTranslationFailed(() => base.Max_nested_twice()); + public override async Task Min_nested() + { + await base.Min_nested(); - public override Task Min() - => AssertTranslationFailed(() => base.Min()); + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(IIF((`b`.`Short` + 3) < `b`.`Int`, `b`.`Short` + 3, `b`.`Int`) < 99999, IIF((`b`.`Short` + 3) < `b`.`Int`, `b`.`Short` + 3, `b`.`Int`), 99999) = `b`.`Int` +"""); + } - public override Task Min_nested() - => AssertTranslationFailed(() => base.Min_nested()); + public override async Task Min_nested_twice() + { + await base.Min_nested_twice(); - public override Task Min_nested_twice() - => AssertTranslationFailed(() => base.Min_nested_twice()); + AssertSql( + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE IIF(IIF(IIF(99999 < `b`.`Int`, 99999, `b`.`Int`) < 99998, IIF(99999 < `b`.`Int`, 99999, `b`.`Int`), 99998) < (`b`.`Short` + 3), IIF(IIF(99999 < `b`.`Int`, 99999, `b`.`Int`) < 99998, IIF(99999 < `b`.`Int`, 99999, `b`.`Int`), 99998), `b`.`Short` + 3) = `b`.`Int` +"""); + } public override async Task Degrees() { diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/MiscellaneousTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/MiscellaneousTranslationsJetTest.cs index 5f7ce55f..9aacb5c1 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Translations/MiscellaneousTranslationsJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/MiscellaneousTranslationsJetTest.cs @@ -84,57 +84,57 @@ public override async Task Convert_ToBoolean() AssertSql( """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(bit, [b].[Bool]) = CAST(1 AS bit) +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CBOOL(`b`.`Bool`) * -1 """, // """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(bit, [b].[Byte]) = CAST(1 AS bit) +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CBOOL(`b`.`Byte`) """, // """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(bit, [b].[Decimal]) = CAST(1 AS bit) +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CBOOL(`b`.`Decimal`) """, // """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(bit, [b].[Double]) = CAST(1 AS bit) +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CBOOL(`b`.`Double`) """, // """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(bit, [b].[Float]) = CAST(1 AS bit) +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CBOOL(`b`.`Float`) """, // """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(bit, [b].[Short]) = CAST(1 AS bit) +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CBOOL(`b`.`Short`) """, // """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(bit, [b].[Int]) = CAST(1 AS bit) +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CBOOL(`b`.`Int`) """, // """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(bit, [b].[Long]) = CAST(1 AS bit) +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CBOOL(`b`.`Long`) """, // """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(bit, [b].[Int]) = CAST(1 AS bit) +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CBOOL(`b`.`Int`) """); } @@ -275,64 +275,64 @@ public override async Task Convert_ToDouble() await base.Convert_ToDouble(); AssertSql( -""" -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(float, [b].[Bool]) = 1.0E0 + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CDBL(`b`.`Bool`) * -1 = 1.0 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(float, [b].[Byte]) = 8.0E0 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CDBL(`b`.`Byte`) = 8.0 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(float, [b].[Decimal]) = 8.5999999999999996E0 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CDBL(`b`.`Decimal`) = 8.6 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(float, [b].[Double]) > 8.0E0 AND CONVERT(float, [b].[Double]) < 9.0E0 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CDBL(`b`.`Double`) > 8.0 AND CDBL(`b`.`Double`) < 9.0 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(float, [b].[Float]) > 8.0E0 AND CONVERT(float, [b].[Float]) < 9.0E0 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CDBL(`b`.`Float`) > 8.0 AND CDBL(`b`.`Float`) < 9.0 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(float, [b].[Short]) = 8.0E0 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CDBL(`b`.`Short`) = 8.0 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(float, [b].[Int]) = 8.0E0 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CDBL(`b`.`Int`) = 8.0 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(float, [b].[Long]) = 8.0E0 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CDBL(`b`.`Long`) = 8.0 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(float, CONVERT(nvarchar(max), [b].[Int])) = 8.0E0 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CDBL((`b`.`Int` & '')) = 8.0 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(float, [b].[Int]) = 8.0E0 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CDBL(`b`.`Int`) = 8.0 """); } @@ -341,64 +341,64 @@ public override async Task Convert_ToInt16() await base.Convert_ToInt16(); AssertSql( -""" -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(smallint, [b].[Bool]) = CAST(1 AS smallint) + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CINT(`b`.`Bool`) * -1 = 1 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(smallint, [b].[Byte]) = CAST(12 AS smallint) + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CINT(`b`.`Byte`) = 12 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(smallint, [b].[Decimal]) = CAST(12 AS smallint) + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CINT(`b`.`Decimal`) = 12 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(smallint, [b].[Double]) = CAST(12 AS smallint) + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CINT(`b`.`Double`) = 12 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(smallint, [b].[Float]) = CAST(12 AS smallint) + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CINT(`b`.`Float`) = 12 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(smallint, [b].[Short]) = CAST(12 AS smallint) + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CINT(`b`.`Short`) = 12 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(smallint, [b].[Int]) = CAST(12 AS smallint) + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CINT(`b`.`Int`) = 12 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(smallint, [b].[Long]) = CAST(12 AS smallint) + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CINT(`b`.`Long`) = 12 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(smallint, CONVERT(nvarchar(max), [b].[Int])) = CAST(12 AS smallint) + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CINT((`b`.`Int` & '')) = 12 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(smallint, [b].[Int]) = CAST(12 AS smallint) + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CINT(`b`.`Int`) = 12 """); } @@ -407,64 +407,64 @@ public override async Task Convert_ToInt32() await base.Convert_ToInt32(); AssertSql( -""" -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(int, [b].[Bool]) = 1 + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CLNG(`b`.`Bool`) * -1 = 1 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(int, [b].[Byte]) = 12 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CLNG(`b`.`Byte`) = 12 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(int, [b].[Decimal]) = 12 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CLNG(`b`.`Decimal`) = 12 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(int, [b].[Double]) = 12 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CLNG(`b`.`Double`) = 12 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(int, [b].[Float]) = 12 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CLNG(`b`.`Float`) = 12 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(int, [b].[Short]) = 12 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CLNG(`b`.`Short`) = 12 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(int, [b].[Int]) = 12 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CLNG(`b`.`Int`) = 12 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(int, [b].[Long]) = 12 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CLNG(`b`.`Long`) = 12 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(int, CONVERT(nvarchar(max), [b].[Int])) = 12 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CLNG((`b`.`Int` & '')) = 12 """, - // - """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CONVERT(int, [b].[Int]) = 12 + // + """ +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE CLNG(`b`.`Int`) = 12 """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/BitwiseOperatorTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/BitwiseOperatorTranslationsJetTest.cs index 4b0f6949..366f491a 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/BitwiseOperatorTranslationsJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/Operators/BitwiseOperatorTranslationsJetTest.cs @@ -60,7 +60,7 @@ public override async Task Or_multiple() """ SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` FROM `BasicTypesEntities` AS `b` -WHERE (CLNG(`b`.`Int` BOR `b`.`Short`) BOR `b`.`Long`) = 7 +WHERE (IIF((`b`.`Int` BOR CLNG(`b`.`Short`)) IS NULL, NULL, CLNG(`b`.`Int` BOR CLNG(`b`.`Short`))) BOR `b`.`Long`) = 7 """); } @@ -72,11 +72,11 @@ public override async Task And() """ SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` FROM `BasicTypesEntities` AS `b` -WHERE (`b`.`Int` BAND `b`.`Short`) = 2 +WHERE (`b`.`Int` BAND CLNG(`b`.`Short`)) = 2 """, // """ -SELECT `b`.`Int` BAND `b`.`Short` +SELECT `b`.`Int` BAND CLNG(`b`.`Short`) FROM `BasicTypesEntities` AS `b` """); } @@ -104,14 +104,14 @@ public override async Task Xor() AssertSql( """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE [b].[Int] ^ [b].[Short] = 1 +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (`b`.`Int` BXOR CLNG(`b`.`Short`)) = 1 """, // """ -SELECT [b].[Int] ^ [b].[Short] -FROM [BasicTypesEntities] AS [b] +SELECT `b`.`Int` BXOR CLNG(`b`.`Short`) +FROM `BasicTypesEntities` AS `b` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsJetTest.cs index 326bef7a..3de84e3d 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsJetTest.cs @@ -73,17 +73,17 @@ public override async Task DayOfWeek() AssertSql(); } - /*public override async Task DayNumber(bool async) + public override async Task DayNumber() { - await base.DayNumber(async); + await base.DayNumber(); AssertSql( """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE DATEDIFF(day, '0001-01-01', [b].[DateOnly]) = 726780 +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE (DATEDIFF('d', #0100-01-01#, `b`.`DateOnly`) + 36159) = 726780 """); - }*/ + } public override async Task AddYears() { @@ -121,19 +121,19 @@ WHERE DATEADD('d', CLNG(3), `b`.`DateOnly`) = #1990-11-13# """); } - /*public override async Task DayNumber_subtraction(bool async) + public override async Task DayNumber_subtraction() { - await base.DayNumber_subtraction(async); + await base.DayNumber_subtraction(); AssertSql( """ @DayNumber='726775' -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE DATEDIFF(day, '0001-01-01', [b].[DateOnly]) - @DayNumber = 5 +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE ((DATEDIFF('d', #0100-01-01#, `b`.`DateOnly`) + 36159) - @DayNumber) = 5 """); - }*/ + } public override async Task FromDateTime() { @@ -141,9 +141,9 @@ public override async Task FromDateTime() AssertSql( """ -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CAST([b].[DateTime] AS date) = '1998-05-04' +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEVALUE(`b`.`DateTime`) = #1998-05-04# """); } @@ -155,7 +155,7 @@ public override async Task FromDateTime_compared_to_property() """ SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` FROM `BasicTypesEntities` AS `b` -WHERE `b`.`DateTime` = `b`.`DateOnly` +WHERE DATEVALUE(`b`.`DateTime`) = `b`.`DateOnly` """); } @@ -165,11 +165,11 @@ public override async Task FromDateTime_compared_to_constant_and_parameter() AssertSql( """ -@dateOnly='10/11/0002' (DbType = Date) +@dateOnly='0002-10-11T00:00:00.0000000' (DbType = Date) -SELECT [b].[Id], [b].[Bool], [b].[Byte], [b].[ByteArray], [b].[DateOnly], [b].[DateTime], [b].[DateTimeOffset], [b].[Decimal], [b].[Double], [b].[Enum], [b].[FlagsEnum], [b].[Float], [b].[Guid], [b].[Int], [b].[Long], [b].[Short], [b].[String], [b].[TimeOnly], [b].[TimeSpan] -FROM [BasicTypesEntities] AS [b] -WHERE CAST([b].[DateTime] AS date) IN (@dateOnly, '1998-05-04') +SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` +FROM `BasicTypesEntities` AS `b` +WHERE DATEVALUE(`b`.`DateTime`) IN (@dateOnly, #1998-05-04#) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Update/ComplexCollectionJsonUpdateJetTest.cs b/test/EFCore.Jet.FunctionalTests/Update/ComplexCollectionJsonUpdateJetTest.cs new file mode 100644 index 00000000..1ee39bf5 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Update/ComplexCollectionJsonUpdateJetTest.cs @@ -0,0 +1,300 @@ +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore.TestUtilities; +using Microsoft.EntityFrameworkCore.Update; +using System.Threading.Tasks; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Update; + +public class ComplexCollectionJsonUpdateJetTest : ComplexCollectionJsonUpdateTestBase< + ComplexCollectionJsonUpdateJetTest.ComplexCollectionJsonUpdateJetFixture> +{ + public ComplexCollectionJsonUpdateJetTest(ComplexCollectionJsonUpdateJetFixture fixture) + : base(fixture) + => ClearLog(); + + public override async Task Add_element_to_complex_collection_mapped_to_json() + { + await base.Add_element_to_complex_collection_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"First Contact","PhoneNumbers":["555-1234","555-5678"]},{"Name":"Second Contact","PhoneNumbers":["555-9876","555-5432"]},{"Name":"New Contact","PhoneNumbers":["555-0000"]}]' (Nullable = false) (Size = 181) +@p1='1' + +UPDATE `Companies` SET `Contacts` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Remove_element_from_complex_collection_mapped_to_json() + { + await base.Remove_element_from_complex_collection_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"Second Contact","PhoneNumbers":["555-9876","555-5432"]}]' (Nullable = false) (Size = 66) +@p1='1' + +UPDATE `Companies` SET `Contacts` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Modify_element_in_complex_collection_mapped_to_json() + { + await base.Modify_element_in_complex_collection_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"First Contact - Modified","PhoneNumbers":["555-1234","555-5678"]},{"Name":"Second Contact","PhoneNumbers":["555-9876","555-5432"]}]' (Nullable = false) (Size = 141) +@p1='1' + +UPDATE `Companies` SET `Contacts` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Move_elements_in_complex_collection_mapped_to_json() + { + await base.Move_elements_in_complex_collection_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"Second Contact","PhoneNumbers":["555-9876","555-5432"]},{"Name":"First Contact","PhoneNumbers":["555-1234","555-5678"]}]' (Nullable = false) (Size = 130) +@p1='1' + +UPDATE `Companies` SET `Contacts` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Change_complex_collection_mapped_to_json_to_null_and_to_empty() + { + await base.Change_complex_collection_mapped_to_json_to_null_and_to_empty(); + + AssertSql( + """ +@p0='[]' (Nullable = false) (Size = 2) +@p1='1' + +UPDATE `Companies` SET `Contacts` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +""", + // + """ +@p0=NULL (Nullable = false) +@p1='1' + +UPDATE `Companies` SET `Contacts` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Complex_collection_with_nested_complex_type_mapped_to_json() + { + await base.Complex_collection_with_nested_complex_type_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"John Doe","PhoneNumbers":["555-1234","555-5678"],"Address":{"City":"Seattle","Country":"USA","PostalCode":"98101","Street":"123 Main St"}},{"Name":"Jane Smith","PhoneNumbers":["555-9876"],"Address":{"City":"Portland","Country":"USA","PostalCode":"97201","Street":"456 Oak Ave"}}]' (Nullable = false) (Size = 289) +@p1='1' + +UPDATE `Companies` SET `Employees` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Modify_multiple_complex_properties_mapped_to_json() + { + await base.Modify_multiple_complex_properties_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"Contact 1","PhoneNumbers":["555-1111"]}]' (Nullable = false) (Size = 50) +@p1='{"Budget":50000.00,"Name":"Department A"}' (Nullable = false) (Size = 41) +@p2='1' + +UPDATE `Companies` SET `Contacts` = @p0, `Department` = @p1 +WHERE `Id` = @p2; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Clear_complex_collection_mapped_to_json() + { + await base.Clear_complex_collection_mapped_to_json(); + + AssertSql( + """ +@p0='[]' (Nullable = false) (Size = 2) +@p1='1' + +UPDATE `Companies` SET `Contacts` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Replace_entire_complex_collection_mapped_to_json() + { + await base.Replace_entire_complex_collection_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"Replacement Contact 1","PhoneNumbers":["999-1111"]},{"Name":"Replacement Contact 2","PhoneNumbers":["999-2222","999-3333"]}]' (Nullable = false) (Size = 134) +@p1='1' + +UPDATE `Companies` SET `Contacts` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Add_element_to_nested_complex_collection_mapped_to_json() + { + await base.Add_element_to_nested_complex_collection_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"Initial Employee","PhoneNumbers":["555-0001","555-9999"],"Address":{"City":"Initial City","Country":"USA","PostalCode":"00001","Street":"100 First St"}}]' (Nullable = false) (Size = 163) +@p1='1' + +UPDATE `Companies` SET `Employees` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Modify_nested_complex_property_in_complex_collection_mapped_to_json() + { + await base.Modify_nested_complex_property_in_complex_collection_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"Initial Employee","PhoneNumbers":["555-0001"],"Address":{"City":"Modified City","Country":"USA","PostalCode":"99999","Street":"100 First St"}}]' (Nullable = false) (Size = 153) +@p1='1' + +UPDATE `Companies` SET `Employees` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Set_complex_collection_to_null_mapped_to_json() + { + await base.Set_complex_collection_to_null_mapped_to_json(); + + AssertSql( + """ +@p0=NULL (Nullable = false) +@p1='1' + +UPDATE `Companies` SET `Employees` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Set_null_complex_collection_to_non_empty_mapped_to_json() + { + await base.Set_null_complex_collection_to_non_empty_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"New Employee","PhoneNumbers":["555-1111"],"Address":{"City":"New City","Country":"USA","PostalCode":"12345","Street":"123 New St"}}]' (Nullable = false) (Size = 142) +@p1='1' + +UPDATE `Companies` SET `Employees` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Replace_complex_collection_element_mapped_to_json() + { + await base.Replace_complex_collection_element_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"Replacement Employee","PhoneNumbers":["555-7777","555-8888"],"Address":{"City":"Replace City","Country":"Canada","PostalCode":"54321","Street":"789 Replace St"}}]' (Nullable = false) (Size = 172) +@p1='1' + +UPDATE `Companies` SET `Employees` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Complex_collection_with_empty_nested_collections_mapped_to_json() + { + await base.Complex_collection_with_empty_nested_collections_mapped_to_json(); + + AssertSql( + """ +@p0='[{"Name":"Initial Employee","PhoneNumbers":["555-0001"],"Address":{"City":"Initial City","Country":"USA","PostalCode":"00001","Street":"100 First St"}},{"Name":"Employee No Phone","PhoneNumbers":[],"Address":{"City":"Quiet City","Country":"USA","PostalCode":"00000","Street":"456 No Phone St"}}]' (Nullable = false) (Size = 295) +@p1='1' + +UPDATE `Companies` SET `Employees` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Set_complex_property_mapped_to_json_to_null() + { + await base.Set_complex_property_mapped_to_json_to_null(); + + AssertSql( + """ +@p0=NULL (Nullable = false) +@p1='1' + +UPDATE `Companies` SET `Department` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Set_null_complex_property_to_non_null_mapped_to_json() + { + await base.Set_null_complex_property_to_non_null_mapped_to_json(); + + AssertSql( + """ +@p0='{"Budget":25000.00,"Name":"New Department"}' (Nullable = false) (Size = 43) +@p1='1' + +UPDATE `Companies` SET `Department` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public override async Task Replace_complex_property_mapped_to_json() + { + await base.Replace_complex_property_mapped_to_json(); + + AssertSql( + """ +@p0='{"Budget":99999.99,"Name":"Replacement Department"}' (Nullable = false) (Size = 51) +@p1='1' + +UPDATE `Companies` SET `Department` = @p0 +WHERE `Id` = @p1; +SELECT @@ROWCOUNT; +"""); + } + + public class ComplexCollectionJsonUpdateJetFixture : ComplexCollectionJsonUpdateFixtureBase + { + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Update/JetUpdateSqlGeneratorTest.cs b/test/EFCore.Jet.FunctionalTests/Update/JetUpdateSqlGeneratorTest.cs index 529835f6..f77d59a3 100644 --- a/test/EFCore.Jet.FunctionalTests/Update/JetUpdateSqlGeneratorTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Update/JetUpdateSqlGeneratorTest.cs @@ -1,6 +1,3 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - using System; using System.Text; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; diff --git a/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs b/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs index e0cc90b9..2b9bcf29 100644 --- a/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs @@ -21,33 +21,33 @@ public override async Task Principal_and_dependent_roundtrips_with_cycle_breakin await base.Principal_and_dependent_roundtrips_with_cycle_breaking(async); AssertSql( - $""" + """ @p0='AC South' (Size = 255) INSERT INTO `AuthorsClub` (`Name`) -VALUES ({AssertSqlHelper.Parameter("@p0")}); +VALUES (@p0); SELECT `Id` FROM `AuthorsClub` WHERE @@ROWCOUNT = 1 AND `Id` = @@identity; """, // - $""" -@p1='1' + """ +@p1='2' @p2='Alice' (Size = 255) INSERT INTO `Author` (`AuthorsClubId`, `Name`) -VALUES ({AssertSqlHelper.Parameter("@p1")}, {AssertSqlHelper.Parameter("@p2")}); +VALUES (@p1, @p2); SELECT `Id` FROM `Author` WHERE @@ROWCOUNT = 1 AND `Id` = @@identity; """, // - $""" -@p3='1' + """ +@p3='2' @p4=NULL (Size = 255) INSERT INTO `Book` (`AuthorId`, `Title`) -VALUES ({AssertSqlHelper.Parameter("@p3")}, {AssertSqlHelper.Parameter("@p4")}); +VALUES (@p3, @p4); SELECT `Id` FROM `Book` WHERE @@ROWCOUNT = 1 AND `Id` = @@identity; @@ -59,41 +59,41 @@ public override async Task Principal_and_dependent_roundtrips_with_cycle_breakin INNER JOIN `Author` AS `a` ON `b`.`AuthorId` = `a`.`Id` """, // - $""" + """ @p0='AC North' (Size = 255) INSERT INTO `AuthorsClub` (`Name`) -VALUES ({AssertSqlHelper.Parameter("@p0")}); +VALUES (@p0); SELECT `Id` FROM `AuthorsClub` WHERE @@ROWCOUNT = 1 AND `Id` = @@identity; """, // - $""" -@p1='2' + """ +@p1='3' @p2='Author of the year 2023' (Size = 255) INSERT INTO `Author` (`AuthorsClubId`, `Name`) -VALUES ({AssertSqlHelper.Parameter("@p1")}, {AssertSqlHelper.Parameter("@p2")}); +VALUES (@p1, @p2); SELECT `Id` FROM `Author` WHERE @@ROWCOUNT = 1 AND `Id` = @@identity; """, // - $""" -@p3='2' -@p4='1' + """ +@p3='3' +@p4='2' -UPDATE `Book` SET `AuthorId` = {AssertSqlHelper.Parameter("@p3")} -WHERE `Id` = {AssertSqlHelper.Parameter("@p4")}; +UPDATE `Book` SET `AuthorId` = @p3 +WHERE `Id` = @p4; SELECT @@ROWCOUNT; """, // - $""" -@p0='1' + """ +@p0='2' DELETE FROM `Author` -WHERE `Id` = {AssertSqlHelper.Parameter("@p0")}; +WHERE `Id` = @p0; SELECT @@ROWCOUNT; """); } diff --git a/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs b/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs index 0efd082d..1f19829e 100644 --- a/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs @@ -216,7 +216,7 @@ CREATE PROCEDURE Entity_Delete(@Id int) AssertSql( """ -@p0='1' +@p0='2' EXEC `Entity_Delete` p0; """); diff --git a/test/EFCore.Jet.FunctionalTests/Update/UpdatesJetTPCTest.cs b/test/EFCore.Jet.FunctionalTests/Update/UpdatesJetTPCTest.cs new file mode 100644 index 00000000..18579e1c --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Update/UpdatesJetTPCTest.cs @@ -0,0 +1,113 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Diagnostics; +using Microsoft.EntityFrameworkCore.TestModels.UpdatesModel; +using Microsoft.EntityFrameworkCore.Update; +using System.Threading.Tasks; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Update; + +public class UpdatesJetTPCTest(UpdatesJetTPCTest.UpdatesJetTPCFixture fixture, ITestOutputHelper testOutputHelper) + : UpdatesJetTestBase(fixture, testOutputHelper) +{ + public override async Task Save_with_shared_foreign_key() + { + await base.Save_with_shared_foreign_key(); + + AssertContainsSql( + @"@p0=NULL (Size = 8000) (DbType = Binary) +@p1='ProductWithBytes' (Nullable = false) (Size = 21) +@p2=NULL (Size = 4000) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +INSERT INTO [ProductBase] ([Bytes], [Discriminator], [ProductWithBytes_Name]) +OUTPUT INSERTED.[Id] +VALUES (@p0, @p1, @p2);", + @"@p0=NULL (Size = 4000) +@p1='777' + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +INSERT INTO [SpecialCategory] ([Name], [PrincipalId]) +OUTPUT INSERTED.[Id] +VALUES (@p0, @p1);"); + } + + public override async Task Save_replaced_principal() + { + await base.Save_replaced_principal(); + + AssertSql( + """ +SELECT TOP(2) [u].[Id], [u].[Name], [u].[PrincipalId], [u].[Discriminator] +FROM ( + SELECT [c].[Id], [c].[Name], [c].[PrincipalId], N'Category' AS [Discriminator] + FROM [Categories] AS [c] + UNION ALL + SELECT [s].[Id], [s].[Name], [s].[PrincipalId], N'SpecialCategory' AS [Discriminator] + FROM [SpecialCategory] AS [s] +) AS [u] +""", + // + """ +@category_PrincipalId='778' (Nullable = true) + +SELECT [p].[Id], [p].[Discriminator], [p].[DependentId], [p].[IsPrimary], [p].[IsPrimaryNormalized], [p].[Name], [p].[Price] +FROM [ProductBase] AS [p] +WHERE [p].[Discriminator] = N'Product' AND [p].[DependentId] = @category_PrincipalId +""", + // + """ +@p1='1' +@p0='New Category' (Size = 4000) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +UPDATE [Categories] SET [Name] = @p0 +OUTPUT 1 +WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [u].[Id], [u].[Name], [u].[PrincipalId], [u].[Discriminator] +FROM ( + SELECT [c].[Id], [c].[Name], [c].[PrincipalId], N'Category' AS [Discriminator] + FROM [Categories] AS [c] + UNION ALL + SELECT [s].[Id], [s].[Name], [s].[PrincipalId], N'SpecialCategory' AS [Discriminator] + FROM [SpecialCategory] AS [s] +) AS [u] +""", + // + """ +@category_PrincipalId='778' (Nullable = true) + +SELECT [p].[Id], [p].[Discriminator], [p].[DependentId], [p].[IsPrimary], [p].[IsPrimaryNormalized], [p].[Name], [p].[Price] +FROM [ProductBase] AS [p] +WHERE [p].[Discriminator] = N'Product' AND [p].[DependentId] = @category_PrincipalId +"""); + } + + public class UpdatesJetTPCFixture : UpdatesJetFixtureBase + { + protected override string StoreName + => "UpdateTestTPC"; + + public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) + => base.AddOptions(builder).ConfigureWarnings(w => + { + w.Log(RelationalEventId.ForeignKeyTpcPrincipalWarning); + }); + + protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) + { + base.OnModelCreating(modelBuilder, context); + + modelBuilder.Entity().UseTpcMappingStrategy(); + modelBuilder.Entity().UseTpcMappingStrategy(); + modelBuilder.Entity().UseTpcMappingStrategy(); + modelBuilder.Entity().UseTpcMappingStrategy(); + } + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Update/UpdatesJetTPTTest.cs b/test/EFCore.Jet.FunctionalTests/Update/UpdatesJetTPTTest.cs new file mode 100644 index 00000000..977defc9 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Update/UpdatesJetTPTTest.cs @@ -0,0 +1,100 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.TestModels.UpdatesModel; +using Microsoft.EntityFrameworkCore.Update; +using System.Threading.Tasks; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Update; + +public class UpdatesJetTPTTest(UpdatesJetTPTTest.UpdatesJetTPTFixture fixture, ITestOutputHelper testOutputHelper) + : UpdatesJetTestBase(fixture, testOutputHelper) +{ + public override async Task Save_with_shared_foreign_key() + { + await base.Save_with_shared_foreign_key(); + + AssertContainsSql( + @"@p0=NULL (Size = 8000) (DbType = Binary) +@p1='ProductWithBytes' (Nullable = false) (Size = 21) +@p2=NULL (Size = 4000) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +INSERT INTO [ProductBase] ([Bytes], [Discriminator], [ProductWithBytes_Name]) +OUTPUT INSERTED.[Id] +VALUES (@p0, @p1, @p2);", + @"@p0=NULL (Size = 4000) +@p1='777' + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +INSERT INTO [Categories] ([Name], [PrincipalId]) +OUTPUT INSERTED.[Id] +VALUES (@p0, @p1);"); + } + + public override async Task Save_replaced_principal() + { + await base.Save_replaced_principal(); + + AssertSql( + """ +SELECT TOP(2) [c].[Id], [c].[Name], [c].[PrincipalId], CASE + WHEN [s].[Id] IS NOT NULL THEN N'SpecialCategory' +END AS [Discriminator] +FROM [Categories] AS [c] +LEFT JOIN [SpecialCategory] AS [s] ON [c].[Id] = [s].[Id] +""", + // + """ +@category_PrincipalId='778' (Nullable = true) + +SELECT [p].[Id], [p].[Discriminator], [p].[DependentId], [p].[IsPrimary], [p].[IsPrimaryNormalized], [p].[Name], [p].[Price] +FROM [ProductBase] AS [p] +WHERE [p].[Discriminator] = N'Product' AND [p].[DependentId] = @category_PrincipalId +""", + // + """ +@p1='1' +@p0='New Category' (Size = 4000) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +UPDATE [Categories] SET [Name] = @p0 +OUTPUT 1 +WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [c].[Id], [c].[Name], [c].[PrincipalId], CASE + WHEN [s].[Id] IS NOT NULL THEN N'SpecialCategory' +END AS [Discriminator] +FROM [Categories] AS [c] +LEFT JOIN [SpecialCategory] AS [s] ON [c].[Id] = [s].[Id] +""", + // + """ +@category_PrincipalId='778' (Nullable = true) + +SELECT [p].[Id], [p].[Discriminator], [p].[DependentId], [p].[IsPrimary], [p].[IsPrimaryNormalized], [p].[Name], [p].[Price] +FROM [ProductBase] AS [p] +WHERE [p].[Discriminator] = N'Product' AND [p].[DependentId] = @category_PrincipalId +"""); + } + + public class UpdatesJetTPTFixture : UpdatesJetFixtureBase + { + protected override string StoreName + => "UpdateTestTPT"; + + protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) + { + base.OnModelCreating(modelBuilder, context); + + modelBuilder.Entity().UseTptMappingStrategy(); + modelBuilder.Entity().UseTptMappingStrategy(); + modelBuilder.Entity().UseTptMappingStrategy(); + modelBuilder.Entity().UseTptMappingStrategy(); + } + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Update/UpdatesJetTest.cs b/test/EFCore.Jet.FunctionalTests/Update/UpdatesJetTest.cs new file mode 100644 index 00000000..3def3ae0 --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Update/UpdatesJetTest.cs @@ -0,0 +1,83 @@ +using Microsoft.EntityFrameworkCore.Update; +using System.Threading.Tasks; +using Xunit.Abstractions; + +namespace EntityFrameworkCore.Jet.FunctionalTests.Update; + +public class UpdatesJetTest(UpdatesJetTest.UpdatesJetFixture fixture, ITestOutputHelper testOutputHelper) + : UpdatesJetTestBase(fixture, testOutputHelper) +{ + public override async Task Save_with_shared_foreign_key() + { + await base.Save_with_shared_foreign_key(); + + AssertContainsSql( + @"@p0=NULL (Size = 8000) (DbType = Binary) +@p1='ProductWithBytes' (Nullable = false) (Size = 21) +@p2=NULL (Size = 4000) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +INSERT INTO [ProductBase] ([Bytes], [Discriminator], [ProductWithBytes_Name]) +OUTPUT INSERTED.[Id] +VALUES (@p0, @p1, @p2);", + @"@p0='SpecialCategory' (Nullable = false) (Size = 21) +@p1=NULL (Size = 4000) +@p2='777' + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +INSERT INTO [Categories] ([Discriminator], [Name], [PrincipalId]) +OUTPUT INSERTED.[Id] +VALUES (@p0, @p1, @p2);"); + } + + public override async Task Save_replaced_principal() + { + await base.Save_replaced_principal(); + + AssertSql( + """ +SELECT TOP(2) [c].[Id], [c].[Discriminator], [c].[Name], [c].[PrincipalId] +FROM [Categories] AS [c] +""", + // + """ +@category_PrincipalId='778' (Nullable = true) + +SELECT [p].[Id], [p].[Discriminator], [p].[DependentId], [p].[IsPrimary], [p].[IsPrimaryNormalized], [p].[Name], [p].[Price] +FROM [ProductBase] AS [p] +WHERE [p].[Discriminator] = N'Product' AND [p].[DependentId] = @category_PrincipalId +""", + // + """ +@p1='1' +@p0='New Category' (Size = 4000) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +UPDATE [Categories] SET [Name] = @p0 +OUTPUT 1 +WHERE [Id] = @p1; +""", + // + """ +SELECT TOP(2) [c].[Id], [c].[Discriminator], [c].[Name], [c].[PrincipalId] +FROM [Categories] AS [c] +""", + // + """ +@category_PrincipalId='778' (Nullable = true) + +SELECT [p].[Id], [p].[Discriminator], [p].[DependentId], [p].[IsPrimary], [p].[IsPrimaryNormalized], [p].[Name], [p].[Price] +FROM [ProductBase] AS [p] +WHERE [p].[Discriminator] = N'Product' AND [p].[DependentId] = @category_PrincipalId +"""); + } + + public class UpdatesJetFixture : UpdatesJetFixtureBase + { + protected override string StoreName + => "UpdateTest"; + } +} diff --git a/test/EFCore.Jet.FunctionalTests/Update/UpdatesJetTestBase.cs b/test/EFCore.Jet.FunctionalTests/Update/UpdatesJetTestBase.cs new file mode 100644 index 00000000..cf9e3b1f --- /dev/null +++ b/test/EFCore.Jet.FunctionalTests/Update/UpdatesJetTestBase.cs @@ -0,0 +1,291 @@ +using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; +using Microsoft.EntityFrameworkCore.Diagnostics; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.TestModels.UpdatesModel; +using Microsoft.EntityFrameworkCore.TestUtilities; +using System.Linq; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.EntityFrameworkCore.Update; + +public abstract class UpdatesJetTestBase : UpdatesRelationalTestBase + where TFixture : UpdatesJetTestBase.UpdatesJetFixtureBase +{ + protected UpdatesJetTestBase(TFixture fixture, ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + Fixture.TestSqlLoggerFactory.Clear(); + } + + public override async Task Can_add_and_remove_self_refs() + { + await Fixture.ResetIdentity(); + + await base.Can_add_and_remove_self_refs(); + + AssertSql( + """ +@p0=NULL (Size = 4000) +@p1='1' (Nullable = false) (Size = 4000) +@p2=NULL (DbType = Int32) +@p3=NULL (DbType = Int32) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +INSERT INTO [Person] ([Country], [Name], [ParentId], [ZipCode]) +OUTPUT INSERTED.[PersonId] +VALUES (@p0, @p1, @p2, @p3); +""", + // + """ +@p4=NULL (Size = 4000) +@p5='2' (Nullable = false) (Size = 4000) +@p6='1' (Nullable = true) +@p7=NULL (DbType = Int32) +@p8=NULL (Size = 4000) +@p9='3' (Nullable = false) (Size = 4000) +@p10='1' (Nullable = true) +@p11=NULL (DbType = Int32) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +MERGE [Person] USING ( +VALUES (@p4, @p5, @p6, @p7, 0), +(@p8, @p9, @p10, @p11, 1)) AS i ([Country], [Name], [ParentId], [ZipCode], _Position) ON 1=0 +WHEN NOT MATCHED THEN +INSERT ([Country], [Name], [ParentId], [ZipCode]) +VALUES (i.[Country], i.[Name], i.[ParentId], i.[ZipCode]) +OUTPUT INSERTED.[PersonId], i._Position; +""", + // + """ +@p12=NULL (Size = 4000) +@p13='4' (Nullable = false) (Size = 4000) +@p14='2' (Nullable = true) +@p15=NULL (DbType = Int32) +@p16=NULL (Size = 4000) +@p17='5' (Nullable = false) (Size = 4000) +@p18='2' (Nullable = true) +@p19=NULL (DbType = Int32) +@p20=NULL (Size = 4000) +@p21='6' (Nullable = false) (Size = 4000) +@p22='3' (Nullable = true) +@p23=NULL (DbType = Int32) +@p24=NULL (Size = 4000) +@p25='7' (Nullable = false) (Size = 4000) +@p26='3' (Nullable = true) +@p27=NULL (DbType = Int32) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +MERGE [Person] USING ( +VALUES (@p12, @p13, @p14, @p15, 0), +(@p16, @p17, @p18, @p19, 1), +(@p20, @p21, @p22, @p23, 2), +(@p24, @p25, @p26, @p27, 3)) AS i ([Country], [Name], [ParentId], [ZipCode], _Position) ON 1=0 +WHEN NOT MATCHED THEN +INSERT ([Country], [Name], [ParentId], [ZipCode]) +VALUES (i.[Country], i.[Name], i.[ParentId], i.[ZipCode]) +OUTPUT INSERTED.[PersonId], i._Position; +""", + // + """ +@p0='4' +@p1='5' +@p2='6' +@p3='2' +@p4='7' +@p5='3' +@p6=NULL (Size = 4000) +@p7='1' (Nullable = false) (Size = 4000) +@p8=NULL (DbType = Int32) +@p9=NULL (DbType = Int32) + +SET NOCOUNT ON; +DELETE FROM [Person] +OUTPUT 1 +WHERE [PersonId] = @p0; +DELETE FROM [Person] +OUTPUT 1 +WHERE [PersonId] = @p1; +DELETE FROM [Person] +OUTPUT 1 +WHERE [PersonId] = @p2; +DELETE FROM [Person] +OUTPUT 1 +WHERE [PersonId] = @p3; +DELETE FROM [Person] +OUTPUT 1 +WHERE [PersonId] = @p4; +DELETE FROM [Person] +OUTPUT 1 +WHERE [PersonId] = @p5; +INSERT INTO [Person] ([Country], [Name], [ParentId], [ZipCode]) +OUTPUT INSERTED.[PersonId] +VALUES (@p6, @p7, @p8, @p9); +""", + // + """ +@p10='1' +@p11=NULL (Size = 4000) +@p12='2' (Nullable = false) (Size = 4000) +@p13='8' (Nullable = true) +@p14=NULL (DbType = Int32) +@p15=NULL (Size = 4000) +@p16='3' (Nullable = false) (Size = 4000) +@p17='8' (Nullable = true) +@p18=NULL (DbType = Int32) + +SET NOCOUNT ON; +DELETE FROM [Person] +OUTPUT 1 +WHERE [PersonId] = @p10; +MERGE [Person] USING ( +VALUES (@p11, @p12, @p13, @p14, 0), +(@p15, @p16, @p17, @p18, 1)) AS i ([Country], [Name], [ParentId], [ZipCode], _Position) ON 1=0 +WHEN NOT MATCHED THEN +INSERT ([Country], [Name], [ParentId], [ZipCode]) +VALUES (i.[Country], i.[Name], i.[ParentId], i.[ZipCode]) +OUTPUT INSERTED.[PersonId], i._Position; +""", + // + """ +@p19=NULL (Size = 4000) +@p20='4' (Nullable = false) (Size = 4000) +@p21='9' (Nullable = true) +@p22=NULL (DbType = Int32) +@p23=NULL (Size = 4000) +@p24='5' (Nullable = false) (Size = 4000) +@p25='9' (Nullable = true) +@p26=NULL (DbType = Int32) +@p27=NULL (Size = 4000) +@p28='6' (Nullable = false) (Size = 4000) +@p29='10' (Nullable = true) +@p30=NULL (DbType = Int32) +@p31=NULL (Size = 4000) +@p32='7' (Nullable = false) (Size = 4000) +@p33='10' (Nullable = true) +@p34=NULL (DbType = Int32) + +SET IMPLICIT_TRANSACTIONS OFF; +SET NOCOUNT ON; +MERGE [Person] USING ( +VALUES (@p19, @p20, @p21, @p22, 0), +(@p23, @p24, @p25, @p26, 1), +(@p27, @p28, @p29, @p30, 2), +(@p31, @p32, @p33, @p34, 3)) AS i ([Country], [Name], [ParentId], [ZipCode], _Position) ON 1=0 +WHEN NOT MATCHED THEN +INSERT ([Country], [Name], [ParentId], [ZipCode]) +VALUES (i.[Country], i.[Name], i.[ParentId], i.[ZipCode]) +OUTPUT INSERTED.[PersonId], i._Position; +""", + // + """ +SELECT [p].[PersonId], [p].[Country], [p].[Name], [p].[ParentId], [p].[ZipCode], [p].[Address_City], [p].[Country], [p].[ZipCode], [p0].[PersonId], [p0].[Country], [p0].[Name], [p0].[ParentId], [p0].[ZipCode], [p0].[Address_City], [p0].[Country], [p0].[ZipCode], [p1].[PersonId], [p1].[Country], [p1].[Name], [p1].[ParentId], [p1].[ZipCode], [p1].[Address_City], [p1].[Country], [p1].[ZipCode], [p2].[PersonId], [p2].[Country], [p2].[Name], [p2].[ParentId], [p2].[ZipCode], [p2].[Address_City], [p2].[Country], [p2].[ZipCode] +FROM [Person] AS [p] +LEFT JOIN [Person] AS [p0] ON [p].[ParentId] = [p0].[PersonId] +LEFT JOIN [Person] AS [p1] ON [p0].[ParentId] = [p1].[PersonId] +LEFT JOIN [Person] AS [p2] ON [p1].[ParentId] = [p2].[PersonId] +"""); + } + + public override void Identifiers_are_generated_correctly() + { + using var context = CreateContext(); + var entityType = context.Model.FindEntityType( + typeof( + LoginEntityTypeWithAnExtremelyLongAndOverlyConvolutedNameThatIsUsedToVerifyThatTheStoreIdentifierGenerationLengthLimitIsWorkingCorrectly + ))!; + Assert.Equal( + "LoginEntityTypeWithAnExtremelyLongAndOverlyConvolutedNameThatIsUsedToVerifyThatTheStoreIdentifierGenerationLengthLimitIsWorking~", + entityType.GetTableName()); + Assert.Equal( + "PK_LoginEntityTypeWithAnExtremelyLongAndOverlyConvolutedNameThatIsUsedToVerifyThatTheStoreIdentifierGenerationLengthLimitIsWork~", + entityType.GetKeys().Single().GetName()); + Assert.Equal( + "FK_LoginEntityTypeWithAnExtremelyLongAndOverlyConvolutedNameThatIsUsedToVerifyThatTheStoreIdentifierGenerationLengthLimitIsWork~", + entityType.GetForeignKeys().Single().GetConstraintName()); + Assert.Equal( + "IX_LoginEntityTypeWithAnExtremelyLongAndOverlyConvolutedNameThatIsUsedToVerifyThatTheStoreIdentifierGenerationLengthLimitIsWork~", + entityType.GetIndexes().Single().GetDatabaseName()); + + var entityType2 = context.Model.FindEntityType( + typeof( + LoginEntityTypeWithAnExtremelyLongAndOverlyConvolutedNameThatIsUsedToVerifyThatTheStoreIdentifierGenerationLengthLimitIsWorkingCorrectlyDetails + ))!; + + Assert.Equal( + "LoginEntityTypeWithAnExtremelyLongAndOverlyConvolutedNameThatIsUsedToVerifyThatTheStoreIdentifierGenerationLengthLimitIsWorkin~1", + entityType2.GetTableName()); + Assert.Equal( + "PK_LoginDetails", + entityType2.GetKeys().Single().GetName()); + Assert.Equal( + "ExtraPropertyWithAnExtremelyLongAndOverlyConvolutedNameThatIsUsedToVerifyThatTheStoreIdentifierGenerationLengthLimitIsWorkingCo~", + entityType2.GetProperties().ElementAt(1).GetColumnName(StoreObjectIdentifier.Table(entityType2.GetTableName()!))); + Assert.Equal( + "ExtraPropertyWithAnExtremelyLongAndOverlyConvolutedNameThatIsUsedToVerifyThatTheStoreIdentifierGenerationLengthLimitIsWorkingC~1", + entityType2.GetProperties().ElementAt(2).GetColumnName(StoreObjectIdentifier.Table(entityType2.GetTableName()!))); + Assert.Equal( + "IX_LoginEntityTypeWithAnExtremelyLongAndOverlyConvolutedNameThatIsUsedToVerifyThatTheStoreIdentifierGenerationLengthLimitIsWork~", + entityType2.GetIndexes().Single().GetDatabaseName()); + } + + protected void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); + + protected void AssertContainsSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected, assertOrder: false); + + public abstract class UpdatesJetFixtureBase : UpdatesRelationalFixture + { + protected override ITestStoreFactory TestStoreFactory + => JetTestStoreFactory.Instance; + + public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) + => base.AddOptions(builder).ConfigureWarnings(w => + { + w.Log(JetEventId.DecimalTypeKeyWarning); + }); + + protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder) + => configurationBuilder.Properties().HaveColumnType("decimal(18, 2)"); + + protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) + { + base.OnModelCreating(modelBuilder, context); + + modelBuilder.Entity() + .Property(p => p.Id).HasDefaultValueSql("NEWID()"); + + modelBuilder.Entity().HasIndex(p => new { p.Name, p.Price }).HasFilter("Name IS NOT NULL"); + + modelBuilder.Entity() + .HasIndex(e => new { e.Name, e.IsPrimaryNormalized }) + .IsUnique() + .HasFilter(null); + + modelBuilder.Entity() + .Property(e => e.IsPrimaryNormalized) + .HasComputedColumnSql("IIF(IsPrimary = 1, CONVERT(bit, 1), NULL)", stored: true); + } + + public virtual async Task ResetIdentity() + { + var context = CreateContext(); + await context.Database.ExecuteSqlRawAsync(ResetIdentitySql); + TestSqlLoggerFactory.Clear(); + } + + private const string ResetIdentitySql = @" +-- We can't use TRUNCATE on tables with foreign keys, so we DELETE and reset IDENTITY manually. +-- DBCC CHECKIDENT resets IDENTITY, but behaves differently based on whether whether rows were ever inserted (seed+1) or not (seed). +-- So we insert a dummy row before deleting everything to make sure we get the seed value 1. +INSERT INTO [Person] ([Name]) VALUES (''); +DELETE FROM [Person]; +DBCC CHECKIDENT ('[Person]', RESEED, 0);"; + } +} From a6fa2c729e5881170bc384b3136abc32627d4640 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Thu, 27 Nov 2025 23:40:33 +0800 Subject: [PATCH 09/35] fix ef.jet.data.tests --- test/EFCore.Jet.Data.Tests/ConnectionPoolingTest.cs | 4 ++-- test/EFCore.Jet.Data.Tests/CreateDatabaseTest.cs | 1 + test/EFCore.Jet.Data.Tests/UpdateTest.cs | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/EFCore.Jet.Data.Tests/ConnectionPoolingTest.cs b/test/EFCore.Jet.Data.Tests/ConnectionPoolingTest.cs index 13417e5c..85da7d01 100644 --- a/test/EFCore.Jet.Data.Tests/ConnectionPoolingTest.cs +++ b/test/EFCore.Jet.Data.Tests/ConnectionPoolingTest.cs @@ -5,6 +5,7 @@ namespace EntityFrameworkCore.Jet.Data.Tests { [TestClass] + [DoNotParallelize] public class ConnectionPoolingTest { private const string StoreName = nameof(ConnectionPoolingTest) + ".accdb"; @@ -297,12 +298,11 @@ public void Read_Connection_String_After_Dispose() } [TestMethod] - //[ExpectedException(typeof(InvalidOperationException))] public void OpenSeveralTimes() { using var connection = new JetConnection(JetConnection.GetConnectionString(StoreName, Helpers.DataAccessProviderFactory)); connection.Open(); - connection.Open(); + Assert.Throws(() => connection.Open()); } [TestMethod] diff --git a/test/EFCore.Jet.Data.Tests/CreateDatabaseTest.cs b/test/EFCore.Jet.Data.Tests/CreateDatabaseTest.cs index 95e36ec8..9df48e03 100644 --- a/test/EFCore.Jet.Data.Tests/CreateDatabaseTest.cs +++ b/test/EFCore.Jet.Data.Tests/CreateDatabaseTest.cs @@ -9,6 +9,7 @@ namespace EntityFrameworkCore.Jet.Data.Tests { [TestClass] + [DoNotParallelize] public class CreateDatabaseTest { private const string StoreName = nameof(CreateDatabaseTest) + ".accdb"; diff --git a/test/EFCore.Jet.Data.Tests/UpdateTest.cs b/test/EFCore.Jet.Data.Tests/UpdateTest.cs index 6e5e2acf..eea7de75 100644 --- a/test/EFCore.Jet.Data.Tests/UpdateTest.cs +++ b/test/EFCore.Jet.Data.Tests/UpdateTest.cs @@ -4,6 +4,7 @@ namespace EntityFrameworkCore.Jet.Data.Tests { [TestClass] + [DoNotParallelize] public class UpdateTest { private const string StoreName = nameof(UpdateTest) + ".accdb"; From f0df23a780c1d4e861758676859f01d4046e1d94 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Fri, 28 Nov 2025 00:11:14 +0800 Subject: [PATCH 10/35] another fix --- test/EFCore.Jet.Data.Tests/SchemaOperationsTest.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/test/EFCore.Jet.Data.Tests/SchemaOperationsTest.cs b/test/EFCore.Jet.Data.Tests/SchemaOperationsTest.cs index 3fff9a59..8df5ba1c 100644 --- a/test/EFCore.Jet.Data.Tests/SchemaOperationsTest.cs +++ b/test/EFCore.Jet.Data.Tests/SchemaOperationsTest.cs @@ -4,6 +4,7 @@ namespace EntityFrameworkCore.Jet.Data.Tests { [TestClass] + [DoNotParallelize] public class SchemaOperationsTest { private const string StoreName = nameof(SchemaOperationsTest) + ".accdb"; From 98a39f1031e0548422edc4bc4d58e64e4ae8fe58 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Fri, 28 Nov 2025 00:49:34 +0800 Subject: [PATCH 11/35] some more fixes --- test/EFCore.Jet.Data.Tests/CreateE2ETest.cs | 1 + test/EFCore.Jet.Data.Tests/JetInformationSchemaTest.cs | 1 + test/EFCore.Jet.Data.Tests/TransactionTest.cs | 1 + 3 files changed, 3 insertions(+) diff --git a/test/EFCore.Jet.Data.Tests/CreateE2ETest.cs b/test/EFCore.Jet.Data.Tests/CreateE2ETest.cs index a5c4060d..f920a101 100644 --- a/test/EFCore.Jet.Data.Tests/CreateE2ETest.cs +++ b/test/EFCore.Jet.Data.Tests/CreateE2ETest.cs @@ -20,6 +20,7 @@ JET does not support exclamation marks in column names. Exclamation marks has be namespace EntityFrameworkCore.Jet.Data.Tests { [TestClass] + [DoNotParallelize] public class CreateE2ETest { private const string StoreName = nameof(CreateE2ETest) + ".accdb"; diff --git a/test/EFCore.Jet.Data.Tests/JetInformationSchemaTest.cs b/test/EFCore.Jet.Data.Tests/JetInformationSchemaTest.cs index 7234ddd6..ccfc4915 100644 --- a/test/EFCore.Jet.Data.Tests/JetInformationSchemaTest.cs +++ b/test/EFCore.Jet.Data.Tests/JetInformationSchemaTest.cs @@ -5,6 +5,7 @@ namespace EntityFrameworkCore.Jet.Data.Tests { // TODO: Call all tests for ODBC and OLE DB. [TestClass] + [DoNotParallelize] public class JetInformationSchemaTest { private const string StoreName = nameof(JetInformationSchemaTest) + ".accdb"; diff --git a/test/EFCore.Jet.Data.Tests/TransactionTest.cs b/test/EFCore.Jet.Data.Tests/TransactionTest.cs index 3d06b3a6..6ab1fbd7 100644 --- a/test/EFCore.Jet.Data.Tests/TransactionTest.cs +++ b/test/EFCore.Jet.Data.Tests/TransactionTest.cs @@ -3,6 +3,7 @@ namespace EntityFrameworkCore.Jet.Data.Tests { [TestClass] + [DoNotParallelize] public class TransactionTest { private const string StoreName = nameof(TransactionTest) + ".accdb"; From 009fe0631c325d18dd91bbe81a5e3d4d6082ea2c Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Fri, 28 Nov 2025 01:05:43 +0800 Subject: [PATCH 12/35] another fix attempt --- test/EFCore.Jet.Data.Tests/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/EFCore.Jet.Data.Tests/Properties/AssemblyInfo.cs b/test/EFCore.Jet.Data.Tests/Properties/AssemblyInfo.cs index 05113cae..5b29554f 100644 --- a/test/EFCore.Jet.Data.Tests/Properties/AssemblyInfo.cs +++ b/test/EFCore.Jet.Data.Tests/Properties/AssemblyInfo.cs @@ -1,3 +1,3 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)] \ No newline at end of file +[assembly: Parallelize(Workers = 1, Scope = ExecutionScope.MethodLevel)] \ No newline at end of file From ff81424b949de615df6c49220aff17a24f8a037a Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Fri, 28 Nov 2025 18:17:48 +0800 Subject: [PATCH 13/35] more fixes --- .../Sql/Internal/JetQuerySqlGenerator.cs | 2 + .../GreenTests/ace_2010_odbc_x86.txt | 464 +++++++++--------- .../GreenTests/ace_2010_oledb_x86.txt | 436 ++++++++-------- .../Query/GearsOfWarQueryJetTest.cs | 2 +- .../NorthwindMiscellaneousQueryJetTest.cs | 110 ++--- .../Query/TPCGearsOfWarQueryJetTest.cs | 2 +- .../Query/TPTGearsOfWarQueryJetTest.cs | 2 +- 7 files changed, 510 insertions(+), 508 deletions(-) diff --git a/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs b/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs index 9d3ff83a..a83058d5 100644 --- a/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs +++ b/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs @@ -817,8 +817,10 @@ protected override void GenerateTop(SelectExpression selectExpression) if (selectExpression.Limit != null) { Sql.Append("TOP "); + parent.Push(selectExpression); Visit(selectExpression.Limit); Sql.Append(" "); + parent.Pop(); } } diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt index ca6e5056..343ef752 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt @@ -27741,240 +27741,240 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.PrecompiledSqlPregenerationQueryJe EntityFrameworkCore.Jet.FunctionalTests.Query.PrecompiledSqlPregenerationQueryJetTest.Two_non_nullable_reference_types EntityFrameworkCore.Jet.FunctionalTests.Query.PrecompiledSqlPregenerationQueryJetTest.Two_nullable_reference_types EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Any(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Any(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Concat_parameter_collection_equality_inline_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Concat_parameter_collection_equality_inline_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Contains_over_subquery(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Contains_over_subquery(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_method(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_method(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_with_predicate(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_with_predicate(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Distinct(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Distinct(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_ElementAt(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_ElementAt(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection_with_parameters(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection_with_parameters(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_parameter_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_parameter_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_First(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_First(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_FirstOrDefault(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_FirstOrDefault(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_in_subquery_Union_parameter_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_in_subquery_Union_parameter_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_beyond_end(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_beyond_end(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_datetime(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_datetime(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_int(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_int(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_string(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_string(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Intersect_inline_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Intersect_inline_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Join_parameter_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Join_parameter_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Length(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Length(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_bools_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_bools_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_ints_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_ints_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains_null(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains_null(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_strings_contains_null(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_strings_contains_null(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_strings_contains_null(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_strings_contains_null(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_OrderByDescending_ElementAt(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_OrderByDescending_ElementAt(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_projection_from_top_level(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_projection_from_top_level(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_filter(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_filter(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_Select_to_anonymous_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_Select_to_anonymous_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Single(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Single(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SingleOrDefault(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SingleOrDefault(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip_Take(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip_Take(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Take(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Take(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Union_parameter_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Union_parameter_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Count(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Count(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_ElementAt(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_ElementAt(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_equality_inline_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_equality_inline_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip_Take(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip_Take(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Take(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Take(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Union(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Union(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_as_Any_with_predicate(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_as_Any_with_predicate(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_all_parameters(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_all_parameters(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_constant_and_parameter(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_constant_and_parameter(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_mixed_value_types(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_mixed_value_types(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_one_value(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_one_value(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_three_values(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_three_values(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_two_values(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_two_values(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_zero_values(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_zero_values(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_one_value(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_one_value(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_three_values(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_three_values(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_two_values(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_two_values(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_zero_values(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_zero_values(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Except_column_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Except_column_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Join_ordered_column_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Join_ordered_column_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_List_Contains_with_mixed_value_types(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_List_Contains_with_mixed_value_types(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_negated_Contains_as_All(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_negated_Contains_as_All(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_ints_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_ints_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains_null(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains_null(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Count(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Count(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Any +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Any +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Concat_parameter_collection_equality_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Concat_parameter_collection_equality_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Contains_over_subquery +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Contains_over_subquery +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_method +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_method +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_with_predicate +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_with_predicate +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Distinct +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Distinct +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_ElementAt +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_ElementAt +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection_with_parameters +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection_with_parameters +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_parameter_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_parameter_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_First +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_First +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_FirstOrDefault +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_FirstOrDefault +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_in_subquery_Union_parameter_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_in_subquery_Union_parameter_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_beyond_end +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_beyond_end +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_datetime +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_datetime +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Intersect_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Intersect_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Join_parameter_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Join_parameter_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Length +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Length +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_bools_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_bools_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_ints_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_ints_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains_null +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains_null +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_strings_contains_null +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_strings_contains_null +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_strings_contains_null +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_strings_contains_null +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_OrderByDescending_ElementAt +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_OrderByDescending_ElementAt +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_projection_from_top_level +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_projection_from_top_level +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_filter +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_filter +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_Select_to_anonymous_type +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_Select_to_anonymous_type +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Single +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Single +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SingleOrDefault +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SingleOrDefault +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip_Take +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip_Take +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Take +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Take +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Union_parameter_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Union_parameter_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Count +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Count +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_ElementAt +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_ElementAt +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_equality_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_equality_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip_Take +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip_Take +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Take +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Take +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Union +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Union +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_as_Any_with_predicate +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_as_Any_with_predicate +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_all_parameters +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_all_parameters +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_constant_and_parameter +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_constant_and_parameter +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_mixed_value_types +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_mixed_value_types +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_one_value +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_one_value +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_three_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_three_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_two_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_two_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_zero_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_zero_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_one_value +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_one_value +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_three_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_three_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_two_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_two_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_zero_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_zero_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Except_column_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Except_column_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Join_ordered_column_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Join_ordered_column_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_List_Contains_with_mixed_value_types +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_List_Contains_with_mixed_value_types +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_negated_Contains_as_All +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_negated_Contains_as_All +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_ints_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_ints_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains_null +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains_null +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Count +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Count EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Json_representation_of_bool_array -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_arrays_and_no_inferred_type_mapping(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_arrays_and_no_inferred_type_mapping(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_Lists_and_no_inferred_type_mapping(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_Lists_and_no_inferred_type_mapping(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Non_nullable_reference_column_collection_index_equals_nullable_column(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Non_nullable_reference_column_collection_index_equals_nullable_column(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nullable_reference_column_collection_index_equals_nullable_column(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nullable_reference_column_collection_index_equals_nullable_column(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Concat_column_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Concat_column_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Contains_with_EF_Constant(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Contains_with_EF_Constant(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count_with_column_predicate_with_EF_Constant(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count_with_column_predicate_with_EF_Constant(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_HashSet_of_ints_Contains_int(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_HashSet_of_ints_Contains_int(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_ImmutableArray_of_ints_Contains_int(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_ImmutableArray_of_ints_Contains_int(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_arrays_and_no_inferred_type_mapping +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_arrays_and_no_inferred_type_mapping +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_Lists_and_no_inferred_type_mapping +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_Lists_and_no_inferred_type_mapping +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Non_nullable_reference_column_collection_index_equals_nullable_column +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Non_nullable_reference_column_collection_index_equals_nullable_column +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nullable_reference_column_collection_index_equals_nullable_column +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nullable_reference_column_collection_index_equals_nullable_column +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Concat_column_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Concat_column_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Contains_with_EF_Constant +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Contains_with_EF_Constant +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count_with_column_predicate_with_EF_Constant +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count_with_column_predicate_with_EF_Constant +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_HashSet_of_ints_Contains_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_HashSet_of_ints_Contains_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_ImmutableArray_of_ints_Contains_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_ImmutableArray_of_ints_Contains_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_and_Convert_as_compiled_query -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Count_as_compiled_query(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Count_as_compiled_query(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_nested(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_nested(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_Column(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_Column(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_constant(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_constant(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_null_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_null_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_bools_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_bools_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_DateTimes_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_DateTimes_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_enums_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_enums_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_int(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_int(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_nullable_int(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_nullable_int(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_int(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_int(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_nullable_int(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_nullable_int(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_nullable_string(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_nullable_string(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_string(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_string(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_nullable_struct_with_nullable_comparer(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_nullable_struct_with_nullable_comparer(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_nullable_struct(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_nullable_struct(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_struct(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_struct(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_nullable_string(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_nullable_string(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_string(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_string(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_nullable_struct_with_nullable_comparer(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_nullable_struct_with_nullable_comparer(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_nullable_struct(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_nullable_struct(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_struct(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_struct(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Where_with_EF_Constant_Where_Any(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Where_with_EF_Constant_Where_Any(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_with_type_inference_for_JsonScalarExpression(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_with_type_inference_for_JsonScalarExpression(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_datetimes_filtered(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_datetimes_filtered(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_ordered(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_ordered(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_simple(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_simple(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_distinct(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_distinct(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_ToList_and_FirstOrDefault(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_ToList_and_FirstOrDefault(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging2(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging2(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging3(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging3(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_empty_collection_of_nullables_and_collection_only_containing_nulls(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_empty_collection_of_nullables_and_collection_only_containing_nulls(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection_with_Concat(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection_with_Concat(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_multiple_collections(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_multiple_collections(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_primitive_collections_element(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_primitive_collections_element(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Values_of_enum_casted_to_underlying_value(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Values_of_enum_casted_to_underlying_value(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Count_as_compiled_query +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Count_as_compiled_query +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_nested +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_nested +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_Column +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_Column +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_constant +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_constant +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_null_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_null_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_bools_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_bools_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_DateTimes_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_DateTimes_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_enums_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_enums_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_nullable_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_nullable_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_nullable_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_nullable_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_nullable_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_nullable_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_nullable_struct_with_nullable_comparer +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_nullable_struct_with_nullable_comparer +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_nullable_struct +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_nullable_struct +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_struct +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_struct +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_nullable_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_nullable_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_nullable_struct_with_nullable_comparer +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_nullable_struct_with_nullable_comparer +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_nullable_struct +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_nullable_struct +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_struct +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_struct +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Where_with_EF_Constant_Where_Any +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Where_with_EF_Constant_Where_Any +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_with_type_inference_for_JsonScalarExpression +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_with_type_inference_for_JsonScalarExpression +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_datetimes_filtered +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_datetimes_filtered +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_ordered +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_ordered +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_simple +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_simple +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_distinct +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_distinct +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_ToList_and_FirstOrDefault +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_ToList_and_FirstOrDefault +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging2 +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging2 +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging3 +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging3 +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_empty_collection_of_nullables_and_collection_only_containing_nulls +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_empty_collection_of_nullables_and_collection_only_containing_nulls +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection_with_Concat +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection_with_Concat +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_multiple_collections +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_multiple_collections +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_primitive_collections_element +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_primitive_collections_element +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Values_of_enum_casted_to_underlying_value +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Values_of_enum_casted_to_underlying_value EntityFrameworkCore.Jet.FunctionalTests.Query.QueryFilterFuncletizationJetTest.DbContext_complex_expression_is_parameterized EntityFrameworkCore.Jet.FunctionalTests.Query.QueryFilterFuncletizationJetTest.DbContext_field_is_parameterized EntityFrameworkCore.Jet.FunctionalTests.Query.QueryFilterFuncletizationJetTest.DbContext_list_is_parameterized diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt index 0e8ad696..4c3a61c0 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt @@ -28389,226 +28389,226 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.PrecompiledSqlPregenerationQueryJe EntityFrameworkCore.Jet.FunctionalTests.Query.PrecompiledSqlPregenerationQueryJetTest.Two_non_nullable_reference_types EntityFrameworkCore.Jet.FunctionalTests.Query.PrecompiledSqlPregenerationQueryJetTest.Two_nullable_reference_types EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Any(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Any(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Concat_parameter_collection_equality_inline_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Concat_parameter_collection_equality_inline_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Contains_over_subquery(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Contains_over_subquery(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_method(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_method(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_with_predicate(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_with_predicate(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Distinct(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Distinct(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_ElementAt(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_ElementAt(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection_with_parameters(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection_with_parameters(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_parameter_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_parameter_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_First(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_First(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_FirstOrDefault(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_FirstOrDefault(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_in_subquery_Union_parameter_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_in_subquery_Union_parameter_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_beyond_end(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_beyond_end(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_datetime(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_datetime(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_int(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_int(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_string(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_string(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Intersect_inline_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Intersect_inline_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Join_parameter_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Join_parameter_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Length(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Length(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_bools_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_bools_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_ints_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_ints_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains_null(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains_null(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_strings_contains_null(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_strings_contains_null(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_strings_contains_null(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_strings_contains_null(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_OrderByDescending_ElementAt(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_OrderByDescending_ElementAt(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_projection_from_top_level(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_projection_from_top_level(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_filter(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_filter(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_Select_to_anonymous_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_Select_to_anonymous_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Single(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Single(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SingleOrDefault(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SingleOrDefault(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip_Take(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip_Take(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Take(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Take(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Union_parameter_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Union_parameter_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Count(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Count(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_ElementAt(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_ElementAt(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_equality_inline_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_equality_inline_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip_Take(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip_Take(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Take(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Take(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Union(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Union(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_as_Any_with_predicate(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_as_Any_with_predicate(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_all_parameters(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_all_parameters(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_constant_and_parameter(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_constant_and_parameter(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_mixed_value_types(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_mixed_value_types(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_one_value(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_one_value(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_three_values(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_three_values(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_two_values(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_two_values(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_zero_values(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_zero_values(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_one_value(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_one_value(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_three_values(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_three_values(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_two_values(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_two_values(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_zero_values(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_zero_values(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Except_column_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Except_column_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Join_ordered_column_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Join_ordered_column_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_List_Contains_with_mixed_value_types(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_List_Contains_with_mixed_value_types(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_negated_Contains_as_All(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_negated_Contains_as_All(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_ints_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_ints_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains_null(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains_null(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Count(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Count(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Any +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Any +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Concat_parameter_collection_equality_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Concat_parameter_collection_equality_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Contains_over_subquery +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Contains_over_subquery +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_method +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_method +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_with_predicate +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_with_predicate +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Distinct +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Distinct +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_ElementAt +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_ElementAt +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection_with_parameters +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection_with_parameters +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_parameter_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_parameter_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_First +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_First +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_FirstOrDefault +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_FirstOrDefault +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_in_subquery_Union_parameter_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_in_subquery_Union_parameter_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_beyond_end +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_beyond_end +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_datetime +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_datetime +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Intersect_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Intersect_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Join_parameter_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Join_parameter_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Length +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Length +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_bools_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_bools_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_ints_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_ints_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains_null +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains_null +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_strings_contains_null +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_strings_contains_null +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_strings_contains_null +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_strings_contains_null +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_OrderByDescending_ElementAt +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_OrderByDescending_ElementAt +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_projection_from_top_level +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_projection_from_top_level +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_filter +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_filter +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_Select_to_anonymous_type +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_Select_to_anonymous_type +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Single +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Single +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SingleOrDefault +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SingleOrDefault +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip_Take +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip_Take +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Take +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Take +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Union_parameter_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Union_parameter_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Count +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Count +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_ElementAt +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_ElementAt +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_equality_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_equality_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip_Take +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip_Take +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Take +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Take +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Union +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Union +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_as_Any_with_predicate +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_as_Any_with_predicate +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_all_parameters +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_all_parameters +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_constant_and_parameter +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_constant_and_parameter +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_mixed_value_types +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_mixed_value_types +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_one_value +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_one_value +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_three_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_three_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_two_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_two_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_zero_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_zero_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_one_value +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_one_value +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_three_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_three_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_two_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_two_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_zero_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_zero_values +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Except_column_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Except_column_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Join_ordered_column_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Join_ordered_column_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_List_Contains_with_mixed_value_types +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_List_Contains_with_mixed_value_types +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_negated_Contains_as_All +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_negated_Contains_as_All +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_ints_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_ints_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains_null +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains_null +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Count +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Count EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Json_representation_of_bool_array -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_arrays_and_no_inferred_type_mapping(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_arrays_and_no_inferred_type_mapping(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_Lists_and_no_inferred_type_mapping(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_Lists_and_no_inferred_type_mapping(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Non_nullable_reference_column_collection_index_equals_nullable_column(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Non_nullable_reference_column_collection_index_equals_nullable_column(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nullable_reference_column_collection_index_equals_nullable_column(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nullable_reference_column_collection_index_equals_nullable_column(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Concat_column_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Concat_column_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Contains_with_EF_Constant(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Contains_with_EF_Constant(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count_with_column_predicate_with_EF_Constant(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count_with_column_predicate_with_EF_Constant(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_HashSet_of_ints_Contains_int(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_HashSet_of_ints_Contains_int(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_ImmutableArray_of_ints_Contains_int(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_ImmutableArray_of_ints_Contains_int(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_arrays_and_no_inferred_type_mapping +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_arrays_and_no_inferred_type_mapping +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_Lists_and_no_inferred_type_mapping +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_Lists_and_no_inferred_type_mapping +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Non_nullable_reference_column_collection_index_equals_nullable_column +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Non_nullable_reference_column_collection_index_equals_nullable_column +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nullable_reference_column_collection_index_equals_nullable_column +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nullable_reference_column_collection_index_equals_nullable_column +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Concat_column_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Concat_column_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Contains_with_EF_Constant +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Contains_with_EF_Constant +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count_with_column_predicate_with_EF_Constant +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count_with_column_predicate_with_EF_Constant +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_HashSet_of_ints_Contains_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_HashSet_of_ints_Contains_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_ImmutableArray_of_ints_Contains_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_ImmutableArray_of_ints_Contains_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_and_Convert_as_compiled_query -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Count_as_compiled_query(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Count_as_compiled_query(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_nested(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_nested(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_Column(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_Column(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_constant(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_constant(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_null_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_null_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_bools_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_bools_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_DateTimes_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_DateTimes_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_enums_Contains(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_enums_Contains(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_int(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_int(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_nullable_int(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_nullable_int(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_int(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_int(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_nullable_int(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_nullable_int(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_nullable_string(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_nullable_string(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_string(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_string(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_nullable_string(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_nullable_string(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_string(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_string(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Where_with_EF_Constant_Where_Any(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Where_with_EF_Constant_Where_Any(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_with_type_inference_for_JsonScalarExpression(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_with_type_inference_for_JsonScalarExpression(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_datetimes_filtered(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_datetimes_filtered(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_ordered(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_ordered(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_simple(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_simple(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_distinct(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_distinct(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_ToList_and_FirstOrDefault(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_ToList_and_FirstOrDefault(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging2(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging2(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging3(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging3(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_empty_collection_of_nullables_and_collection_only_containing_nulls(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_empty_collection_of_nullables_and_collection_only_containing_nulls(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection_with_Concat(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection_with_Concat(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_multiple_collections(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_multiple_collections(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_primitive_collections_element(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_primitive_collections_element(async: True) +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Count_as_compiled_query +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Count_as_compiled_query +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_nested +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_nested +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_Column +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_Column +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_constant +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_constant +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_null_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_null_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_bools_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_bools_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_DateTimes_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_DateTimes_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_enums_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_enums_Contains +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_nullable_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_nullable_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_nullable_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_nullable_int +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_nullable_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_nullable_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_nullable_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_nullable_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_string +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Where_with_EF_Constant_Where_Any +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Where_with_EF_Constant_Where_Any +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_with_type_inference_for_JsonScalarExpression +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_with_type_inference_for_JsonScalarExpression +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_datetimes_filtered +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_datetimes_filtered +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_ordered +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_ordered +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_simple +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_simple +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_distinct +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_distinct +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_ToList_and_FirstOrDefault +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_ToList_and_FirstOrDefault +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging2 +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging2 +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging3 +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging3 +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_empty_collection_of_nullables_and_collection_only_containing_nulls +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_empty_collection_of_nullables_and_collection_only_containing_nulls +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection_with_Concat +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection_with_Concat +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_multiple_collections +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_multiple_collections +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_primitive_collections_element +EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_primitive_collections_element EntityFrameworkCore.Jet.FunctionalTests.Query.QueryFilterFuncletizationJetTest.DbContext_complex_expression_is_parameterized EntityFrameworkCore.Jet.FunctionalTests.Query.QueryFilterFuncletizationJetTest.DbContext_field_is_parameterized EntityFrameworkCore.Jet.FunctionalTests.Query.QueryFilterFuncletizationJetTest.DbContext_list_is_parameterized diff --git a/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs index 3be7ae50..46188e8a 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs @@ -7347,7 +7347,7 @@ public override async Task Enum_flags_closure_typed_as_different_type_generates_ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`Discriminator`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank` FROM `Gears` AS `g` -WHERE (@prm BAND CLNG(`g`.`Rank`)) = CLNG(`g`.`Rank`) +WHERE (@prm BAND CLNG(CINT(`g`.`Rank`))) = CLNG(`g`.`Rank`) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs index 5324ad2f..42a3816b 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs @@ -2298,18 +2298,18 @@ public override async Task Skip_Take_Any(bool isAsync) AssertSql( """ -SELECT IIF(EXISTS ( - SELECT 1 +SELECT EXISTS ( + SELECT 1 + FROM ( + SELECT TOP @p0 `c0`.`ContactName` FROM ( - SELECT TOP @p0 `c0`.`ContactName` - FROM ( - SELECT TOP @p + @p0 `c`.`ContactName` - FROM `Customers` AS `c` - ORDER BY `c`.`ContactName` - ) AS `c0` - ORDER BY `c0`.`ContactName` DESC - ) AS `c1` - ORDER BY `c1`.`ContactName`), TRUE, FALSE) + SELECT TOP @p + @p0 `c`.`ContactName` + FROM `Customers` AS `c` + ORDER BY `c`.`ContactName` + ) AS `c0` + ORDER BY `c0`.`ContactName` DESC + ) AS `c1` + ORDER BY `c1`.`ContactName`) FROM (SELECT COUNT(*) FROM `#Dual`) """); } @@ -2320,22 +2320,22 @@ public override async Task Skip_Take_All(bool isAsync) AssertSql( """ -SELECT IIF(NOT EXISTS ( - SELECT 1 +SELECT NOT EXISTS ( + SELECT 1 + FROM ( + SELECT `c2`.`CustomerID` FROM ( - SELECT `c2`.`CustomerID` + SELECT TOP @p0 `c1`.`CustomerID` FROM ( - SELECT TOP @p0 `c1`.`CustomerID` - FROM ( - SELECT TOP @p + @p0 `c`.`CustomerID` - FROM `Customers` AS `c` - ORDER BY `c`.`CustomerID` - ) AS `c1` - ORDER BY `c1`.`CustomerID` DESC - ) AS `c2` - ORDER BY `c2`.`CustomerID` - ) AS `c0` - WHERE `c0`.`CustomerID` NOT LIKE 'B%'), TRUE, FALSE) + SELECT TOP @p + @p0 `c`.`CustomerID` + FROM `Customers` AS `c` + ORDER BY `c`.`CustomerID` + ) AS `c1` + ORDER BY `c1`.`CustomerID` DESC + ) AS `c2` + ORDER BY `c2`.`CustomerID` + ) AS `c0` + WHERE `c0`.`CustomerID` NOT LIKE 'B%') FROM (SELECT COUNT(*) FROM `#Dual`) """); } @@ -2346,14 +2346,14 @@ public override async Task Take_All(bool isAsync) AssertSql( """ -SELECT IIF(NOT EXISTS ( - SELECT 1 - FROM ( - SELECT TOP @p `c`.`CustomerID` - FROM `Customers` AS `c` - ORDER BY `c`.`CustomerID` - ) AS `c0` - WHERE `c0`.`CustomerID` NOT LIKE 'A%'), TRUE, FALSE) +SELECT NOT EXISTS ( + SELECT 1 + FROM ( + SELECT TOP @p `c`.`CustomerID` + FROM `Customers` AS `c` + ORDER BY `c`.`CustomerID` + ) AS `c0` + WHERE `c0`.`CustomerID` NOT LIKE 'A%') FROM (SELECT COUNT(*) FROM `#Dual`) """); } @@ -2364,22 +2364,22 @@ public override async Task Skip_Take_Any_with_predicate(bool isAsync) AssertSql( """ -SELECT IIF(EXISTS ( - SELECT 1 +SELECT EXISTS ( + SELECT 1 + FROM ( + SELECT `c2`.`CustomerID` FROM ( - SELECT `c2`.`CustomerID` + SELECT TOP @p0 `c1`.`CustomerID` FROM ( - SELECT TOP @p0 `c1`.`CustomerID` - FROM ( - SELECT TOP @p + @p0 `c`.`CustomerID` - FROM `Customers` AS `c` - ORDER BY `c`.`CustomerID` - ) AS `c1` - ORDER BY `c1`.`CustomerID` DESC - ) AS `c2` - ORDER BY `c2`.`CustomerID` - ) AS `c0` - WHERE `c0`.`CustomerID` LIKE 'C%'), TRUE, FALSE) + SELECT TOP @p + @p0 `c`.`CustomerID` + FROM `Customers` AS `c` + ORDER BY `c`.`CustomerID` + ) AS `c1` + ORDER BY `c1`.`CustomerID` DESC + ) AS `c2` + ORDER BY `c2`.`CustomerID` + ) AS `c0` + WHERE `c0`.`CustomerID` LIKE 'C%') FROM (SELECT COUNT(*) FROM `#Dual`) """); } @@ -2390,14 +2390,14 @@ public override async Task Take_Any_with_predicate(bool isAsync) AssertSql( """ -SELECT IIF(EXISTS ( - SELECT 1 - FROM ( - SELECT TOP @p `c`.`CustomerID` - FROM `Customers` AS `c` - ORDER BY `c`.`CustomerID` - ) AS `c0` - WHERE `c0`.`CustomerID` LIKE 'B%'), TRUE, FALSE) +SELECT EXISTS ( + SELECT 1 + FROM ( + SELECT TOP @p `c`.`CustomerID` + FROM `Customers` AS `c` + ORDER BY `c`.`CustomerID` + ) AS `c0` + WHERE `c0`.`CustomerID` LIKE 'B%') FROM (SELECT COUNT(*) FROM `#Dual`) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs index bb1c306f..24471860 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPCGearsOfWarQueryJetTest.cs @@ -9964,7 +9964,7 @@ UNION ALL SELECT `o`.`Nickname`, `o`.`SquadId`, `o`.`AssignedCityName`, `o`.`CityOfBirthName`, `o`.`FullName`, `o`.`HasSoulPatch`, `o`.`LeaderNickname`, `o`.`LeaderSquadId`, `o`.`Rank`, 'Officer' AS `Discriminator` FROM `Officers` AS `o` ) AS `u` -WHERE (@prm BAND CLNG(`u`.`Rank`)) = CLNG(`u`.`Rank`) +WHERE (@prm BAND CLNG(CINT(`u`.`Rank`))) = CLNG(`u`.`Rank`) """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs index 0bc28f91..401b4f1b 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs @@ -7961,7 +7961,7 @@ public override async Task Enum_flags_closure_typed_as_different_type_generates_ SELECT `g`.`Nickname`, `g`.`SquadId`, `g`.`AssignedCityName`, `g`.`CityOfBirthName`, `g`.`FullName`, `g`.`HasSoulPatch`, `g`.`LeaderNickname`, `g`.`LeaderSquadId`, `g`.`Rank`, IIF(`o`.`Nickname` IS NOT NULL, 'Officer', NULL) AS `Discriminator` FROM `Gears` AS `g` LEFT JOIN `Officers` AS `o` ON `g`.`Nickname` = `o`.`Nickname` AND `g`.`SquadId` = `o`.`SquadId` -WHERE (@prm BAND CLNG(`g`.`Rank`)) = CLNG(`g`.`Rank`) +WHERE (@prm BAND CLNG(CINT(`g`.`Rank`))) = CLNG(`g`.`Rank`) """); } From 937d188a2229104414a8d84fdcfc85ef53cea3ea Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Fri, 28 Nov 2025 21:06:18 +0800 Subject: [PATCH 14/35] more fixes --- .../GreenTests/ace_2010_odbc_x86.txt | 151 ------------------ .../GreenTests/ace_2010_oledb_x86.txt | 145 ----------------- .../PropertyValuesJetTest.cs | 4 +- .../Query/PropertyValuesJetTest.cs | 27 ---- 4 files changed, 2 insertions(+), 325 deletions(-) delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/PropertyValuesJetTest.cs diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt index 343ef752..72a1d5d7 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt @@ -75,33 +75,6 @@ EntityFrameworkCore.Jet.FunctionalTests.BuiltInDataTypesJetTest.Object_to_string EntityFrameworkCore.Jet.FunctionalTests.BuiltInDataTypesJetTest.Optional_datetime_reading_null_from_database EntityFrameworkCore.Jet.FunctionalTests.BuiltInDataTypesJetTest.Sql_translation_uses_type_mapper_when_constant EntityFrameworkCore.Jet.FunctionalTests.BuiltInDataTypesJetTest.Sql_translation_uses_type_mapper_when_parameter -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Delete_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Delete_complex_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Delete_entity_type_with_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Delete_entity_type_with_complex_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_collection_inside_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_collection_inside_complex_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_complex_type_to_another_database_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_complex_type_to_another_database_complex_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_complex_type_to_inline_with_lambda(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_complex_type_to_inline_with_lambda(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_complex_type_to_inline_without_lambda(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_complex_type_to_inline_without_lambda(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_complex_type_to_parameter(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_complex_type_to_parameter(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_multiple_projected_complex_types_via_anonymous_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_multiple_projected_complex_types_via_anonymous_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_multiple_properties_inside_multiple_complex_types_and_on_entity_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_multiple_properties_inside_multiple_complex_types_and_on_entity_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_nested_complex_type_to_parameter(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_nested_complex_type_to_parameter(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_projected_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_projected_complex_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_property_inside_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_property_inside_complex_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_property_inside_nested_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_property_inside_nested_complex_type(async: True) EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NonSharedModelBulkUpdatesJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NonSharedModelBulkUpdatesJetTest.Delete_aggregate_root_when_eager_loaded_owned_collection(async: False) EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NonSharedModelBulkUpdatesJetTest.Delete_aggregate_root_when_eager_loaded_owned_collection(async: True) @@ -21959,8 +21932,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Complex_ty EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Complex_type_equals_complex_type(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Complex_type_equals_constant(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Complex_type_equals_constant(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Complex_type_equals_null(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Complex_type_equals_null(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Complex_type_equals_parameter(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Complex_type_equals_parameter(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Concat_complex_type(async: False) @@ -21987,8 +21958,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_ EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_complex_type_with_FromSql(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_complex_type(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_complex_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_nested_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_nested_complex_type(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_nested_struct_complex_type(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_nested_struct_complex_type(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_struct_complex_type(async: False) @@ -24847,10 +24816,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Context_based_client_method(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Convert_to_nullable_on_nullable_value_is_ignored(isAsync: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Convert_to_nullable_on_nullable_value_is_ignored(isAsync: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Default_if_empty_top_level_arg_followed_by_projecting_constant(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Default_if_empty_top_level_arg_followed_by_projecting_constant(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Default_if_empty_top_level_arg(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Default_if_empty_top_level_arg(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.DefaultIfEmpty_in_subquery(isAsync: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.DefaultIfEmpty_in_subquery(isAsync: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Dependent_to_principal_navigation_equal_to_null_for_subquery(isAsync: False) @@ -27742,239 +27707,123 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.PrecompiledSqlPregenerationQueryJe EntityFrameworkCore.Jet.FunctionalTests.Query.PrecompiledSqlPregenerationQueryJetTest.Two_nullable_reference_types EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Any -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Any -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Concat_parameter_collection_equality_inline_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Concat_parameter_collection_equality_inline_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Contains_over_subquery -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Contains_over_subquery -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_method EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_method EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_with_predicate -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_with_predicate -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Distinct EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Distinct EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_ElementAt -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_ElementAt -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection_with_parameters EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection_with_parameters EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_parameter_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_parameter_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_First -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_First -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_FirstOrDefault EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_FirstOrDefault EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_in_subquery_Union_parameter_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_in_subquery_Union_parameter_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_beyond_end EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_beyond_end EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_datetime -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_datetime EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_int -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_int -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_string EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_string EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Intersect_inline_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Intersect_inline_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Join_parameter_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Join_parameter_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Length -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Length -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_bools_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_bools_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_ints_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_ints_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains_null -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains_null -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_strings_contains_null -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_strings_contains_null -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_strings_contains_null EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_strings_contains_null EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_OrderByDescending_ElementAt -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_OrderByDescending_ElementAt -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_projection_from_top_level EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_projection_from_top_level EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_filter -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_filter EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_Select_to_anonymous_type -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_Select_to_anonymous_type -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Single -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Single -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SingleOrDefault EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SingleOrDefault EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip_Take -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip_Take -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Take -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Take -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Union_parameter_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Union_parameter_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Count -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Count -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_ElementAt EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_ElementAt EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_equality_inline_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_equality_inline_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip_Take EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip_Take EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Take EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Take EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Union -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Union EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_as_Any_with_predicate -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_as_Any_with_predicate -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_all_parameters EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_all_parameters EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_constant_and_parameter -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_constant_and_parameter -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_mixed_value_types EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_mixed_value_types EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_one_value -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_one_value -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_three_values EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_three_values EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_two_values -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_two_values EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_zero_values -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_zero_values -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_one_value EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_one_value EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_three_values -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_three_values -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_two_values EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_two_values EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_zero_values -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_zero_values -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Except_column_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Except_column_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Join_ordered_column_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Join_ordered_column_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_List_Contains_with_mixed_value_types -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_List_Contains_with_mixed_value_types -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_negated_Contains_as_All EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_negated_Contains_as_All EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_ints_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_ints_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains_null EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains_null EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Count -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Count EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Json_representation_of_bool_array EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_arrays_and_no_inferred_type_mapping -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_arrays_and_no_inferred_type_mapping EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_Lists_and_no_inferred_type_mapping -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_Lists_and_no_inferred_type_mapping -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Non_nullable_reference_column_collection_index_equals_nullable_column EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Non_nullable_reference_column_collection_index_equals_nullable_column EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nullable_reference_column_collection_index_equals_nullable_column -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nullable_reference_column_collection_index_equals_nullable_column -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Concat_column_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Concat_column_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Contains_with_EF_Constant -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Contains_with_EF_Constant -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count_with_column_predicate_with_EF_Constant EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count_with_column_predicate_with_EF_Constant EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_HashSet_of_ints_Contains_int -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_HashSet_of_ints_Contains_int -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_ImmutableArray_of_ints_Contains_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_ImmutableArray_of_ints_Contains_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_and_Convert_as_compiled_query EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Count_as_compiled_query -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Count_as_compiled_query -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_nested EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_nested EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_Column -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_Column -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_constant EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_constant EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_null_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_null_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_bools_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_bools_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_DateTimes_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_DateTimes_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_enums_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_enums_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_int -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_nullable_int -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_nullable_int -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_nullable_int -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_nullable_int -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_nullable_string EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_nullable_string EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_string -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_string -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_nullable_struct_with_nullable_comparer EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_nullable_struct_with_nullable_comparer EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_nullable_struct -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_nullable_struct -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_struct EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_structs_Contains_struct EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_nullable_string -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_nullable_string -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_string EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_string EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_nullable_struct_with_nullable_comparer -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_nullable_struct_with_nullable_comparer -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_nullable_struct EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_nullable_struct EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_struct -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_structs_Contains_struct -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Where_with_EF_Constant_Where_Any EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Where_with_EF_Constant_Where_Any EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_with_type_inference_for_JsonScalarExpression -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_with_type_inference_for_JsonScalarExpression EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_datetimes_filtered -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_datetimes_filtered -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_ordered EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_ordered EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_simple -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_simple -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_distinct EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_distinct EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_ToList_and_FirstOrDefault -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_ToList_and_FirstOrDefault -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging2 -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging2 EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging3 -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging3 -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_empty_collection_of_nullables_and_collection_only_containing_nulls EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_empty_collection_of_nullables_and_collection_only_containing_nulls EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection_with_Concat -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection_with_Concat -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_multiple_collections -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_multiple_collections -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_primitive_collections_element EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_primitive_collections_element EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Values_of_enum_casted_to_underlying_value -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Values_of_enum_casted_to_underlying_value EntityFrameworkCore.Jet.FunctionalTests.Query.QueryFilterFuncletizationJetTest.DbContext_complex_expression_is_parameterized EntityFrameworkCore.Jet.FunctionalTests.Query.QueryFilterFuncletizationJetTest.DbContext_field_is_parameterized EntityFrameworkCore.Jet.FunctionalTests.Query.QueryFilterFuncletizationJetTest.DbContext_list_is_parameterized diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt index 4c3a61c0..c9afbad1 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt @@ -76,33 +76,6 @@ EntityFrameworkCore.Jet.FunctionalTests.BuiltInDataTypesJetTest.Object_to_string EntityFrameworkCore.Jet.FunctionalTests.BuiltInDataTypesJetTest.Optional_datetime_reading_null_from_database EntityFrameworkCore.Jet.FunctionalTests.BuiltInDataTypesJetTest.Sql_translation_uses_type_mapper_when_constant EntityFrameworkCore.Jet.FunctionalTests.BuiltInDataTypesJetTest.Sql_translation_uses_type_mapper_when_parameter -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Delete_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Delete_complex_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Delete_entity_type_with_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Delete_entity_type_with_complex_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_collection_inside_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_collection_inside_complex_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_complex_type_to_another_database_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_complex_type_to_another_database_complex_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_complex_type_to_inline_with_lambda(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_complex_type_to_inline_with_lambda(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_complex_type_to_inline_without_lambda(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_complex_type_to_inline_without_lambda(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_complex_type_to_parameter(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_complex_type_to_parameter(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_multiple_projected_complex_types_via_anonymous_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_multiple_projected_complex_types_via_anonymous_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_multiple_properties_inside_multiple_complex_types_and_on_entity_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_multiple_properties_inside_multiple_complex_types_and_on_entity_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_nested_complex_type_to_parameter(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_nested_complex_type_to_parameter(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_projected_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_projected_complex_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_property_inside_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_property_inside_complex_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_property_inside_nested_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.ComplexTypeBulkUpdatesJetTest.Update_property_inside_nested_complex_type(async: True) EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NonSharedModelBulkUpdatesJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NonSharedModelBulkUpdatesJetTest.Delete_aggregate_root_when_eager_loaded_owned_collection(async: False) EntityFrameworkCore.Jet.FunctionalTests.BulkUpdates.NonSharedModelBulkUpdatesJetTest.Delete_aggregate_root_when_eager_loaded_owned_collection(async: True) @@ -21662,8 +21635,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Complex_ty EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Complex_type_equals_complex_type(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Complex_type_equals_constant(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Complex_type_equals_constant(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Complex_type_equals_null(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Complex_type_equals_null(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Complex_type_equals_parameter(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Complex_type_equals_parameter(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Concat_complex_type(async: False) @@ -21690,8 +21661,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_ EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_complex_type_with_FromSql(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_complex_type(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_complex_type(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_nested_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_nested_complex_type(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_nested_struct_complex_type(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_nested_struct_complex_type(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_struct_complex_type(async: False) @@ -25517,10 +25486,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Context_based_client_method(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Convert_to_nullable_on_nullable_value_is_ignored(isAsync: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Convert_to_nullable_on_nullable_value_is_ignored(isAsync: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Default_if_empty_top_level_arg_followed_by_projecting_constant(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Default_if_empty_top_level_arg_followed_by_projecting_constant(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Default_if_empty_top_level_arg(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Default_if_empty_top_level_arg(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.DefaultIfEmpty_in_subquery(isAsync: False) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.DefaultIfEmpty_in_subquery(isAsync: True) EntityFrameworkCore.Jet.FunctionalTests.Query.NorthwindMiscellaneousQueryJetTest.Dependent_to_principal_navigation_equal_to_null_for_subquery(isAsync: False) @@ -28390,225 +28355,115 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.PrecompiledSqlPregenerationQueryJe EntityFrameworkCore.Jet.FunctionalTests.Query.PrecompiledSqlPregenerationQueryJetTest.Two_nullable_reference_types EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Any -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Any -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Concat_parameter_collection_equality_inline_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Concat_parameter_collection_equality_inline_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Contains_over_subquery -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Contains_over_subquery -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_method EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_method EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_with_predicate -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Count_with_predicate -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Distinct EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Distinct EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_ElementAt -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_ElementAt EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection_with_parameters -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection_with_parameters -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_inline_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_parameter_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_equality_parameter_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_First EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_First EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_FirstOrDefault -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_FirstOrDefault -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_in_subquery_Union_parameter_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_in_subquery_Union_parameter_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_beyond_end -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_beyond_end EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_datetime -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_datetime -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_string -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_index_string -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Intersect_inline_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Intersect_inline_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Join_parameter_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Join_parameter_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Length EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Length EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_bools_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_bools_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_ints_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_ints_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains_null EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains_null EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_ints_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_strings_contains_null -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_nullable_strings_contains_null -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_strings_contains_null EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_of_strings_contains_null EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_OrderByDescending_ElementAt -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_OrderByDescending_ElementAt EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_projection_from_top_level -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_projection_from_top_level -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_filter EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_filter EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_Select_to_anonymous_type -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany_with_Select_to_anonymous_type -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SelectMany -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Single EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Single EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SingleOrDefault -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_SingleOrDefault -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip_Take EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip_Take EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Skip EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Take -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Take -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Union_parameter_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Union_parameter_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Count -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Count -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_ElementAt EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_ElementAt EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_equality_inline_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_equality_inline_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip_Take EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip_Take EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Skip EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Take -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Take -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Union EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Column_collection_Where_Union EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_as_Any_with_predicate -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_as_Any_with_predicate -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_all_parameters EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_all_parameters EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_constant_and_parameter -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_constant_and_parameter -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_mixed_value_types EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_mixed_value_types EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_one_value -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_one_value EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_three_values -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_three_values -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_two_values EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_two_values EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_zero_values -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Contains_with_zero_values EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_one_value -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_one_value -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_three_values EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_three_values EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_two_values -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_two_values EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_zero_values -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Count_with_zero_values -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Except_column_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Except_column_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Join_ordered_column_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_Join_ordered_column_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_List_Contains_with_mixed_value_types EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_List_Contains_with_mixed_value_types EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_negated_Contains_as_All -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_negated_Contains_as_All -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_ints_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_ints_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains_null -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains_null EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_of_nullable_ints_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Count -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Inline_collection_with_single_parameter_element_Count EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Json_representation_of_bool_array EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_arrays_and_no_inferred_type_mapping -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_arrays_and_no_inferred_type_mapping EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_Lists_and_no_inferred_type_mapping -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nested_contains_with_Lists_and_no_inferred_type_mapping -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Non_nullable_reference_column_collection_index_equals_nullable_column EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Non_nullable_reference_column_collection_index_equals_nullable_column EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nullable_reference_column_collection_index_equals_nullable_column -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Nullable_reference_column_collection_index_equals_nullable_column EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Concat_column_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Concat_column_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Contains_with_EF_Constant EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Contains_with_EF_Constant EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count_with_column_predicate_with_EF_Constant -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count_with_column_predicate_with_EF_Constant -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_HashSet_of_ints_Contains_int -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_HashSet_of_ints_Contains_int -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_ImmutableArray_of_ints_Contains_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_ImmutableArray_of_ints_Contains_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_and_Convert_as_compiled_query EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Count_as_compiled_query -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Count_as_compiled_query EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_nested -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_nested EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_Column EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_Column EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_constant -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_constant EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_null_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_null_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_bools_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_bools_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_DateTimes_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_DateTimes_Contains -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_enums_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_enums_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_int -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_int -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_nullable_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_ints_Contains_nullable_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_int -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_nullable_int -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_ints_Contains_nullable_int -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_nullable_string EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_nullable_string EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_string -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_nullable_strings_Contains_string -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_nullable_string EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_nullable_string EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_string -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_strings_Contains_string -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Where_with_EF_Constant_Where_Any EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Where_with_EF_Constant_Where_Any EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_with_type_inference_for_JsonScalarExpression -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_with_type_inference_for_JsonScalarExpression EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_datetimes_filtered -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_datetimes_filtered -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_ordered EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_ordered EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_simple -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_simple -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_distinct EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_distinct EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_ToList_and_FirstOrDefault -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_ints_with_ToList_and_FirstOrDefault -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging2 -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging2 EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging3 -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_collection_of_nullable_ints_with_paging3 -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_empty_collection_of_nullables_and_collection_only_containing_nulls EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_empty_collection_of_nullables_and_collection_only_containing_nulls EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection_with_Concat -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection_with_Concat EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_inline_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_multiple_collections EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_multiple_collections EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_primitive_collections_element -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Project_primitive_collections_element EntityFrameworkCore.Jet.FunctionalTests.Query.QueryFilterFuncletizationJetTest.DbContext_complex_expression_is_parameterized EntityFrameworkCore.Jet.FunctionalTests.Query.QueryFilterFuncletizationJetTest.DbContext_field_is_parameterized EntityFrameworkCore.Jet.FunctionalTests.Query.QueryFilterFuncletizationJetTest.DbContext_list_is_parameterized diff --git a/test/EFCore.Jet.FunctionalTests/PropertyValuesJetTest.cs b/test/EFCore.Jet.FunctionalTests/PropertyValuesJetTest.cs index bfe7ebbd..bfe7251c 100644 --- a/test/EFCore.Jet.FunctionalTests/PropertyValuesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/PropertyValuesJetTest.cs @@ -7,9 +7,9 @@ namespace EntityFrameworkCore.Jet.FunctionalTests { public class PropertyValuesJetTest(PropertyValuesJetTest.PropertyValuesJetFixture fixture) - : PropertyValuesTestBase(fixture) + : PropertyValuesRelationalTestBase(fixture) { - public class PropertyValuesJetFixture : PropertyValuesFixtureBase + public class PropertyValuesJetFixture : PropertyValuesRelationalFixture { protected override ITestStoreFactory TestStoreFactory => JetTestStoreFactory.Instance; diff --git a/test/EFCore.Jet.FunctionalTests/Query/PropertyValuesJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/PropertyValuesJetTest.cs deleted file mode 100644 index 6385bc93..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/PropertyValuesJetTest.cs +++ /dev/null @@ -1,27 +0,0 @@ -using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore.TestUtilities; - -namespace Microsoft.EntityFrameworkCore; - -#nullable disable - -public class PropertyValuesJetTest(PropertyValuesJetTest.PropertyValuesJetFixture fixture) - : PropertyValuesRelationalTestBase(fixture) -{ - public class PropertyValuesJetFixture : PropertyValuesRelationalFixture - { - protected override ITestStoreFactory TestStoreFactory - => JetTestStoreFactory.Instance; - - protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) - { - base.OnModelCreating(modelBuilder, context); - - modelBuilder.Entity() - .Property(b => b.Value).HasColumnType("decimal(18,2)"); - - modelBuilder.Entity() - .Property(ce => ce.LeaveBalance).HasColumnType("decimal(18,2)"); - } - } -} From 95d6f3a12999c508352b3370a785d1a7de601930 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 29 Nov 2025 01:55:11 +0800 Subject: [PATCH 15/35] Fix Skip 0 Take 0 Fix lifting an order by --- .../Internal/JetLiftOrderByPostprocessor.cs | 10 ++++-- .../Internal/JetParameterBasedSqlProcessor.cs | 2 +- ...ionVisitor.cs => JetZeroLimitConverter.cs} | 36 ++++++++----------- 3 files changed, 23 insertions(+), 25 deletions(-) rename src/EFCore.Jet/Query/Internal/{SkipTakeCollapsingExpressionVisitor.cs => JetZeroLimitConverter.cs} (68%) diff --git a/src/EFCore.Jet/Query/Internal/JetLiftOrderByPostprocessor.cs b/src/EFCore.Jet/Query/Internal/JetLiftOrderByPostprocessor.cs index 233d576a..3e8b6238 100644 --- a/src/EFCore.Jet/Query/Internal/JetLiftOrderByPostprocessor.cs +++ b/src/EFCore.Jet/Query/Internal/JetLiftOrderByPostprocessor.cs @@ -97,10 +97,10 @@ public virtual Expression Process(Expression expression) } selectExpression.ClearOrdering(); + var limit = selectExpression.Limit; //Keep the limit in parent expression - if (selectExpression.Limit != null) + if (limit != null) { - var limit = selectExpression.Limit; MethodInfo? dynMethod1 = selectExpression.GetType().GetMethod("set_Limit", BindingFlags.NonPublic | BindingFlags.Instance); dynMethod1?.Invoke(selectExpression, [null]); @@ -111,7 +111,6 @@ public virtual Expression Process(Expression expression) selectExpression.Orderings, null, null);*/ selectExpression = AddAliasManager(selectExpression); selectExpression.PushdownIntoSubquery(); - selectExpression.ApplyLimit(limit); } else { @@ -136,6 +135,11 @@ public virtual Expression Process(Expression expression) } } + if (limit != null) + { + selectExpression.ApplyLimit(limit); + } + if (isscalarselect && selectExpression.Projection.Count > 1) { List newProjections = [selectExpression.Projection[0]]; diff --git a/src/EFCore.Jet/Query/Internal/JetParameterBasedSqlProcessor.cs b/src/EFCore.Jet/Query/Internal/JetParameterBasedSqlProcessor.cs index 060b4941..c2fb0132 100644 --- a/src/EFCore.Jet/Query/Internal/JetParameterBasedSqlProcessor.cs +++ b/src/EFCore.Jet/Query/Internal/JetParameterBasedSqlProcessor.cs @@ -29,7 +29,7 @@ public class JetParameterBasedSqlProcessor( /// public override Expression Process(Expression queryExpression, ParametersCacheDecorator parametersDecorator) { - var optimizedQueryExpression = new SkipTakeCollapsingExpressionVisitor(Dependencies.SqlExpressionFactory) + var optimizedQueryExpression = new JetZeroLimitConverter(Dependencies.SqlExpressionFactory) .Process(queryExpression, parametersDecorator); var afterBaseProcessing = base.Process(optimizedQueryExpression, parametersDecorator); diff --git a/src/EFCore.Jet/Query/Internal/SkipTakeCollapsingExpressionVisitor.cs b/src/EFCore.Jet/Query/Internal/JetZeroLimitConverter.cs similarity index 68% rename from src/EFCore.Jet/Query/Internal/SkipTakeCollapsingExpressionVisitor.cs rename to src/EFCore.Jet/Query/Internal/JetZeroLimitConverter.cs index 8f6e2738..88192785 100644 --- a/src/EFCore.Jet/Query/Internal/SkipTakeCollapsingExpressionVisitor.cs +++ b/src/EFCore.Jet/Query/Internal/JetZeroLimitConverter.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore.Query.SqlExpressions; +using EntityFrameworkCore.Jet.Storage.Internal; +using Microsoft.EntityFrameworkCore.Query.SqlExpressions; namespace EntityFrameworkCore.Jet.Query.Internal; @@ -14,7 +15,7 @@ namespace EntityFrameworkCore.Jet.Query.Internal; /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// -public class SkipTakeCollapsingExpressionVisitor : ExpressionVisitor +public class JetZeroLimitConverter : ExpressionVisitor { private readonly ISqlExpressionFactory _sqlExpressionFactory; @@ -26,7 +27,7 @@ public class SkipTakeCollapsingExpressionVisitor : ExpressionVisitor /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// - public SkipTakeCollapsingExpressionVisitor(ISqlExpressionFactory sqlExpressionFactory) + public JetZeroLimitConverter(ISqlExpressionFactory sqlExpressionFactory) { _sqlExpressionFactory = sqlExpressionFactory; _parametersDecorator = null!; @@ -59,9 +60,9 @@ protected override Expression VisitExtension(Expression extensionExpression) { var result = selectExpression.Update( selectExpression.Tables, - selectExpression.GroupBy.Count > 0 ? selectExpression.Predicate : _sqlExpressionFactory.Constant(false), + selectExpression.GroupBy.Count > 0 ? selectExpression.Predicate : _sqlExpressionFactory.Constant(false, JetBoolTypeMapping.Default), selectExpression.GroupBy, - selectExpression.GroupBy.Count > 0 ? _sqlExpressionFactory.Constant(false) : null, + selectExpression.GroupBy.Count > 0 ? _sqlExpressionFactory.Constant(false, JetBoolTypeMapping.Default) : null, selectExpression.Projection, [], limit: null, @@ -71,23 +72,16 @@ protected override Expression VisitExtension(Expression extensionExpression) bool IsZero(SqlExpression? sqlExpression) { - switch (sqlExpression) + return sqlExpression switch { - case SqlConstantExpression { Value: int intValue }: - return intValue == 0; - case SqlParameterExpression parameter: - return _parametersDecorator.GetAndDisableCaching()[parameter.Name] is 0; - case SqlBinaryExpression { Left: SqlConstantExpression left, Right: SqlConstantExpression right }: - return left.Value is int leftValue && right.Value is int rightValue && leftValue + rightValue == 0; - case SqlBinaryExpression { Left: SqlParameterExpression left, Right: SqlConstantExpression right }: - return _parametersDecorator.GetAndDisableCaching()[left.Name] is 0 && right.Value is int and 0; - case SqlBinaryExpression { Left: SqlConstantExpression left, Right: SqlParameterExpression right }: - return _parametersDecorator.GetAndDisableCaching()[right.Name] is 0 && left.Value is int and 0; - case SqlBinaryExpression { Left: SqlParameterExpression left, Right: SqlParameterExpression right }: - return _parametersDecorator.GetAndDisableCaching()[left.Name] is 0 && _parametersDecorator.GetAndDisableCaching()[right.Name] is 0; - default: - return false; - } + SqlConstantExpression { Value: int intValue } => intValue == 0, + SqlParameterExpression parameter => _parametersDecorator.GetAndDisableCaching()[parameter.Name] is 0, + SqlBinaryExpression { Left: SqlConstantExpression left, Right: SqlConstantExpression right } => left.Value is int leftValue && right.Value is int rightValue && leftValue + rightValue == 0, + SqlBinaryExpression { Left: SqlParameterExpression left, Right: SqlConstantExpression right } => _parametersDecorator.GetAndDisableCaching()[left.Name] is 0 && right.Value is int and 0, + SqlBinaryExpression { Left: SqlConstantExpression left, Right: SqlParameterExpression right } => _parametersDecorator.GetAndDisableCaching()[right.Name] is 0 && left.Value is int and 0, + SqlBinaryExpression { Left: SqlParameterExpression left, Right: SqlParameterExpression right } => _parametersDecorator.GetAndDisableCaching()[left.Name] is 0 && _parametersDecorator.GetAndDisableCaching()[right.Name] is 0, + _ => false, + }; } } From 02ece8346e69866b1d6e6c500f6b4fbd8595071e Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 29 Nov 2025 01:55:19 +0800 Subject: [PATCH 16/35] fix tests --- .../GreenTests/ace_2010_odbc_x86.txt | 3 -- .../GreenTests/ace_2010_oledb_x86.txt | 3 -- .../Query/ComplexTypeQueryJetTest.cs | 32 ++++++++----------- .../Query/NorthwindGroupByQueryJetTest.cs | 8 ++--- .../NorthwindMiscellaneousQueryJetTest.cs | 4 +-- .../Translations/EnumTranslationsJetTest.cs | 2 +- .../Update/NonSharedModelUpdatesJetTest.cs | 12 +++---- .../Update/StoredProcedureUpdateJetTest.cs | 2 +- 8 files changed, 27 insertions(+), 39 deletions(-) diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt index 72a1d5d7..b53ffc26 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt @@ -17768,9 +17768,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_sentinel_for_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_sentinel_for_property_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_unbounded_max_length_for_property_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_unicode_for_primitive_collections -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_unicode_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_unicode_for_property_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_specify_discriminator_value EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_specify_discriminator_without_explicit_value EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_use_table_splitting diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt index c9afbad1..a5d6f0dc 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt @@ -17775,9 +17775,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_sentinel_for_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_sentinel_for_property_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_unbounded_max_length_for_property_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_unicode_for_primitive_collections -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_unicode_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_unicode_for_property_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_use_table_splitting EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_use_table_splitting_with_schema EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_use_TPH diff --git a/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs index d0849614..381d1f09 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs @@ -746,22 +746,22 @@ public virtual Task Filter_on_property_inside_complex_type_with_FromSql(bool asy async, ss => ((DbSet)ss.Set()).FromSqlRaw( """ -SELECT [c].[Id], [c].[Name], [c].[BillingAddress_AddressLine1], [c].[BillingAddress_AddressLine2], [c].[BillingAddress_Tags], [c].[BillingAddress_ZipCode], [c].[BillingAddress_Country_Code], [c].[BillingAddress_Country_FullName], [c].[ShippingAddress_AddressLine1], [c].[ShippingAddress_AddressLine2], [c].[ShippingAddress_Tags], [c].[ShippingAddress_ZipCode], [c].[ShippingAddress_Country_Code], [c].[ShippingAddress_Country_FullName] +SELECT [c].[Id], [c].[Name], [c].[BillingAddress_AddressLine1], [c].[BillingAddress_AddressLine2], [c].[BillingAddress_Tags], [c].[BillingAddress_ZipCode], [c].[BillingAddress_Country_Code], [c].[BillingAddress_Country_FullName], [c].[OptionalAddress_AddressLine1], [c].[OptionalAddress_AddressLine2], [c].[OptionalAddress_Tags], [c].[OptionalAddress_ZipCode], [c].[OptionalAddress_Country_Code], [c].[OptionalAddress_Country_FullName], [c].[ShippingAddress_AddressLine1], [c].[ShippingAddress_AddressLine2], [c].[ShippingAddress_Tags], [c].[ShippingAddress_ZipCode], [c].[ShippingAddress_Country_Code], [c].[ShippingAddress_Country_FullName] FROM [Customer] AS [c] WHERE [c].[ShippingAddress_ZipCode] = 7728 """), ss => ss.Set().Where(c => c.ShippingAddress.ZipCode == 07728)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Filter_on_property_inside_complex_type_after_subquery_with_FromSql(bool async) => AssertQuery( async, ss => ((DbSet)ss.Set()).FromSql( $""" - SELECT DISTINCT [t].[Id], [t].[Name], [t].[BillingAddress_AddressLine1], [t].[BillingAddress_AddressLine2], [t].[BillingAddress_Tags], [t].[BillingAddress_ZipCode], [t].[BillingAddress_Country_Code], [t].[BillingAddress_Country_FullName], [t].[ShippingAddress_AddressLine1], [t].[ShippingAddress_AddressLine2], [t].[ShippingAddress_Tags], [t].[ShippingAddress_ZipCode], [t].[ShippingAddress_Country_Code], [t].[ShippingAddress_Country_FullName] + SELECT DISTINCT [t].[Id], [t].[Name], [t].[BillingAddress_AddressLine1], [t].[BillingAddress_AddressLine2], [t].[BillingAddress_Tags], [t].[BillingAddress_ZipCode], [t].[BillingAddress_Country_Code], [t].[BillingAddress_Country_FullName], [t].[OptionalAddress_AddressLine1], [t].[OptionalAddress_AddressLine2], [t].[OptionalAddress_Tags], [t].[OptionalAddress_ZipCode], [t].[OptionalAddress_Country_Code], [t].[OptionalAddress_Country_FullName], [t].[ShippingAddress_AddressLine1], [t].[ShippingAddress_AddressLine2], [t].[ShippingAddress_Tags], [t].[ShippingAddress_ZipCode], [t].[ShippingAddress_Country_Code], [t].[ShippingAddress_Country_FullName] FROM ( - SELECT [c].[Id], [c].[Name], [c].[BillingAddress_AddressLine1], [c].[BillingAddress_AddressLine2], [c].[BillingAddress_Tags], [c].[BillingAddress_ZipCode], [c].[BillingAddress_Country_Code], [c].[BillingAddress_Country_FullName], [c].[ShippingAddress_AddressLine1], [c].[ShippingAddress_AddressLine2], [c].[ShippingAddress_Tags], [c].[ShippingAddress_ZipCode], [c].[ShippingAddress_Country_Code], [c].[ShippingAddress_Country_FullName] + SELECT [c].[Id], [c].[Name], [c].[BillingAddress_AddressLine1], [c].[BillingAddress_AddressLine2], [c].[BillingAddress_Tags], [c].[BillingAddress_ZipCode], [c].[BillingAddress_Country_Code], [c].[BillingAddress_Country_FullName], [c].[OptionalAddress_AddressLine1], [c].[OptionalAddress_AddressLine2], [c].[OptionalAddress_Tags], [c].[OptionalAddress_ZipCode], [c].[OptionalAddress_Country_Code], [c].[OptionalAddress_Country_FullName], [c].[ShippingAddress_AddressLine1], [c].[ShippingAddress_AddressLine2], [c].[ShippingAddress_Tags], [c].[ShippingAddress_ZipCode], [c].[ShippingAddress_Country_Code], [c].[ShippingAddress_Country_FullName] FROM [Customer] AS [c] ORDER BY [c].[Id] OFFSET {1} ROWS @@ -774,16 +774,15 @@ ORDER BY [c].[Id] .Distinct() .Where(c => c.ShippingAddress.ZipCode == 07728)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Load_complex_type_after_subquery_on_entity_type_with_FromSql(bool async) => AssertQuery( async, ss => ((DbSet)ss.Set()).FromSql( $""" - SELECT DISTINCT [t].[Id], [t].[Name], [t].[BillingAddress_AddressLine1], [t].[BillingAddress_AddressLine2], [t].[BillingAddress_Tags], [t].[BillingAddress_ZipCode], [t].[BillingAddress_Country_Code], [t].[BillingAddress_Country_FullName], [t].[ShippingAddress_AddressLine1], [t].[ShippingAddress_AddressLine2], [t].[ShippingAddress_Tags], [t].[ShippingAddress_ZipCode], [t].[ShippingAddress_Country_Code], [t].[ShippingAddress_Country_FullName] + SELECT DISTINCT [t].[Id], [t].[Name], [t].[BillingAddress_AddressLine1], [t].[BillingAddress_AddressLine2], [t].[BillingAddress_Tags], [t].[BillingAddress_ZipCode], [t].[BillingAddress_Country_Code], [t].[BillingAddress_Country_FullName], [t].[OptionalAddress_AddressLine1], [t].[OptionalAddress_AddressLine2], [t].[OptionalAddress_Tags], [t].[OptionalAddress_ZipCode], [t].[OptionalAddress_Country_Code], [t].[OptionalAddress_Country_FullName], [t].[ShippingAddress_AddressLine1], [t].[ShippingAddress_AddressLine2], [t].[ShippingAddress_Tags], [t].[ShippingAddress_ZipCode], [t].[ShippingAddress_Country_Code], [t].[ShippingAddress_Country_FullName] FROM ( - SELECT [c].[Id], [c].[Name], [c].[BillingAddress_AddressLine1], [c].[BillingAddress_AddressLine2], [c].[BillingAddress_Tags], [c].[BillingAddress_ZipCode], [c].[BillingAddress_Country_Code], [c].[BillingAddress_Country_FullName], [c].[ShippingAddress_AddressLine1], [c].[ShippingAddress_AddressLine2], [c].[ShippingAddress_Tags], [c].[ShippingAddress_ZipCode], [c].[ShippingAddress_Country_Code], [c].[ShippingAddress_Country_FullName] + SELECT [c].[Id], [c].[Name], [c].[BillingAddress_AddressLine1], [c].[BillingAddress_AddressLine2], [c].[BillingAddress_Tags], [c].[BillingAddress_ZipCode], [c].[BillingAddress_Country_Code], [c].[BillingAddress_Country_FullName], [c].[OptionalAddress_AddressLine1], [c].[OptionalAddress_AddressLine2], [c].[OptionalAddress_Tags], [c].[OptionalAddress_ZipCode], [c].[OptionalAddress_Country_Code], [c].[OptionalAddress_Country_FullName], [c].[ShippingAddress_AddressLine1], [c].[ShippingAddress_AddressLine2], [c].[ShippingAddress_Tags], [c].[ShippingAddress_ZipCode], [c].[ShippingAddress_Country_Code], [c].[ShippingAddress_Country_FullName] FROM [Customer] AS [c] ORDER BY [c].[Id] OFFSET {1} ROWS @@ -794,8 +793,7 @@ ORDER BY [c].[Id] .Skip(1) .Distinct()); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_complex_type_with_FromSql(bool async) => AssertQuery( async, @@ -806,8 +804,7 @@ FROM [Customer] AS [c] """).Select(c => c.ShippingAddress), ss => ss.Set().Select(c => c.ShippingAddress)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_nested_complex_type_with_FromSql(bool async) => AssertQuery( async, @@ -818,8 +815,7 @@ FROM [Customer] AS [c] """).Select(c => c.ShippingAddress.Country), ss => ss.Set().Select(c => c.ShippingAddress.Country)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_single_property_on_nested_complex_type_with_FromSql(bool async) => AssertQuery( async, @@ -830,8 +826,7 @@ FROM [Customer] AS [c] """).Select(c => c.ShippingAddress.Country.FullName), ss => ss.Set().Select(c => c.ShippingAddress.Country.FullName)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_complex_type_Where_with_FromSql(bool async) => AssertQuery( async, @@ -842,8 +837,7 @@ FROM [Customer] AS [c] """).Select(c => c.ShippingAddress).Where(a => a.ZipCode == 07728), ss => ss.Set().Select(c => c.ShippingAddress).Where(a => a.ZipCode == 07728)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] + [ConditionalTheory, MemberData(nameof(IsAsyncData))] public virtual Task Select_complex_type_Distinct_with_FromSql(bool async) => AssertQuery( async, diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs index fc52e062..07a31685 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs @@ -3053,9 +3053,9 @@ public override async Task GroupBy_aggregate_after_skip_0_take_0(bool async) FROM ( SELECT `o`.`CustomerID` FROM `Orders` AS `o` - WHERE 0 = 1 + WHERE FALSE ) AS `o1` - WHERE 0 = 1 + WHERE FALSE ) AS `o2` ) AS `o0` GROUP BY `o0`.`CustomerID` @@ -3076,9 +3076,9 @@ public override async Task GroupBy_skip_0_take_0_aggregate(bool async) FROM `Orders` AS `o` WHERE `o`.`OrderID` > 10500 GROUP BY `o`.`CustomerID` - HAVING 0 = 1 + HAVING FALSE ) AS `o0` - WHERE 0 = 1 + WHERE FALSE ) AS `o1` """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs index 42a3816b..19cd5b18 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs @@ -5813,9 +5813,9 @@ public override async Task Skip_0_Take_0_works_when_parameter(bool async) FROM ( SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM `Customers` AS `c` - WHERE 0 = 1 + WHERE FALSE ) AS `c0` - WHERE 0 = 1 + WHERE FALSE ) AS `c1` ORDER BY `c1`.`CustomerID` """, diff --git a/test/EFCore.Jet.FunctionalTests/Query/Translations/EnumTranslationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/Translations/EnumTranslationsJetTest.cs index e9e1e21b..1086b961 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/Translations/EnumTranslationsJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/Translations/EnumTranslationsJetTest.cs @@ -150,7 +150,7 @@ public override async Task Bitwise_and_integral_constant() """ SELECT `b`.`Id`, `b`.`Bool`, `b`.`Byte`, `b`.`ByteArray`, `b`.`DateOnly`, `b`.`DateTime`, `b`.`DateTimeOffset`, `b`.`Decimal`, `b`.`Double`, `b`.`Enum`, `b`.`FlagsEnum`, `b`.`Float`, `b`.`Guid`, `b`.`Int`, `b`.`Long`, `b`.`Short`, `b`.`String`, `b`.`TimeOnly`, `b`.`TimeSpan` FROM `BasicTypesEntities` AS `b` -WHERE (CINT(`b`.`FlagsEnum`) BAND 8) = 8 +WHERE (CLNG(CINT(`b`.`FlagsEnum`)) BAND 8) = 8 """); } diff --git a/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs b/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs index 2b9bcf29..2cbafdce 100644 --- a/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs @@ -32,7 +32,7 @@ public override async Task Principal_and_dependent_roundtrips_with_cycle_breakin """, // """ -@p1='2' +@p1='1' @p2='Alice' (Size = 255) INSERT INTO `Author` (`AuthorsClubId`, `Name`) @@ -43,7 +43,7 @@ public override async Task Principal_and_dependent_roundtrips_with_cycle_breakin """, // """ -@p3='2' +@p3='1' @p4=NULL (Size = 255) INSERT INTO `Book` (`AuthorId`, `Title`) @@ -70,7 +70,7 @@ public override async Task Principal_and_dependent_roundtrips_with_cycle_breakin """, // """ -@p1='3' +@p1='2' @p2='Author of the year 2023' (Size = 255) INSERT INTO `Author` (`AuthorsClubId`, `Name`) @@ -81,8 +81,8 @@ public override async Task Principal_and_dependent_roundtrips_with_cycle_breakin """, // """ -@p3='3' -@p4='2' +@p3='2' +@p4='1' UPDATE `Book` SET `AuthorId` = @p3 WHERE `Id` = @p4; @@ -90,7 +90,7 @@ public override async Task Principal_and_dependent_roundtrips_with_cycle_breakin """, // """ -@p0='2' +@p0='1' DELETE FROM `Author` WHERE `Id` = @p0; diff --git a/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs b/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs index 1f19829e..0efd082d 100644 --- a/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs @@ -216,7 +216,7 @@ CREATE PROCEDURE Entity_Delete(@Id int) AssertSql( """ -@p0='2' +@p0='1' EXEC `Entity_Delete` p0; """); From f0d56b2b94623c3b38d1aac9525c3cf24192b8d0 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 29 Nov 2025 12:36:52 +0800 Subject: [PATCH 17/35] try to split functionaltests --- .github/workflows/push.yml | 110 +++++++++++++++++++++++-------------- 1 file changed, 68 insertions(+), 42 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 01c90999..c844c572 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -132,6 +132,7 @@ jobs: echo "dotnetExecutable: ${{ env.dotnetExecutable }}" echo "github.event_name: ${{ github.event_name }}" + echo "github.repository: ${{ github.repository }}" - name: .NET Information Before SDK Install shell: pwsh @@ -235,51 +236,56 @@ jobs: if: always() && env.skipTests != 'true' shell: pwsh run: | - for ($i = 0; $i -lt 3; $i++) { - if (Test-Path '.\test\EFCore.Jet.FunctionalTests\TestResults' -PathType Container) { - Get-ChildItem '.\test\EFCore.Jet.FunctionalTests\TestResults' | Remove-Item -Recurse -Force - } + $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' - $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' - & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.FunctionalTests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m + $filters = @( + 'FullyQualifiedName~.A|FullyQualifiedName~.B|FullyQualifiedName~.C|FullyQualifiedName~.D|FullyQualifiedName~.E|FullyQualifiedName~.F|FullyQualifiedName~.G|FullyQualifiedName~.H|FullyQualifiedName~.I|FullyQualifiedName~.J|FullyQualifiedName~.K|FullyQualifiedName~.L|FullyQualifiedName~.M', + 'FullyQualifiedName~.N|FullyQualifiedName~.O|FullyQualifiedName~.P|FullyQualifiedName~.Q|FullyQualifiedName~.R|FullyQualifiedName~.S|FullyQualifiedName~.T|FullyQualifiedName~.U|FullyQualifiedName~.V|FullyQualifiedName~.W|FullyQualifiedName~.X|FullyQualifiedName~.Y|FullyQualifiedName~.Z' + ) - # - # Check for test runner crashes: - # + for ($shard = 0; $shard -lt $filters.Count; $shard++) { + for ($i = 0; $i -lt 3; $i++) { + $resultsDir = ".\test\EFCore.Jet.FunctionalTests\TestResults\shard_$shard" + if (Test-Path $resultsDir -PathType Container) { + Get-ChildItem $resultsDir | Remove-Item -Recurse -Force + } else { + New-Item -ItemType Directory -Path $resultsDir | Out-Null + } - $testResultsDir = '.\test\EFCore.Jet.FunctionalTests\TestResults' - $currentTestRunTrx = Get-ChildItem $testResultsDir -Filter '*.trx' | Sort-Object LastWriteTime | Select-Object -Last 1 - if ($null -eq $currentTestRunTrx) { - echo 'Test runner log file is missing.' - exit 3 - } + & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.FunctionalTests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m --results-directory $resultsDir --filter "$($filters[$shard])" - $currentTestRunDir = Join-Path $testResultsDir $currentTestRunTrx.BaseName - if (Test-Path $currentTestRunDir) { - if ($null -ne (Get-ChildItem $currentTestRunDir -Filter 'Sequence_*' -Recurse)) { + $currentTestRunTrx = Get-ChildItem $resultsDir -Filter '*.trx' | Sort-Object LastWriteTime | Select-Object -Last 1 + if ($null -eq $currentTestRunTrx) { + echo 'Test runner log file is missing.' + exit 3 + } + + $currentTestRunDir = Join-Path $resultsDir $currentTestRunTrx.BaseName + if (Test-Path $currentTestRunDir) { + if ($null -ne (Get-ChildItem $currentTestRunDir -Filter 'Sequence_*' -Recurse)) { # Split string because searching the log for that phrase should only show actual crashes and not this line. - echo ('Test runner cras' + 'hed.') - continue + echo ('Test runner cras' + 'hed.') + continue + } } - } - echo 'Test runner ran until the end.' - break - } + echo "Shard $shard: Test runner ran until the end." + break + } - $establishedGreenTestsFilePath = ".\test\EFCore.Jet.FunctionalTests\GreenTests\ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}.txt" - $failIfKeepsCrashing = Test-Path $establishedGreenTestsFilePath - - if ($i -ge 3 -and $failIfKeepsCrashing) { - echo 'Test runner keeps crashing.' - exit 2 + $establishedGreenTestsFilePath = ".\test\EFCore.Jet.FunctionalTests\GreenTests\ace_${{ matrix.aceVersion }}_$(''${{ matrix.dataAccessProviderType }}''.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}.txt" + $failIfKeepsCrashing = Test-Path $establishedGreenTestsFilePath + if ($i -ge 3 -and $failIfKeepsCrashing) { + echo "Shard $shard: Test runner keeps crashing." + exit 2 + } } exit 0 - name: 'Rename Test Results' if: always() && env.skipTests != 'true' shell: pwsh run: | - Get-ChildItem -Filter '*.trx' -Recurse | Sort-Object LastWriteTime | ForEach { Rename-Item $_.FullName "ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}_$($_.Name)" -Verbose } + Get-ChildItem -Filter '*.trx' -Recurse | Sort-Object LastWriteTime | ForEach { Rename-Item $_.FullName "ace_${{ matrix.aceVersion }}_$(''${{ matrix.dataAccessProviderType }}''.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}_$($_.Name)" -Verbose } - name: 'Upload Test Results' if: always() && env.skipTests != 'true' && env.uploadTestResults == 'true' uses: actions/upload-artifact@v4 @@ -293,29 +299,49 @@ jobs: if: env.skipTests != 'true' shell: pwsh run: | - # Create text file with all tests that passed. - $testResultsDir = '.\test\EFCore.Jet.FunctionalTests\TestResults' - $currentTestRunTrx = Get-ChildItem $testResultsDir -Filter '*.trx' | Sort-Object LastWriteTime | Select-Object -Last 1 + # Aggregate all shard trx files and compute combined passed tests + $testResultsRoot = '.\test\EFCore.Jet.FunctionalTests\TestResults' + $trxFiles = Get-ChildItem $testResultsRoot -Recurse -Filter '*.trx' | Sort-Object LastWriteTime - if ($null -eq $currentTestRunTrx) { - echo 'Test runner log file is missing.' + if ($null -eq $trxFiles -or $trxFiles.Count -eq 0) { + echo 'Test runner log files are missing.' exit 3 } - $allTestsFilePath = Join-Path $currentTestRunTrx.DirectoryName ($currentTestRunTrx.BaseName + '_All.txt') - (Select-Xml -Path $currentTestRunTrx.FullName -XPath "//ns:UnitTestResult" -Namespace @{"ns"="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"}).Node | Sort-Object -Property testName -CaseSensitive | ForEach-Object { "$($_.outcome -eq 'Passed' ? 'P' : $_.outcome -eq 'NotExecuted' ? 'N' : $_.outcome -eq 'Failed' ? 'F' : 'U') $($_.testName)" } | Add-Content $allTestsFilePath + # Use the latest file's directory as output location for convenience + $latestTrx = $trxFiles | Select-Object -Last 1 + $outputDir = $latestTrx.DirectoryName + + $allTestsFilePath = Join-Path $outputDir ($latestTrx.BaseName + '_All_Aggregated.txt') + if (Test-Path $allTestsFilePath) { Remove-Item $allTestsFilePath -Force } + + foreach ($trx in $trxFiles) { + $nodes = Select-Xml -Path $trx.FullName -XPath "//ns:UnitTestResult" -Namespace @{"ns"="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"} + $nodes.Node | ForEach-Object { + $status = if ($_.outcome -eq 'Passed') { 'P' } elseif ($_.outcome -eq 'NotExecuted') { 'N' } elseif ($_.outcome -eq 'Failed') { 'F' } else { 'U' } + "$status $($_.testName)" | Add-Content $allTestsFilePath + } + } + + # Deduplicate while preserving order + $seen = @{ + } + $dedupedAll = foreach ($line in Get-Content $allTestsFilePath) { if (-not $seen.ContainsKey($line)) { $seen[$line] = $true; $line } } + Set-Content $allTestsFilePath $dedupedAll - $greenTestsFilePath = Join-Path $currentTestRunTrx.DirectoryName ($currentTestRunTrx.BaseName + '_Passed.txt') + # Build combined passed list + $greenTestsFilePath = Join-Path $outputDir ($latestTrx.BaseName + '_Passed_Aggregated.txt') + if (Test-Path $greenTestsFilePath) { Remove-Item $greenTestsFilePath -Force } Get-Content $allTestsFilePath | Where-Object { $_.StartsWith('P ') } | ForEach-Object { $_.Substring(2) } | Add-Content $greenTestsFilePath # Compare test file against previously committed file. - $establishedGreenTestsFilePath = ".\test\EFCore.Jet.FunctionalTests\GreenTests\ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}.txt" + $establishedGreenTestsFilePath = ".\test\EFCore.Jet.FunctionalTests\GreenTests\ace_${{ matrix.aceVersion }}_$(''${{ matrix.dataAccessProviderType }}''.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}.txt" if (Test-Path $establishedGreenTestsFilePath) { $diffResult = Compare-Object (Get-Content $establishedGreenTestsFilePath) (Get-Content $greenTestsFilePath) $notGreenAnymore = $diffResult | Where-Object { $_.SideIndicator -eq '<=' } | Select-Object -ExpandProperty InputObject - if ($null -ne $notGreenAnymore) { + if ($null -ne $notGreenAnymore -and $notGreenAnymore.Count -gt 0) { echo "`nThe following $(@($notGreenAnymore).Length) tests passed in previous runs, but didn't pass in this run:`n" $notGreenAnymore exit 1 @@ -324,7 +350,7 @@ jobs: echo 'All tests that passed in previous runs still passed in this run.' $newlyGreenTests = $diffResult | Where-Object { $_.SideIndicator -eq '=>' } | Select-Object -ExpandProperty InputObject - if ($newlyGreenTests.Length -gt 0) { + if ($newlyGreenTests -and $newlyGreenTests.Length -gt 0) { Copy-Item $greenTestsFilePath $establishedGreenTestsFilePath -Force -Verbose echo "`nThe following new tests passed that did not pass before:`n" From bb09b12eb96f9592fb375027a2ba95807f1916b0 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 29 Nov 2025 12:36:59 +0800 Subject: [PATCH 18/35] more fixes --- .../GreenTests/ace_2010_odbc_x86.txt | 53 ------------------- .../GreenTests/ace_2010_oledb_x86.txt | 37 ------------- .../Query/PrimitiveCollectionsQueryJetTest.cs | 38 ++++++++++--- 3 files changed, 30 insertions(+), 98 deletions(-) diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt index b53ffc26..288ac587 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt @@ -17013,8 +17013,6 @@ EntityFrameworkCore.Jet.FunctionalTests.MaterializationInterceptionJetTest.Multi EntityFrameworkCore.Jet.FunctionalTests.MaterializationInterceptionJetTest.Multiple_materialization_interceptors_can_be_used(inject: True, usePooling: False) EntityFrameworkCore.Jet.FunctionalTests.MaterializationInterceptionJetTest.Multiple_materialization_interceptors_can_be_used(inject: True, usePooling: True) EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Access_mode_can_be_overridden_at_entity_and_property_levels -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_add_shadow_primitive_collections_when_they_have_been_ignored -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_add_shadow_properties_when_they_have_been_ignored EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_call_PrimitiveCollection_on_a_field EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_call_Property_on_a_field EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_ignore_a_field @@ -17022,24 +17020,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_ignore_shadow_properties_when_they_have_been_added_explicitly EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_map_a_tuple EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_complex_property_annotation -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_custom_value_generator_for_primitive_collections -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_custom_value_generator_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_max_length_for_primitive_collections -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_max_length_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_max_length_for_property_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_precision_and_scale_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_precision_and_scale_for_property_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_primitive_collection_annotation_when_no_clr_property -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_property_annotation -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_property_annotation_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_property_annotation_when_no_clr_property -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_sentinel_for_primitive_collections -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_sentinel_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_sentinel_for_property_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_unbounded_max_length_for_property_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_unicode_for_primitive_collections -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_unicode_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_unicode_for_property_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_specify_discriminator_value EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_specify_discriminator_without_explicit_value EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_use_table_splitting @@ -17067,21 +17047,10 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Mapping_throws_for_empty_complex_types EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Mapping_throws_for_non_ignored_navigations_on_complex_types EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Non_nullable_properties_cannot_be_made_optional -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_are_required_by_default_only_if_CLR_type_is_nullable -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_can_be_made_concurrency_tokens -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_can_be_made_optional -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_can_be_made_required -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_can_be_set_to_generate_values_on_Add EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_can_have_field_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.PrimitiveCollectionBuilder_methods_can_be_chained -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_are_required_by_default_only_if_CLR_type_is_nullable EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_ignored EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_ignored_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_made_concurrency_tokens -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_made_optional -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_made_required -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_set_to_generate_values_on_Add EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_access_mode_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_custom_type_value_converter_type_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_field_set @@ -17744,8 +17713,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Shared_type_used_as_owned_type_throws_for_same_name EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Throws_on_FK_matching_two_relationships EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Access_mode_can_be_overridden_at_entity_and_property_levels -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_add_shadow_primitive_collections_when_they_have_been_ignored -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_add_shadow_properties_when_they_have_been_ignored EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_call_PrimitiveCollection_on_a_field EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_call_Property_on_a_field EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_ignore_a_field @@ -17806,20 +17773,8 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_are_required_by_default_only_if_CLR_type_is_nullable EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_ignored EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_ignored_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_made_concurrency_tokens -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_made_optional -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_made_required -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_set_to_generate_values_on_Add -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_access_mode_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_custom_type_value_converter_type_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_field_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_non_generic_value_converter_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_provider_type_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_provider_type_set_for_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_value_converter_configured_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_value_converter_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_value_converter_set_inline -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_set_row_version EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.PropertyBuilder_methods_can_be_chained EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Throws_for_bad_value_generator_type @@ -21953,8 +21908,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Contains_o EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Contains_over_struct_complex_type(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_complex_type_with_FromSql(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_complex_type_with_FromSql(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_complex_type(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_nested_struct_complex_type(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_nested_struct_complex_type(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_struct_complex_type(async: False) @@ -27785,8 +27738,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.P EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_nested EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_Column -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_constant EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_null_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_bools_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_DateTimes_Contains @@ -30126,10 +30077,8 @@ EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_query_shared_d EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_query_shared_nonhierarchy EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_query_shared_nonhierarchy_with_nonshared_dependent EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_share_required_columns -EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_share_required_columns_with_complex_types EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_update_just_dependents EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_use_optional_dependents_with_shared_concurrency_tokens -EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_use_optional_dependents_with_shared_concurrency_tokens_with_complex_types EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_use_with_chained_relationships EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_use_with_fanned_relationships EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_use_with_redundant_relationships @@ -30548,8 +30497,6 @@ EntityFrameworkCore.Jet.FunctionalTests.TptManyToManyTrackingJetTest.Many_to_man EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_change_dependent_instance_non_derived EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_change_principal_and_dependent_instance_non_derived EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_change_principal_instance_non_derived -EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_share_required_columns_with_complex_types -EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_use_optional_dependents_with_shared_concurrency_tokens EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_use_optional_dependents_with_shared_concurrency_tokens_with_complex_types EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_use_with_chained_relationships EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.ExecuteDelete_throws_for_table_sharing(async: False) diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt index a5d6f0dc..0187913c 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt @@ -17027,32 +17027,12 @@ EntityFrameworkCore.Jet.FunctionalTests.MaterializationInterceptionJetTest.Multi EntityFrameworkCore.Jet.FunctionalTests.MaterializationInterceptionJetTest.Multiple_materialization_interceptors_can_be_used(inject: True, usePooling: False) EntityFrameworkCore.Jet.FunctionalTests.MaterializationInterceptionJetTest.Multiple_materialization_interceptors_can_be_used(inject: True, usePooling: True) EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Access_mode_can_be_overridden_at_entity_and_property_levels -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_add_shadow_primitive_collections_when_they_have_been_ignored -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_add_shadow_properties_when_they_have_been_ignored EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_call_PrimitiveCollection_on_a_field EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_call_Property_on_a_field EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_ignore_a_field EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_ignore_shadow_primitive_collections_when_they_have_been_added_explicitly EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_ignore_shadow_properties_when_they_have_been_added_explicitly EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_complex_property_annotation -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_custom_value_generator_for_primitive_collections -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_custom_value_generator_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_max_length_for_primitive_collections -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_max_length_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_max_length_for_property_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_precision_and_scale_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_precision_and_scale_for_property_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_primitive_collection_annotation_when_no_clr_property -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_property_annotation -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_property_annotation_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_property_annotation_when_no_clr_property -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_sentinel_for_primitive_collections -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_sentinel_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_sentinel_for_property_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_unbounded_max_length_for_property_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_unicode_for_primitive_collections -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_unicode_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_unicode_for_property_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_use_table_splitting EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_use_table_splitting_with_schema EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_use_TPH @@ -17077,15 +17057,9 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Mapping_throws_for_empty_complex_types EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Mapping_throws_for_non_ignored_navigations_on_complex_types EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Non_nullable_properties_cannot_be_made_optional -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_are_required_by_default_only_if_CLR_type_is_nullable EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_can_be_made_concurrency_tokens -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_can_be_made_optional -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_can_be_made_required -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_can_be_set_to_generate_values_on_Add EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_can_have_field_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.PrimitiveCollectionBuilder_methods_can_be_chained -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_are_required_by_default_only_if_CLR_type_is_nullable EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_ignored EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_ignored_by_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_made_concurrency_tokens @@ -17752,8 +17726,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Shared_type_used_as_owned_type_throws_for_same_name EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Throws_on_FK_matching_two_relationships EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Access_mode_can_be_overridden_at_entity_and_property_levels -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_add_shadow_primitive_collections_when_they_have_been_ignored -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_add_shadow_properties_when_they_have_been_ignored EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_call_PrimitiveCollection_on_a_field EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_call_Property_on_a_field EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_ignore_a_field @@ -17823,7 +17795,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_value_converter_configured_by_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_value_converter_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_value_converter_set_inline -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_set_row_version EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.PropertyBuilder_methods_can_be_chained EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Throws_for_bad_value_generator_type @@ -21656,8 +21627,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Contains_o EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Contains_over_struct_complex_type(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_complex_type_with_FromSql(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_complex_type_with_FromSql(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_complex_type(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_complex_type(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_nested_struct_complex_type(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_nested_struct_complex_type(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexTypeQueryJetTest.Filter_on_property_inside_struct_complex_type(async: False) @@ -28432,8 +28401,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.P EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_nested EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_Column -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_index_Column_equal_constant EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_null_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_bools_Contains EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_of_DateTimes_Contains @@ -32487,10 +32454,8 @@ EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_query_shared_d EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_query_shared_nonhierarchy EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_query_shared_nonhierarchy_with_nonshared_dependent EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_share_required_columns -EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_share_required_columns_with_complex_types EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_update_just_dependents EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_use_optional_dependents_with_shared_concurrency_tokens -EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_use_optional_dependents_with_shared_concurrency_tokens_with_complex_types EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_use_with_chained_relationships EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_use_with_fanned_relationships EntityFrameworkCore.Jet.FunctionalTests.TableSplittingJetTest.Can_use_with_redundant_relationships @@ -32909,9 +32874,7 @@ EntityFrameworkCore.Jet.FunctionalTests.TptManyToManyTrackingJetTest.Many_to_man EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_change_dependent_instance_non_derived EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_change_principal_and_dependent_instance_non_derived EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_change_principal_instance_non_derived -EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_share_required_columns_with_complex_types EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_use_optional_dependents_with_shared_concurrency_tokens -EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_use_optional_dependents_with_shared_concurrency_tokens_with_complex_types EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_use_with_chained_relationships EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.ExecuteDelete_throws_for_table_sharing(async: False) EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.ExecuteDelete_throws_for_table_sharing(async: True) diff --git a/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs index 0542e871..cc99b444 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs @@ -1,17 +1,18 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Threading.Tasks; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using EntityFrameworkCore.Jet.Internal; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.TestUtilities; +using System; +using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; using Xunit.Sdk; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory; namespace EntityFrameworkCore.Jet.FunctionalTests.Query; @@ -23,6 +24,8 @@ namespace EntityFrameworkCore.Jet.FunctionalTests.Query; public class PrimitiveCollectionsQueryJetTest : PrimitiveCollectionsQueryRelationalTestBase< PrimitiveCollectionsQueryJetTest.PrimitiveCollectionsQueryJetFixture> { + public override int? NumberOfValuesForHugeParameterCollectionTests { get; } = 5000; + public PrimitiveCollectionsQueryJetTest(PrimitiveCollectionsQueryJetFixture fixture, ITestOutputHelper testOutputHelper) : base(fixture) { @@ -506,8 +509,23 @@ FROM OPENJSON(@__p_0) WITH ([value] int '$') AS [p0] """); } - public override Task Parameter_collection_Count() - => AssertTranslationFailedWithDetails(() => base.Parameter_collection_Count(), JetStrings.QueryingIntoJsonCollectionsNotSupported()); + public override async Task Parameter_collection_Count() + { + await base.Parameter_collection_Count(); + + AssertSql( + """ +@ids1='2' +@ids2='999' + +SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[NullableWrappedId], [p].[NullableWrappedIdWithNullableComparer], [p].[String], [p].[Strings], [p].[WrappedId] +FROM [PrimitiveCollectionsEntity] AS [p] +WHERE ( + SELECT COUNT(*) + FROM (VALUES (@ids1), (@ids2)) AS [i]([Value]) + WHERE [i].[Value] > [p].[Id]) = 1 +"""); + } public override async Task Parameter_collection_of_ints_Contains_int() { @@ -1045,11 +1063,15 @@ ORDER BY [v].[_ord] """); } - public override Task Parameter_collection_index_Column_equal_Column() - => AssertTranslationFailedWithDetails(() => base.Parameter_collection_index_Column_equal_Column(), JetStrings.QueryingIntoJsonCollectionsNotSupported()); + public override async Task Parameter_collection_index_Column_equal_Column() + { + await base.Parameter_collection_index_Column_equal_Column(); + } - public override Task Parameter_collection_index_Column_equal_constant() - => AssertTranslationFailedWithDetails(() => base.Parameter_collection_index_Column_equal_constant(), JetStrings.QueryingIntoJsonCollectionsNotSupported()); + public override async Task Parameter_collection_index_Column_equal_constant() + { + await base.Parameter_collection_index_Column_equal_constant(); + } public override Task Column_collection_ElementAt() => AssertTranslationFailedWithDetails(() => base.Column_collection_ElementAt(), JetStrings.QueryingIntoJsonCollectionsNotSupported()); From 8c86e4a70448fe155dfa2e85ceda47f202a99d90 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 29 Nov 2025 12:44:13 +0800 Subject: [PATCH 19/35] typo --- .github/workflows/push.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index c844c572..dabd942e 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -273,7 +273,7 @@ jobs: break } - $establishedGreenTestsFilePath = ".\test\EFCore.Jet.FunctionalTests\GreenTests\ace_${{ matrix.aceVersion }}_$(''${{ matrix.dataAccessProviderType }}''.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}.txt" + $establishedGreenTestsFilePath = ".\test\EFCore.Jet.FunctionalTests\GreenTests\ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}.txt" $failIfKeepsCrashing = Test-Path $establishedGreenTestsFilePath if ($i -ge 3 -and $failIfKeepsCrashing) { echo "Shard $shard: Test runner keeps crashing." @@ -285,7 +285,7 @@ jobs: if: always() && env.skipTests != 'true' shell: pwsh run: | - Get-ChildItem -Filter '*.trx' -Recurse | Sort-Object LastWriteTime | ForEach { Rename-Item $_.FullName "ace_${{ matrix.aceVersion }}_$(''${{ matrix.dataAccessProviderType }}''.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}_$($_.Name)" -Verbose } + Get-ChildItem -Filter '*.trx' -Recurse | Sort-Object LastWriteTime | ForEach { Rename-Item $_.FullName "ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}_$($_.Name)" -Verbose } - name: 'Upload Test Results' if: always() && env.skipTests != 'true' && env.uploadTestResults == 'true' uses: actions/upload-artifact@v4 @@ -335,7 +335,7 @@ jobs: Get-Content $allTestsFilePath | Where-Object { $_.StartsWith('P ') } | ForEach-Object { $_.Substring(2) } | Add-Content $greenTestsFilePath # Compare test file against previously committed file. - $establishedGreenTestsFilePath = ".\test\EFCore.Jet.FunctionalTests\GreenTests\ace_${{ matrix.aceVersion }}_$(''${{ matrix.dataAccessProviderType }}''.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}.txt" + $establishedGreenTestsFilePath = ".\test\EFCore.Jet.FunctionalTests\GreenTests\ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}.txt" if (Test-Path $establishedGreenTestsFilePath) { $diffResult = Compare-Object (Get-Content $establishedGreenTestsFilePath) (Get-Content $greenTestsFilePath) From 17a61eee15cfd1046f5cb8d590a40b65a6549aab Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 29 Nov 2025 12:51:29 +0800 Subject: [PATCH 20/35] Revert --- .github/workflows/push.yml | 106 ++++++++++++++----------------------- 1 file changed, 40 insertions(+), 66 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index dabd942e..01c90999 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -132,7 +132,6 @@ jobs: echo "dotnetExecutable: ${{ env.dotnetExecutable }}" echo "github.event_name: ${{ github.event_name }}" - echo "github.repository: ${{ github.repository }}" - name: .NET Information Before SDK Install shell: pwsh @@ -236,49 +235,44 @@ jobs: if: always() && env.skipTests != 'true' shell: pwsh run: | - $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' - - $filters = @( - 'FullyQualifiedName~.A|FullyQualifiedName~.B|FullyQualifiedName~.C|FullyQualifiedName~.D|FullyQualifiedName~.E|FullyQualifiedName~.F|FullyQualifiedName~.G|FullyQualifiedName~.H|FullyQualifiedName~.I|FullyQualifiedName~.J|FullyQualifiedName~.K|FullyQualifiedName~.L|FullyQualifiedName~.M', - 'FullyQualifiedName~.N|FullyQualifiedName~.O|FullyQualifiedName~.P|FullyQualifiedName~.Q|FullyQualifiedName~.R|FullyQualifiedName~.S|FullyQualifiedName~.T|FullyQualifiedName~.U|FullyQualifiedName~.V|FullyQualifiedName~.W|FullyQualifiedName~.X|FullyQualifiedName~.Y|FullyQualifiedName~.Z' - ) + for ($i = 0; $i -lt 3; $i++) { + if (Test-Path '.\test\EFCore.Jet.FunctionalTests\TestResults' -PathType Container) { + Get-ChildItem '.\test\EFCore.Jet.FunctionalTests\TestResults' | Remove-Item -Recurse -Force + } - for ($shard = 0; $shard -lt $filters.Count; $shard++) { - for ($i = 0; $i -lt 3; $i++) { - $resultsDir = ".\test\EFCore.Jet.FunctionalTests\TestResults\shard_$shard" - if (Test-Path $resultsDir -PathType Container) { - Get-ChildItem $resultsDir | Remove-Item -Recurse -Force - } else { - New-Item -ItemType Directory -Path $resultsDir | Out-Null - } + $env:EFCoreJet_DefaultConnection = '${{ env.defaultConnection }}' + & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.FunctionalTests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m - & '${{ env.dotnetExecutable }}' test .\test\EFCore.Jet.FunctionalTests --configuration '${{ env.buildConfiguration }}' -p:FixedTestOrder=${{ env.deterministicTests }} --logger trx --verbosity detailed --blame-hang-timeout 3m --results-directory $resultsDir --filter "$($filters[$shard])" + # + # Check for test runner crashes: + # - $currentTestRunTrx = Get-ChildItem $resultsDir -Filter '*.trx' | Sort-Object LastWriteTime | Select-Object -Last 1 - if ($null -eq $currentTestRunTrx) { - echo 'Test runner log file is missing.' - exit 3 - } + $testResultsDir = '.\test\EFCore.Jet.FunctionalTests\TestResults' + $currentTestRunTrx = Get-ChildItem $testResultsDir -Filter '*.trx' | Sort-Object LastWriteTime | Select-Object -Last 1 + if ($null -eq $currentTestRunTrx) { + echo 'Test runner log file is missing.' + exit 3 + } - $currentTestRunDir = Join-Path $resultsDir $currentTestRunTrx.BaseName - if (Test-Path $currentTestRunDir) { - if ($null -ne (Get-ChildItem $currentTestRunDir -Filter 'Sequence_*' -Recurse)) { + $currentTestRunDir = Join-Path $testResultsDir $currentTestRunTrx.BaseName + if (Test-Path $currentTestRunDir) { + if ($null -ne (Get-ChildItem $currentTestRunDir -Filter 'Sequence_*' -Recurse)) { # Split string because searching the log for that phrase should only show actual crashes and not this line. - echo ('Test runner cras' + 'hed.') - continue - } + echo ('Test runner cras' + 'hed.') + continue } - - echo "Shard $shard: Test runner ran until the end." - break } - $establishedGreenTestsFilePath = ".\test\EFCore.Jet.FunctionalTests\GreenTests\ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}.txt" - $failIfKeepsCrashing = Test-Path $establishedGreenTestsFilePath - if ($i -ge 3 -and $failIfKeepsCrashing) { - echo "Shard $shard: Test runner keeps crashing." - exit 2 - } + echo 'Test runner ran until the end.' + break + } + + $establishedGreenTestsFilePath = ".\test\EFCore.Jet.FunctionalTests\GreenTests\ace_${{ matrix.aceVersion }}_$('${{ matrix.dataAccessProviderType }}'.Replace(' ', '').ToLowerInvariant())_${{ matrix.aceArchitecture }}.txt" + $failIfKeepsCrashing = Test-Path $establishedGreenTestsFilePath + + if ($i -ge 3 -and $failIfKeepsCrashing) { + echo 'Test runner keeps crashing.' + exit 2 } exit 0 - name: 'Rename Test Results' @@ -299,39 +293,19 @@ jobs: if: env.skipTests != 'true' shell: pwsh run: | - # Aggregate all shard trx files and compute combined passed tests - $testResultsRoot = '.\test\EFCore.Jet.FunctionalTests\TestResults' - $trxFiles = Get-ChildItem $testResultsRoot -Recurse -Filter '*.trx' | Sort-Object LastWriteTime + # Create text file with all tests that passed. + $testResultsDir = '.\test\EFCore.Jet.FunctionalTests\TestResults' + $currentTestRunTrx = Get-ChildItem $testResultsDir -Filter '*.trx' | Sort-Object LastWriteTime | Select-Object -Last 1 - if ($null -eq $trxFiles -or $trxFiles.Count -eq 0) { - echo 'Test runner log files are missing.' + if ($null -eq $currentTestRunTrx) { + echo 'Test runner log file is missing.' exit 3 } - # Use the latest file's directory as output location for convenience - $latestTrx = $trxFiles | Select-Object -Last 1 - $outputDir = $latestTrx.DirectoryName - - $allTestsFilePath = Join-Path $outputDir ($latestTrx.BaseName + '_All_Aggregated.txt') - if (Test-Path $allTestsFilePath) { Remove-Item $allTestsFilePath -Force } - - foreach ($trx in $trxFiles) { - $nodes = Select-Xml -Path $trx.FullName -XPath "//ns:UnitTestResult" -Namespace @{"ns"="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"} - $nodes.Node | ForEach-Object { - $status = if ($_.outcome -eq 'Passed') { 'P' } elseif ($_.outcome -eq 'NotExecuted') { 'N' } elseif ($_.outcome -eq 'Failed') { 'F' } else { 'U' } - "$status $($_.testName)" | Add-Content $allTestsFilePath - } - } - - # Deduplicate while preserving order - $seen = @{ - } - $dedupedAll = foreach ($line in Get-Content $allTestsFilePath) { if (-not $seen.ContainsKey($line)) { $seen[$line] = $true; $line } } - Set-Content $allTestsFilePath $dedupedAll + $allTestsFilePath = Join-Path $currentTestRunTrx.DirectoryName ($currentTestRunTrx.BaseName + '_All.txt') + (Select-Xml -Path $currentTestRunTrx.FullName -XPath "//ns:UnitTestResult" -Namespace @{"ns"="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"}).Node | Sort-Object -Property testName -CaseSensitive | ForEach-Object { "$($_.outcome -eq 'Passed' ? 'P' : $_.outcome -eq 'NotExecuted' ? 'N' : $_.outcome -eq 'Failed' ? 'F' : 'U') $($_.testName)" } | Add-Content $allTestsFilePath - # Build combined passed list - $greenTestsFilePath = Join-Path $outputDir ($latestTrx.BaseName + '_Passed_Aggregated.txt') - if (Test-Path $greenTestsFilePath) { Remove-Item $greenTestsFilePath -Force } + $greenTestsFilePath = Join-Path $currentTestRunTrx.DirectoryName ($currentTestRunTrx.BaseName + '_Passed.txt') Get-Content $allTestsFilePath | Where-Object { $_.StartsWith('P ') } | ForEach-Object { $_.Substring(2) } | Add-Content $greenTestsFilePath # Compare test file against previously committed file. @@ -341,7 +315,7 @@ jobs: $diffResult = Compare-Object (Get-Content $establishedGreenTestsFilePath) (Get-Content $greenTestsFilePath) $notGreenAnymore = $diffResult | Where-Object { $_.SideIndicator -eq '<=' } | Select-Object -ExpandProperty InputObject - if ($null -ne $notGreenAnymore -and $notGreenAnymore.Count -gt 0) { + if ($null -ne $notGreenAnymore) { echo "`nThe following $(@($notGreenAnymore).Length) tests passed in previous runs, but didn't pass in this run:`n" $notGreenAnymore exit 1 @@ -350,7 +324,7 @@ jobs: echo 'All tests that passed in previous runs still passed in this run.' $newlyGreenTests = $diffResult | Where-Object { $_.SideIndicator -eq '=>' } | Select-Object -ExpandProperty InputObject - if ($newlyGreenTests -and $newlyGreenTests.Length -gt 0) { + if ($newlyGreenTests.Length -gt 0) { Copy-Item $greenTestsFilePath $establishedGreenTestsFilePath -Force -Verbose echo "`nThe following new tests passed that did not pass before:`n" From 968b7dbfa1dadc142b45399054faa8a7537d94e3 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 29 Nov 2025 14:15:55 +0800 Subject: [PATCH 21/35] try to rerun for system resource exceeded --- .../TestUtilities/Xunit/JetXunitTestRunner.cs | 63 +++++++++++++++---- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/test/Shared/TestUtilities/Xunit/JetXunitTestRunner.cs b/test/Shared/TestUtilities/Xunit/JetXunitTestRunner.cs index 58afa02e..32ec867f 100644 --- a/test/Shared/TestUtilities/Xunit/JetXunitTestRunner.cs +++ b/test/Shared/TestUtilities/Xunit/JetXunitTestRunner.cs @@ -35,6 +35,9 @@ public class JetXunitTestRunner( aggregator, cancellationTokenSource) { + private const int ResourceExceededMaxRetries = 3; + private const int ResourceExceededDelayMilliseconds = 5000; + public new async Task RunAsync() { var runSummary = new RunSummary { Total = 1 }; @@ -52,8 +55,7 @@ public class JetXunitTestRunner( { ++runSummary.Skipped; - if (!MessageBus.QueueMessage( - new TestSkipped(Test, SkipReason))) + if (!MessageBus.QueueMessage(new TestSkipped(Test, SkipReason))) { CancellationTokenSource.Cancel(); } @@ -61,13 +63,37 @@ public class JetXunitTestRunner( else { var aggregator = new ExceptionAggregator(Aggregator); + if (!aggregator.HasExceptions) { - var tuple = await aggregator.RunAsync(() => InvokeTestAsync(aggregator)); - if (tuple != null) + // Retry loop for transient \"system resource exceeded\" errors. + for (int attempt = 1; attempt <= ResourceExceededMaxRetries; attempt++) { - runSummary.Time = tuple.Item1; - output = tuple.Item2; + var attemptAggregator = new ExceptionAggregator(aggregator); + var tuple = await attemptAggregator.RunAsync(() => InvokeTestAsync(attemptAggregator)); + + var attemptException = attemptAggregator.ToException(); + if (attemptException != null && ContainsSystemResourceExceeded(attemptException)) + { + if (attempt < ResourceExceededMaxRetries) + { + // Pause then retry. + await Task.Delay(ResourceExceededDelayMilliseconds, CancellationTokenSource.Token); + continue; + } + } + + // Either success, non-retryable failure, or final failed retry. + if (tuple != null) + { + runSummary.Time = tuple.Item1; + output = tuple.Item2; + } + + // Merge attempt exceptions back into main aggregator. + aggregator.Add(attemptAggregator.ToException()); + + break; } } @@ -78,7 +104,6 @@ public class JetXunitTestRunner( { testResultMessage = new TestPassed(Test, runSummary.Time, output); } - #region Customized /// This is what we are after. Mark failed tests as 'Skipped', if the failure is expected. else if (SkipFailedTest(exception)) @@ -87,7 +112,6 @@ public class JetXunitTestRunner( ++runSummary.Skipped; } #endregion Customized - else { testResultMessage = new TestFailed(Test, runSummary.Time, output, exception); @@ -105,8 +129,8 @@ public class JetXunitTestRunner( BeforeTestFinished(); - if (Aggregator.HasExceptions && !MessageBus.QueueMessage( - new TestCleanupFailure(Test, Aggregator.ToException()))) + if (Aggregator.HasExceptions && + !MessageBus.QueueMessage(new TestCleanupFailure(Test, Aggregator.ToException()))) { CancellationTokenSource.Cancel(); } @@ -120,6 +144,21 @@ public class JetXunitTestRunner( return runSummary; } + private static bool ContainsSystemResourceExceeded(Exception exception) + { + const string marker = "system resource exceeded"; + var aggregate = exception as AggregateException ?? new AggregateException(exception); + foreach (var inner in aggregate.Flatten().InnerExceptions.SelectMany(e => e.FlattenHierarchy())) + { + if (inner.Message.IndexOf(marker, StringComparison.OrdinalIgnoreCase) >= 0) + { + return true; + } + } + + return false; + } + /// /// Mark failed tests as 'Skipped', if they failed because they use an expression, that we explicitly marked as /// supported by Jet. @@ -128,7 +167,7 @@ protected virtual bool SkipFailedTest(Exception exception) { var skip = false; var unexpectedUnsupportedTranslation = false; - + var aggregateException = exception as AggregateException ?? new AggregateException(exception); @@ -137,7 +176,7 @@ protected virtual bool SkipFailedTest(Exception exception) if (innerException is InvalidOperationException or OleDbException or OdbcException) { var message = innerException.Message; - + if (message.StartsWith("Jet does not support ")) { var expectedUnsupportedTranslation = message.Contains("APPLY statements") || From 22aede2e11f6f5ae1d4658d7b6f4d7f5ae0983ca Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 29 Nov 2025 14:16:00 +0800 Subject: [PATCH 22/35] fixes --- .../GreenTests/ace_2010_odbc_x86.txt | 274 ------------------ .../GreenTests/ace_2010_oledb_x86.txt | 1 - 2 files changed, 275 deletions(-) diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt index 288ac587..86ed14b0 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt @@ -17690,8 +17690,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Navigations_on_owned_type_can_set_access_mode_using_expressions EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Navigations_on_owned_type_collection_can_set_access_mode EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Owned_type_collections_can_be_mapped_to_a_view -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Owned_type_collections_can_be_mapped_to_different_tables -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Owned_types_can_be_mapped_to_different_tables EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Owned_types_use_table_splitting_by_default EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.OwnedType_can_derive_from_Collection EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Owner_can_be_mapped_to_a_view @@ -17720,21 +17718,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_ignore_shadow_properties_when_they_have_been_added_explicitly EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_map_a_tuple EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_complex_property_annotation -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_custom_value_generator_for_primitive_collections -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_custom_value_generator_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_max_length_for_primitive_collections -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_max_length_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_max_length_for_property_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_precision_and_scale_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_precision_and_scale_for_property_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_primitive_collection_annotation_when_no_clr_property -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_property_annotation -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_property_annotation_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_property_annotation_when_no_clr_property -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_sentinel_for_primitive_collections -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_sentinel_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_sentinel_for_property_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_unbounded_max_length_for_property_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_specify_discriminator_value EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_specify_discriminator_without_explicit_value EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_use_table_splitting @@ -18404,8 +18387,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Navigations_on_owned_type_can_set_access_mode_using_expressions EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Navigations_on_owned_type_collection_can_set_access_mode EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Owned_type_collections_can_be_mapped_to_a_view -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Owned_type_collections_can_be_mapped_to_different_tables -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Owned_types_can_be_mapped_to_different_tables EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Owned_types_use_table_splitting_by_default EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.OwnedType_can_derive_from_Collection EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Owner_can_be_mapped_to_a_view @@ -27822,261 +27803,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.QueryNoClientEvalJetTest.Throws_wh EntityFrameworkCore.Jet.FunctionalTests.Query.QueryNoClientEvalJetTest.Throws_when_subquery_main_from_clause EntityFrameworkCore.Jet.FunctionalTests.Query.QueryNoClientEvalJetTest.Throws_when_where EntityFrameworkCore.Jet.FunctionalTests.Query.QueryNoClientEvalJetTest.Throws_when_where_subquery_correlated -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_branch_collection_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_branch_collection_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_branch_optional_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_branch_optional_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_branch_optional_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_branch_optional_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_branch_required_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_branch_required_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_branch_required_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_branch_required_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_trunk_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_trunk_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_trunk_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_trunk_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_trunk_required_optional_and_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_trunk_required_optional_and_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_trunk_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Include.NavigationIncludeJetTest.Include_trunk_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexNoTrackingProjectionJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexNoTrackingProjectionJetTest.Select_branch_required_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexNoTrackingProjectionJetTest.Select_branch_required_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexNoTrackingProjectionJetTest.Select_everything(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexNoTrackingProjectionJetTest.Select_everything(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexNoTrackingProjectionJetTest.Select_leaf_trunk_root(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexNoTrackingProjectionJetTest.Select_leaf_trunk_root(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexNoTrackingProjectionJetTest.Select_root_duplicated(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexNoTrackingProjectionJetTest.Select_root_duplicated(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexNoTrackingProjectionJetTest.Select_root(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexNoTrackingProjectionJetTest.Select_root(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexNoTrackingProjectionJetTest.Select_trunk_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexNoTrackingProjectionJetTest.Select_trunk_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexNoTrackingProjectionJetTest.Select_trunk_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexNoTrackingProjectionJetTest.Select_trunk_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexProjectionJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexProjectionJetTest.Select_branch_required_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexProjectionJetTest.Select_branch_required_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexProjectionJetTest.Select_everything(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexProjectionJetTest.Select_everything(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexProjectionJetTest.Select_leaf_trunk_root(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexProjectionJetTest.Select_leaf_trunk_root(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexProjectionJetTest.Select_root_duplicated(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexProjectionJetTest.Select_root_duplicated(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexProjectionJetTest.Select_root(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexProjectionJetTest.Select_root(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexProjectionJetTest.Select_trunk_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexProjectionJetTest.Select_trunk_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexProjectionJetTest.Select_trunk_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.ComplexProjectionJetTest.Select_trunk_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.Select_branch_optional_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.Select_branch_optional_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.Select_branch_required_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.Select_branch_required_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.Select_everything_using_joins(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.Select_everything_using_joins(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.Select_multiple_branch_leaf(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.Select_multiple_branch_leaf(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.Select_trunk_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.Select_trunk_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.SelectMany_optional_trunk_reference_branch_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.SelectMany_optional_trunk_reference_branch_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.SelectMany_required_trunk_reference_branch_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.SelectMany_required_trunk_reference_branch_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.SelectMany_trunk_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationNoTrackingProjectionJetTest.SelectMany_trunk_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.Select_branch_optional_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.Select_branch_optional_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.Select_branch_required_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.Select_branch_required_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.Select_everything_using_joins(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.Select_everything_using_joins(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.Select_multiple_branch_leaf(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.Select_multiple_branch_leaf(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.Select_trunk_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.Select_trunk_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.SelectMany_optional_trunk_reference_branch_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.SelectMany_optional_trunk_reference_branch_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.SelectMany_required_trunk_reference_branch_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.SelectMany_required_trunk_reference_branch_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.SelectMany_trunk_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationProjectionJetTest.SelectMany_trunk_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_branch_optional_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_branch_optional_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_branch_optional_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_branch_optional_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_branch_required_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_branch_required_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_branch_required_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_branch_required_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_everything(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_everything(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_leaf_trunk_root(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_leaf_trunk_root(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_root_duplicated(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_root_duplicated(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_root(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_root(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_trunk_and_branch_duplicated(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_trunk_and_branch_duplicated(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_trunk_and_trunk_duplicated(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_trunk_and_trunk_duplicated(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_trunk_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_trunk_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_trunk_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceNoTrackingProjectionJetTest.Select_trunk_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_branch_optional_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_branch_optional_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_branch_optional_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_branch_optional_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_branch_required_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_branch_required_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_branch_required_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_branch_required_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_everything(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_everything(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_leaf_trunk_root(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_leaf_trunk_root(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_root_duplicated(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_root_duplicated(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_root(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_root(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_trunk_and_branch_duplicated(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_trunk_and_branch_duplicated(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_trunk_and_trunk_duplicated(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_trunk_and_trunk_duplicated(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_trunk_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_trunk_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_trunk_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.NavigationReferenceProjectionJetTest.Select_trunk_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedNoTrackingProjectionJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedNoTrackingProjectionJetTest.Select_branch_optional_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedNoTrackingProjectionJetTest.Select_branch_optional_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedNoTrackingProjectionJetTest.Select_branch_required_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedNoTrackingProjectionJetTest.Select_branch_required_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedNoTrackingProjectionJetTest.Select_multiple_branch_leaf(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedNoTrackingProjectionJetTest.Select_multiple_branch_leaf(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedNoTrackingProjectionJetTest.Select_trunk_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedNoTrackingProjectionJetTest.Select_trunk_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedNoTrackingProjectionJetTest.SelectMany_optional_trunk_reference_branch_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedNoTrackingProjectionJetTest.SelectMany_optional_trunk_reference_branch_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedNoTrackingProjectionJetTest.SelectMany_required_trunk_reference_branch_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedNoTrackingProjectionJetTest.SelectMany_required_trunk_reference_branch_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedNoTrackingProjectionJetTest.SelectMany_trunk_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedNoTrackingProjectionJetTest.SelectMany_trunk_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.Select_branch_optional_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.Select_branch_optional_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.Select_branch_required_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.Select_branch_required_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.Select_multiple_branch_leaf(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.Select_multiple_branch_leaf(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.Select_subquery_root_set_complex_projection_FirstOrDefault_project_reference_to_outer(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.Select_subquery_root_set_complex_projection_including_references_to_outer_FirstOrDefault(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.Select_subquery_root_set_trunk_FirstOrDefault_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.Select_subquery_root_set_trunk_FirstOrDefault_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.Select_trunk_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.Select_trunk_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.SelectMany_optional_trunk_reference_branch_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.SelectMany_optional_trunk_reference_branch_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.SelectMany_required_trunk_reference_branch_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.SelectMany_required_trunk_reference_branch_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.SelectMany_trunk_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedProjectionJetTest.SelectMany_trunk_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_branch_optional_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_branch_optional_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_branch_optional_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_branch_optional_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_branch_required_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_branch_required_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_branch_required_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_branch_required_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_leaf_trunk_root(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_leaf_trunk_root(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_root_duplicated(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_root_duplicated(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_root(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_root(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_trunk_and_branch_duplicated(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_trunk_and_branch_duplicated(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_trunk_and_trunk_duplicated(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_trunk_and_trunk_duplicated(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_trunk_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_trunk_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_trunk_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceNoTrackingProjectionJetTest.Select_trunk_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_branch_optional_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_branch_optional_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_branch_optional_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_branch_optional_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_branch_required_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_branch_required_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_branch_required_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_branch_required_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_leaf_trunk_root(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_leaf_trunk_root(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_root_duplicated(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_root_duplicated(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_root(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_root(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_subquery_root_set_optional_trunk_FirstOrDefault_branch(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_subquery_root_set_required_trunk_FirstOrDefault_branch(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_subquery_root_set_required_trunk_FirstOrDefault_branch(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_trunk_and_branch_duplicated(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_trunk_and_branch_duplicated(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_trunk_and_trunk_duplicated(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_trunk_and_trunk_duplicated(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_trunk_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_trunk_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_trunk_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedReferenceProjectionJetTest.Select_trunk_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingNoTrackingProjectionJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingNoTrackingProjectionJetTest.Select_branch_optional_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingNoTrackingProjectionJetTest.Select_branch_optional_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingNoTrackingProjectionJetTest.Select_branch_required_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingNoTrackingProjectionJetTest.Select_branch_required_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingNoTrackingProjectionJetTest.Select_multiple_branch_leaf(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingNoTrackingProjectionJetTest.Select_multiple_branch_leaf(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingNoTrackingProjectionJetTest.Select_trunk_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingNoTrackingProjectionJetTest.Select_trunk_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingNoTrackingProjectionJetTest.SelectMany_optional_trunk_reference_branch_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingNoTrackingProjectionJetTest.SelectMany_optional_trunk_reference_branch_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingNoTrackingProjectionJetTest.SelectMany_required_trunk_reference_branch_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingNoTrackingProjectionJetTest.SelectMany_required_trunk_reference_branch_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingNoTrackingProjectionJetTest.SelectMany_trunk_collection(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingNoTrackingProjectionJetTest.SelectMany_trunk_collection(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Check_all_tests_overridden -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_branch_optional_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_branch_optional_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_branch_optional_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_branch_optional_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_branch_required_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_branch_required_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_branch_required_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_branch_required_required(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_leaf_trunk_root(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_leaf_trunk_root(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_root(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_root(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_trunk_and_branch_duplicated(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_trunk_and_branch_duplicated(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_trunk_and_trunk_duplicated(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_trunk_and_trunk_duplicated(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_trunk_optional(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_trunk_optional(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_trunk_required(async: False) -EntityFrameworkCore.Jet.FunctionalTests.Query.Relationships.Projection.OwnedTableSplittingReferenceProjectionNoTrackingJetTest.Select_trunk_required(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.SharedTypeQueryJetTest.Ad_hoc_query_for_default_shared_type_entity_type_throws EntityFrameworkCore.Jet.FunctionalTests.Query.SharedTypeQueryJetTest.Ad_hoc_query_for_shared_type_entity_type_works EntityFrameworkCore.Jet.FunctionalTests.Query.SharedTypeQueryJetTest.Can_use_shared_type_entity_type_in_query_filter_with_from_sql(async: False) diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt index 0187913c..40b84426 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt @@ -17057,7 +17057,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Mapping_throws_for_empty_complex_types EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Mapping_throws_for_non_ignored_navigations_on_complex_types EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Non_nullable_properties_cannot_be_made_optional -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_can_be_made_concurrency_tokens EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_can_have_field_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.PrimitiveCollectionBuilder_methods_can_be_chained EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_ignored From c2d0a013bfcc7e346eac9e5a52617525b8d0dbb4 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 29 Nov 2025 15:42:53 +0800 Subject: [PATCH 23/35] fixes --- .../GreenTests/ace_2010_odbc_x86.txt | 11 ----- .../GreenTests/ace_2010_oledb_x86.txt | 42 +------------------ 2 files changed, 1 insertion(+), 52 deletions(-) diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt index 86ed14b0..febcb0fb 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt @@ -17046,7 +17046,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.IEnumerable_properties_with_value_converter_set_are_not_discovered_as_complex_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Mapping_throws_for_empty_complex_types EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Mapping_throws_for_non_ignored_navigations_on_complex_types -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Non_nullable_properties_cannot_be_made_optional EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_can_have_field_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.PrimitiveCollectionBuilder_methods_can_be_chained EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_ignored @@ -17055,8 +17054,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_custom_type_value_converter_type_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_field_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_non_generic_value_converter_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_provider_type_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_provider_type_set_for_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_value_converter_configured_by_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_value_converter_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_value_converter_set_inline @@ -17744,12 +17741,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.IEnumerable_properties_with_value_converter_set_are_not_discovered_as_complex_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Mapping_throws_for_empty_complex_types EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Mapping_throws_for_non_ignored_navigations_on_complex_types -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Non_nullable_properties_cannot_be_made_optional -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_are_required_by_default_only_if_CLR_type_is_nullable -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_can_be_made_concurrency_tokens -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_can_be_made_optional -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_can_be_made_required -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_can_be_set_to_generate_values_on_Add EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_can_have_field_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.PrimitiveCollectionBuilder_methods_can_be_chained @@ -17758,13 +17749,11 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_ignored_by_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_field_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_value_converter_configured_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.PropertyBuilder_methods_can_be_chained EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Throws_for_bad_value_generator_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Throws_for_incompatible_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Throws_for_primitive_collection_with_bad_value_generator_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Throws_for_value_generator_that_cannot_be_constructed -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Value_converter_configured_on_non_nullable_type_is_applied EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Value_converter_configured_on_nullable_type_overrides_non_nullable EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Value_converter_type_is_checked EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Adding_conflicting_check_constraint_to_derived_type_before_base_throws diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt index 40b84426..89f0a009 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt @@ -17056,25 +17056,14 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.IEnumerable_properties_with_value_converter_set_are_not_discovered_as_complex_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Mapping_throws_for_empty_complex_types EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Mapping_throws_for_non_ignored_navigations_on_complex_types -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Non_nullable_properties_cannot_be_made_optional EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Primitive_collections_can_have_field_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.PrimitiveCollectionBuilder_methods_can_be_chained EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_ignored EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_ignored_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_made_concurrency_tokens -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_made_optional -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_made_required -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_set_to_generate_values_on_Add -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_access_mode_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_custom_type_value_converter_type_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_field_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_non_generic_value_converter_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_provider_type_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_provider_type_set_for_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_value_converter_configured_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_value_converter_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_value_converter_set_inline -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_set_row_version EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.PropertyBuilder_methods_can_be_chained EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Throws_for_bad_value_generator_type @@ -17730,21 +17719,10 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_ignore_a_field EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_ignore_shadow_primitive_collections_when_they_have_been_added_explicitly EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_ignore_shadow_properties_when_they_have_been_added_explicitly -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_complex_property_annotation -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_custom_value_generator_for_primitive_collections -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_custom_value_generator_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_max_length_for_primitive_collections -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_max_length_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_max_length_for_property_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_precision_and_scale_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_precision_and_scale_for_property_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_primitive_collection_annotation_when_no_clr_property +EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+Je tNonGenericComplexType.Can_set_complex_property_annotation EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_property_annotation EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_property_annotation_by_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_property_annotation_when_no_clr_property -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_sentinel_for_primitive_collections -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_sentinel_for_properties -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_sentinel_for_property_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_unbounded_max_length_for_property_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_use_table_splitting EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_use_table_splitting_with_schema @@ -17769,37 +17747,20 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.IEnumerable_properties_with_value_converter_set_are_not_discovered_as_complex_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Mapping_throws_for_empty_complex_types EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Mapping_throws_for_non_ignored_navigations_on_complex_types -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Non_nullable_properties_cannot_be_made_optional -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_are_required_by_default_only_if_CLR_type_is_nullable -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_can_be_made_concurrency_tokens -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_can_be_made_optional -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_can_be_made_required EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_can_be_set_to_generate_values_on_Add EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_can_have_field_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.PrimitiveCollectionBuilder_methods_can_be_chained -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_are_required_by_default_only_if_CLR_type_is_nullable EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_ignored EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_ignored_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_made_concurrency_tokens -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_made_optional -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_made_required -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_set_to_generate_values_on_Add -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_access_mode_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_custom_type_value_converter_type_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_field_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_non_generic_value_converter_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_provider_type_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_provider_type_set_for_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_value_converter_configured_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_value_converter_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_value_converter_set_inline -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.PropertyBuilder_methods_can_be_chained EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Throws_for_bad_value_generator_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Throws_for_primitive_collection_with_bad_value_generator_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Throws_for_value_generator_that_cannot_be_constructed -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Value_converter_configured_on_non_nullable_type_is_applied EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Value_converter_configured_on_nullable_type_overrides_non_nullable EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Value_converter_type_is_checked EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Adding_conflicting_check_constraint_to_derived_type_before_base_throws @@ -18422,7 +18383,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Navigations_on_owned_type_collection_can_set_access_mode EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Owned_type_collections_can_be_mapped_to_a_view EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Owned_type_collections_can_be_mapped_to_different_tables -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Owned_types_can_be_mapped_to_different_tables EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Owned_types_use_table_splitting_by_default EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.OwnedType_can_derive_from_Collection EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Owner_can_be_mapped_to_a_view From 7a9d2207acd14465776849b55dae64f3bff66e38 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 29 Nov 2025 17:00:36 +0800 Subject: [PATCH 24/35] fixes --- .../GreenTests/ace_2010_odbc_x86.txt | 25 +------------------ .../GreenTests/ace_2010_oledb_x86.txt | 22 +--------------- 2 files changed, 2 insertions(+), 45 deletions(-) diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt index febcb0fb..4e1cd114 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt @@ -17050,22 +17050,13 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.PrimitiveCollectionBuilder_methods_can_be_chained EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_ignored EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_ignored_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_access_mode_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_custom_type_value_converter_type_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_field_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_non_generic_value_converter_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_value_converter_configured_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_value_converter_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_value_converter_set_inline -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_set_row_version -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.PropertyBuilder_methods_can_be_chained EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Throws_for_bad_value_generator_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Throws_for_incompatible_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Throws_for_primitive_collection_with_bad_value_generator_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Throws_for_value_generator_that_cannot_be_constructed -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Value_converter_configured_on_non_nullable_type_is_applied -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Value_converter_configured_on_nullable_type_overrides_non_nullable EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Value_converter_type_is_checked EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Adding_conflicting_check_constraint_to_derived_type_before_base_throws EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Adding_conflicting_check_constraint_to_derived_type_throws @@ -17088,8 +17079,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Can_use_shadow_FK_that_collides_with_convention_shadow_FK_on_other_derived_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Can_use_table_splitting EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Cannot_remove_objects_in_derived_type_which_was_set_using_explicit_while_setting_base_type_by_convention -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Index_convention_run_for_fk_when_derived_type_discovered_before_base_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Index_convention_sets_filter_for_unique_index_when_base_type_changed EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Index_removed_when_covered_by_an_inherited_foreign_key EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Index_removed_when_covered_by_an_inherited_index EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Inherited_clr_properties_are_mapped_to_the_same_column @@ -17676,13 +17665,11 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Deriving_from_owned_type_throws EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Entity_mapped_to_json_and_unwound_afterwards_properly_cleans_up_its_state EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_and_normal_owned_can_exist_side_by_side_on_same_entity -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_and_normal_owned_can_exist_side_to_side_on_same_entity EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_mapped_to_view EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_nested_enums_have_conversions_to_int_by_default_ToJson_first EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_nested_enums_have_conversions_to_int_by_default_ToJson_last EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_with_custom_property_names EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_with_nested_structure_same_property_names -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_with_nested_structure_same_property_names_ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_with_tph_inheritance EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Navigations_on_owned_type_can_set_access_mode_using_expressions EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Navigations_on_owned_type_collection_can_set_access_mode @@ -17714,9 +17701,7 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_ignore_shadow_primitive_collections_when_they_have_been_added_explicitly EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_ignore_shadow_properties_when_they_have_been_added_explicitly EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_map_a_tuple -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_complex_property_annotation -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_specify_discriminator_value -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_specify_discriminator_without_explicit_value +EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_complex_property_annotation EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_use_table_splitting EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_use_table_splitting_with_schema EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_use_TPH @@ -17742,9 +17727,7 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Mapping_throws_for_empty_complex_types EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Mapping_throws_for_non_ignored_navigations_on_complex_types EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_can_have_field_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.PrimitiveCollectionBuilder_methods_can_be_chained -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_are_required_by_default_only_if_CLR_type_is_nullable EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_ignored EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_ignored_by_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_field_set @@ -17754,7 +17737,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Throws_for_incompatible_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Throws_for_primitive_collection_with_bad_value_generator_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Throws_for_value_generator_that_cannot_be_constructed -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Value_converter_configured_on_nullable_type_overrides_non_nullable EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Value_converter_type_is_checked EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Adding_conflicting_check_constraint_to_derived_type_before_base_throws EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Adding_conflicting_check_constraint_to_derived_type_throws @@ -17777,8 +17759,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Can_use_shadow_FK_that_collides_with_convention_shadow_FK_on_other_derived_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Can_use_table_splitting EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Cannot_remove_objects_in_derived_type_which_was_set_using_explicit_while_setting_base_type_by_convention -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Index_convention_run_for_fk_when_derived_type_discovered_before_base_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Index_convention_sets_filter_for_unique_index_when_base_type_changed EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Index_removed_when_covered_by_an_inherited_foreign_key EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Index_removed_when_covered_by_an_inherited_index EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Inherited_clr_properties_are_mapped_to_the_same_column @@ -18365,13 +18345,11 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Deriving_from_owned_type_throws EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Entity_mapped_to_json_and_unwound_afterwards_properly_cleans_up_its_state EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_and_normal_owned_can_exist_side_by_side_on_same_entity -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_and_normal_owned_can_exist_side_to_side_on_same_entity EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_mapped_to_view EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_nested_enums_have_conversions_to_int_by_default_ToJson_first EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_nested_enums_have_conversions_to_int_by_default_ToJson_last EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_with_custom_property_names EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_with_nested_structure_same_property_names -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_with_nested_structure_same_property_names_ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_with_tph_inheritance EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Navigations_on_owned_type_can_set_access_mode_using_expressions EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Navigations_on_owned_type_collection_can_set_access_mode @@ -30212,7 +30190,6 @@ EntityFrameworkCore.Jet.FunctionalTests.TptManyToManyTrackingJetTest.Many_to_man EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_change_dependent_instance_non_derived EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_change_principal_and_dependent_instance_non_derived EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_change_principal_instance_non_derived -EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_use_optional_dependents_with_shared_concurrency_tokens_with_complex_types EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.Can_use_with_chained_relationships EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.ExecuteDelete_throws_for_table_sharing(async: False) EntityFrameworkCore.Jet.FunctionalTests.TPTTableSplittingJetTest.ExecuteDelete_throws_for_table_sharing(async: True) diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt index 89f0a009..bf4e9da9 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt @@ -17060,17 +17060,12 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.PrimitiveCollectionBuilder_methods_can_be_chained EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_ignored EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_ignored_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_custom_type_value_converter_type_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_field_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_non_generic_value_converter_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_value_converter_configured_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.PropertyBuilder_methods_can_be_chained EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Throws_for_bad_value_generator_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Throws_for_primitive_collection_with_bad_value_generator_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Throws_for_value_generator_that_cannot_be_constructed -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Value_converter_configured_on_non_nullable_type_is_applied -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Value_converter_configured_on_nullable_type_overrides_non_nullable EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Value_converter_type_is_checked EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Adding_conflicting_check_constraint_to_derived_type_before_base_throws EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Adding_conflicting_check_constraint_to_derived_type_throws @@ -17093,8 +17088,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Can_use_shadow_FK_that_collides_with_convention_shadow_FK_on_other_derived_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Can_use_table_splitting EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Cannot_remove_objects_in_derived_type_which_was_set_using_explicit_while_setting_base_type_by_convention -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Index_convention_run_for_fk_when_derived_type_discovered_before_base_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Index_convention_sets_filter_for_unique_index_when_base_type_changed EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Index_removed_when_covered_by_an_inherited_foreign_key EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Index_removed_when_covered_by_an_inherited_index EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericInheritance.Inherited_clr_properties_are_mapped_to_the_same_column @@ -17680,19 +17673,15 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Deriving_from_owned_type_throws EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Entity_mapped_to_json_and_unwound_afterwards_properly_cleans_up_its_state EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_and_normal_owned_can_exist_side_by_side_on_same_entity -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_and_normal_owned_can_exist_side_to_side_on_same_entity EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_mapped_to_view EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_nested_enums_have_conversions_to_int_by_default_ToJson_first EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_nested_enums_have_conversions_to_int_by_default_ToJson_last EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_with_custom_property_names EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_with_nested_structure_same_property_names -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_with_nested_structure_same_property_names_ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Json_entity_with_tph_inheritance EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Navigations_on_owned_type_can_set_access_mode_using_expressions EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Navigations_on_owned_type_collection_can_set_access_mode EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Owned_type_collections_can_be_mapped_to_a_view -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Owned_type_collections_can_be_mapped_to_different_tables -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Owned_types_can_be_mapped_to_different_tables EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Owned_types_use_table_splitting_by_default EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.OwnedType_can_derive_from_Collection EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Owner_can_be_mapped_to_a_view @@ -17719,11 +17708,10 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_ignore_a_field EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_ignore_shadow_primitive_collections_when_they_have_been_added_explicitly EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_ignore_shadow_properties_when_they_have_been_added_explicitly -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+Je tNonGenericComplexType.Can_set_complex_property_annotation +EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_complex_property_annotation EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_property_annotation EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_property_annotation_by_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_property_annotation_when_no_clr_property -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_unbounded_max_length_for_property_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_use_table_splitting EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_use_table_splitting_with_schema EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_use_TPH @@ -17747,7 +17735,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.IEnumerable_properties_with_value_converter_set_are_not_discovered_as_complex_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Mapping_throws_for_empty_complex_types EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Mapping_throws_for_non_ignored_navigations_on_complex_types -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_can_be_set_to_generate_values_on_Add EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_can_have_field_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.PrimitiveCollectionBuilder_methods_can_be_chained @@ -17755,13 +17742,11 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_ignored_by_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_custom_type_value_converter_type_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_field_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_non_generic_value_converter_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_value_converter_configured_by_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.PropertyBuilder_methods_can_be_chained EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Throws_for_bad_value_generator_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Throws_for_primitive_collection_with_bad_value_generator_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Throws_for_value_generator_that_cannot_be_constructed -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Value_converter_configured_on_nullable_type_overrides_non_nullable EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Value_converter_type_is_checked EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Adding_conflicting_check_constraint_to_derived_type_before_base_throws EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Adding_conflicting_check_constraint_to_derived_type_throws @@ -17784,8 +17769,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Can_use_shadow_FK_that_collides_with_convention_shadow_FK_on_other_derived_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Can_use_table_splitting EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Cannot_remove_objects_in_derived_type_which_was_set_using_explicit_while_setting_base_type_by_convention -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Index_convention_run_for_fk_when_derived_type_discovered_before_base_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Index_convention_sets_filter_for_unique_index_when_base_type_changed EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Index_removed_when_covered_by_an_inherited_foreign_key EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Index_removed_when_covered_by_an_inherited_index EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericInheritance.Inherited_clr_properties_are_mapped_to_the_same_column @@ -18371,18 +18354,15 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Deriving_from_owned_type_throws EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Entity_mapped_to_json_and_unwound_afterwards_properly_cleans_up_its_state EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_and_normal_owned_can_exist_side_by_side_on_same_entity -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_and_normal_owned_can_exist_side_to_side_on_same_entity EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_mapped_to_view EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_nested_enums_have_conversions_to_int_by_default_ToJson_first EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_nested_enums_have_conversions_to_int_by_default_ToJson_last EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_with_custom_property_names EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_with_nested_structure_same_property_names -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_with_nested_structure_same_property_names_ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Json_entity_with_tph_inheritance EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Navigations_on_owned_type_can_set_access_mode_using_expressions EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Navigations_on_owned_type_collection_can_set_access_mode EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Owned_type_collections_can_be_mapped_to_a_view -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Owned_type_collections_can_be_mapped_to_different_tables EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Owned_types_use_table_splitting_by_default EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.OwnedType_can_derive_from_Collection EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Owner_can_be_mapped_to_a_view From 02040031471eade63d0272c3609d501e245c586e Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 29 Nov 2025 17:28:23 +0800 Subject: [PATCH 25/35] Add OdbcGuidTypeMapping because odbc needs gui wrapped in quotes --- .../Internal/JetOdbcGuidTypeMapping.cs | 24 +++++++++++++++++++ .../Storage/Internal/JetTypeMappingSource.cs | 9 +++++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 src/EFCore.Jet/Storage/Internal/JetOdbcGuidTypeMapping.cs diff --git a/src/EFCore.Jet/Storage/Internal/JetOdbcGuidTypeMapping.cs b/src/EFCore.Jet/Storage/Internal/JetOdbcGuidTypeMapping.cs new file mode 100644 index 00000000..e8b7a9aa --- /dev/null +++ b/src/EFCore.Jet/Storage/Internal/JetOdbcGuidTypeMapping.cs @@ -0,0 +1,24 @@ +using System.Data; + +namespace EntityFrameworkCore.Jet.Storage.Internal +{ + public class JetOdbcGuidTypeMapping : JetGuidTypeMapping + { + public JetOdbcGuidTypeMapping(string storeType) : base(storeType, System.Data.DbType.Guid) + { + } + + protected JetOdbcGuidTypeMapping(RelationalTypeMappingParameters parameters) : base(parameters) + { + } + + protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters parameters) + => new JetOdbcGuidTypeMapping(parameters); + + /// + /// Gets the string format to be used to generate SQL literals of this type. + /// + protected override string SqlLiteralFormatString + => "'{{{0}}}'"; + } +} \ No newline at end of file diff --git a/src/EFCore.Jet/Storage/Internal/JetTypeMappingSource.cs b/src/EFCore.Jet/Storage/Internal/JetTypeMappingSource.cs index 461953c4..0750a6bd 100644 --- a/src/EFCore.Jet/Storage/Internal/JetTypeMappingSource.cs +++ b/src/EFCore.Jet/Storage/Internal/JetTypeMappingSource.cs @@ -1,5 +1,6 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using EntityFrameworkCore.Jet.Data; using System.Collections; using System.Data; using System.Text.Json; @@ -49,7 +50,7 @@ public class JetTypeMappingSource : RelationalTypeMappingSource private readonly JetStringTypeMapping _variableLengthUnicodeString = new("varchar", unicode: true); private readonly JetStringTypeMapping _variableLengthMaxUnicodeString = new("varchar", unicode: true, size: 255, storeTypePostfix: StoreTypePostfix.Size); private readonly JetStringTypeMapping _unboundedUnicodeString = new("longchar", unicode: true, storeTypePostfix: StoreTypePostfix.None); - private readonly JetGuidTypeMapping _guid = new("uniqueidentifier", DbType.Guid); + private readonly JetGuidTypeMapping _guid; private readonly JetByteArrayTypeMapping _rowversion = new("varbinary", size: 8, comparer: new ValueComparer( (v1, v2) => StructuralComparisons.StructuralEqualityComparer.Equals(v1, v2), @@ -78,6 +79,10 @@ public JetTypeMappingSource( // https://support.office.com/en-us/article/equivalent-ansi-sql-data-types-7a0a6bef-ef25-45f9-8a9a-3c5f21b5c65d // https://sourcedaddy.com/ms-access/sql-data-types.html + _guid = options.DataAccessProviderType == DataAccessProviderType.Odbc + ? new JetOdbcGuidTypeMapping("uniqueidentifier") + : new JetGuidTypeMapping("uniqueidentifier", DbType.Guid); + // TODO: Check the types and their mappings against // https://docs.microsoft.com/en-us/previous-versions/office/developer/office2000/aa140015(v=office.10) @@ -87,7 +92,7 @@ public JetTypeMappingSource( _dateonly = new JetDateOnlyTypeMapping("date", options, dbType: DbType.Date); _timeonly = new JetTimeOnlyTypeMapping("time", options); _timespan = new JetTimeSpanTypeMapping("datetime", options); - + _storeTypeMappings = new Dictionary(StringComparer.OrdinalIgnoreCase) { From fadc88ba37e964cb1759ed75f1ccea5db6e0ec38 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 29 Nov 2025 18:24:15 +0800 Subject: [PATCH 26/35] fixes --- .../GreenTests/ace_2010_odbc_x86.txt | 7 +- .../GreenTests/ace_2010_oledb_x86.txt | 7 - .../Query/LazyLoadProxyJetTest.cs | 545 ------------------ .../Query/PrimitiveCollectionsQueryJetTest.cs | 18 +- 4 files changed, 13 insertions(+), 564 deletions(-) delete mode 100644 test/EFCore.Jet.FunctionalTests/Query/LazyLoadProxyJetTest.cs diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt index 4e1cd114..5324e591 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt @@ -17020,8 +17020,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_ignore_shadow_properties_when_they_have_been_added_explicitly EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_map_a_tuple EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_set_complex_property_annotation -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_specify_discriminator_value -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_specify_discriminator_without_explicit_value EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_use_table_splitting EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_use_table_splitting_with_schema EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Can_use_TPH @@ -17050,7 +17048,6 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.PrimitiveCollectionBuilder_methods_can_be_chained EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_ignored EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_be_ignored_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_custom_type_value_converter_type_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Properties_can_have_field_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.PropertyBuilder_methods_can_be_chained EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericComplexType.Throws_for_bad_value_generator_type @@ -17701,7 +17698,7 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_ignore_shadow_primitive_collections_when_they_have_been_added_explicitly EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_ignore_shadow_properties_when_they_have_been_added_explicitly EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_map_a_tuple -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_complex_property_annotation +EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_set_complex_property_annotation EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_use_table_splitting EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_use_table_splitting_with_schema EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Can_use_TPH @@ -27677,11 +27674,9 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.N EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Concat_column_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Contains_with_EF_Constant EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count_with_column_predicate_with_EF_Constant -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_HashSet_of_ints_Contains_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_ImmutableArray_of_ints_Contains_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_and_Convert_as_compiled_query -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Count_as_compiled_query EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_nested diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt index bf4e9da9..3e5928a1 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt @@ -2659,7 +2659,6 @@ EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Can_add EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Can_add_valid_second_dependent_when_multiple_possible_principal_sides EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Can_insert_when_bool_PK_in_composite_key_has_sentinel_value(async: False, initialValue: False) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Can_insert_when_bool_PK_in_composite_key_has_sentinel_value(async: True, initialValue: False) -EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Can_insert_when_composite_FK_has_default_value_for_one_part(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Can_insert_when_FK_has_default_value(async: False) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Can_insert_when_FK_has_default_value(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Can_insert_when_FK_has_sentinel_value(async: False) @@ -4437,7 +4436,6 @@ EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Can_ad EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Can_add_valid_second_dependent_when_multiple_possible_principal_sides EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Can_insert_when_bool_PK_in_composite_key_has_sentinel_value(async: False, initialValue: False) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Can_insert_when_bool_PK_in_composite_key_has_sentinel_value(async: True, initialValue: False) -EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Can_insert_when_composite_FK_has_default_value_for_one_part(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Can_insert_when_FK_has_default_value(async: False) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Can_insert_when_FK_has_default_value(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Can_insert_when_FK_has_sentinel_value(async: False) @@ -7980,7 +7978,6 @@ EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Can_insert_when EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Can_insert_when_bool_PK_in_composite_key_has_sentinel_value(async: True, initialValue: False) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Can_insert_when_bool_PK_in_composite_key_has_sentinel_value(async: True, initialValue: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Can_insert_when_composite_FK_has_default_value_for_one_part(async: False) -EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Can_insert_when_composite_FK_has_default_value_for_one_part(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Can_insert_when_FK_has_default_value(async: False) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Can_insert_when_FK_has_default_value(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetOwnedTest.Can_insert_when_FK_has_sentinel_value(async: False) @@ -17736,11 +17733,9 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Mapping_throws_for_empty_complex_types EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Mapping_throws_for_non_ignored_navigations_on_complex_types EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_can_have_field_set -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Primitive_collections_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.PrimitiveCollectionBuilder_methods_can_be_chained EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_ignored EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_be_ignored_by_type -EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_custom_type_value_converter_type_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_field_set EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.Properties_can_have_value_converter_configured_by_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericComplexType.PropertyBuilder_methods_can_be_chained @@ -28331,11 +28326,9 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.N EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Concat_column_collection EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Contains_with_EF_Constant EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count_with_column_predicate_with_EF_Constant -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_Count EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_HashSet_of_ints_Contains_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_ImmutableArray_of_ints_Contains_int EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_and_Convert_as_compiled_query -EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Count_as_compiled_query EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_as_compiled_query EntityFrameworkCore.Jet.FunctionalTests.Query.PrimitiveCollectionsQueryJetTest.Parameter_collection_in_subquery_Union_column_collection_nested diff --git a/test/EFCore.Jet.FunctionalTests/Query/LazyLoadProxyJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/LazyLoadProxyJetTest.cs deleted file mode 100644 index 14645b1f..00000000 --- a/test/EFCore.Jet.FunctionalTests/Query/LazyLoadProxyJetTest.cs +++ /dev/null @@ -1,545 +0,0 @@ -using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; -using Microsoft.EntityFrameworkCore.ChangeTracking; -using Microsoft.EntityFrameworkCore.TestUtilities; -using System; -using System.IO; -using System.Threading.Tasks; -using Xunit; - -namespace Microsoft.EntityFrameworkCore; - -#nullable disable - -public class LazyLoadProxyJetTest : LazyLoadProxyRelationalTestBase -{ - public LazyLoadProxyJetTest(LoadJetFixture fixture) - : base(fixture) - => fixture.TestSqlLoggerFactory.Clear(); - - public override void Lazy_load_collection(EntityState state, bool useAttach, bool useDetach) - { - base.Lazy_load_collection(state, useAttach, useDetach); - - AssertSql( - state == EntityState.Detached && useAttach - ? "" - : """ -@p='707' (Nullable = true) - -SELECT `c`.`Id`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` -FROM `Child` AS `c` -WHERE `c`.`ParentId` = @p -"""); - } - - public override void Lazy_load_many_to_one_reference_to_principal(EntityState state, bool useAttach, bool useDetach) - { - base.Lazy_load_many_to_one_reference_to_principal(state, useAttach, useDetach); - - AssertSql( - state == EntityState.Detached && useAttach - ? "" - : """ -@p='707' - -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` -FROM `Parent` AS `p` -WHERE `p`.`Id` = @p -"""); - } - - public override void Lazy_load_one_to_one_reference_to_principal(EntityState state, bool useAttach, bool useDetach) - { - base.Lazy_load_one_to_one_reference_to_principal(state, useAttach, useDetach); - - AssertSql( - state == EntityState.Detached && useAttach - ? "" - : """ -@p='707' - -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` -FROM `Parent` AS `p` -WHERE `p`.`Id` = @p -"""); - } - - public override void Lazy_load_one_to_one_reference_to_dependent(EntityState state, bool useAttach, bool useDetach) - { - base.Lazy_load_one_to_one_reference_to_dependent(state, useAttach, useDetach); - - AssertSql( - state == EntityState.Detached && useAttach - ? "" - : """ -@p='707' (Nullable = true) - -SELECT TOP 1 `s`.`Id`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` -FROM `Single` AS `s` -WHERE `s`.`ParentId` = @p -"""); - } - - public override void Lazy_load_one_to_one_PK_to_PK_reference_to_principal(EntityState state) - { - base.Lazy_load_one_to_one_PK_to_PK_reference_to_principal(state); - - AssertSql( - """ -@p='707' - -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` -FROM `Parent` AS `p` -WHERE `p`.`Id` = @p -"""); - } - - public override void Lazy_load_one_to_one_PK_to_PK_reference_to_dependent(EntityState state) - { - base.Lazy_load_one_to_one_PK_to_PK_reference_to_dependent(state); - - AssertSql( - """ -@p='707' - -SELECT TOP 1 `s`.`Id`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` -FROM `SinglePkToPk` AS `s` -WHERE `s`.`Id` = @p -"""); - } - - public override void Lazy_load_many_to_one_reference_to_principal_null_FK(EntityState state) - { - base.Lazy_load_many_to_one_reference_to_principal_null_FK(state); - - AssertSql(@""); - } - - public override void Lazy_load_one_to_one_reference_to_principal_null_FK(EntityState state) - { - base.Lazy_load_one_to_one_reference_to_principal_null_FK(state); - - AssertSql(@""); - } - - public override void Lazy_load_collection_not_found(EntityState state) - { - base.Lazy_load_collection_not_found(state); - - AssertSql( - """ -@p='767' (Nullable = true) - -SELECT `c`.`Id`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` -FROM `Child` AS `c` -WHERE `c`.`ParentId` = @p -"""); - } - - public override void Lazy_load_many_to_one_reference_to_principal_not_found(EntityState state) - { - base.Lazy_load_many_to_one_reference_to_principal_not_found(state); - - AssertSql( - """ -@p='787' - -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` -FROM `Parent` AS `p` -WHERE `p`.`Id` = @p -"""); - } - - public override void Lazy_load_one_to_one_reference_to_principal_not_found(EntityState state) - { - base.Lazy_load_one_to_one_reference_to_principal_not_found(state); - - AssertSql( - """ -@p='787' - -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` -FROM `Parent` AS `p` -WHERE `p`.`Id` = @p -"""); - } - - public override void Lazy_load_one_to_one_reference_to_dependent_not_found(EntityState state) - { - base.Lazy_load_one_to_one_reference_to_dependent_not_found(state); - - AssertSql( - """ -@p='767' (Nullable = true) - -SELECT TOP 1 `s`.`Id`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` -FROM `Single` AS `s` -WHERE `s`.`ParentId` = @p -"""); - } - - public override void Lazy_load_collection_already_loaded(EntityState state, CascadeTiming cascadeDeleteTiming) - { - base.Lazy_load_collection_already_loaded(state, cascadeDeleteTiming); - - AssertSql(@""); - } - - public override void Lazy_load_many_to_one_reference_to_principal_already_loaded( - EntityState state, - CascadeTiming cascadeDeleteTiming) - { - base.Lazy_load_many_to_one_reference_to_principal_already_loaded(state, cascadeDeleteTiming); - - AssertSql(@""); - } - - public override void Lazy_load_one_to_one_reference_to_principal_already_loaded(EntityState state) - { - base.Lazy_load_one_to_one_reference_to_principal_already_loaded(state); - - AssertSql(@""); - } - - public override void Lazy_load_one_to_one_reference_to_dependent_already_loaded( - EntityState state, - CascadeTiming cascadeDeleteTiming) - { - base.Lazy_load_one_to_one_reference_to_dependent_already_loaded(state, cascadeDeleteTiming); - - AssertSql(@""); - } - - public override void Lazy_load_one_to_one_PK_to_PK_reference_to_principal_already_loaded(EntityState state) - { - base.Lazy_load_one_to_one_PK_to_PK_reference_to_principal_already_loaded(state); - - AssertSql(@""); - } - - public override void Lazy_load_one_to_one_PK_to_PK_reference_to_dependent_already_loaded(EntityState state) - { - base.Lazy_load_one_to_one_PK_to_PK_reference_to_dependent_already_loaded(state); - - AssertSql(@""); - } - - public override void Lazy_load_many_to_one_reference_to_principal_alternate_key(EntityState state) - { - base.Lazy_load_many_to_one_reference_to_principal_alternate_key(state); - - AssertSql( - """ -@p='Root' (Size = 255) - -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` -FROM `Parent` AS `p` -WHERE `p`.`AlternateId` = @p -"""); - } - - public override void Lazy_load_one_to_one_reference_to_principal_alternate_key(EntityState state) - { - base.Lazy_load_one_to_one_reference_to_principal_alternate_key(state); - - AssertSql( - """ -@p='Root' (Size = 255) - -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` -FROM `Parent` AS `p` -WHERE `p`.`AlternateId` = @p -"""); - } - - public override void Lazy_load_one_to_one_reference_to_dependent_alternate_key(EntityState state) - { - base.Lazy_load_one_to_one_reference_to_dependent_alternate_key(state); - - AssertSql( - """ -@p='Root' (Size = 255) - -SELECT TOP 1 `s`.`Id`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` -FROM `SingleAk` AS `s` -WHERE `s`.`ParentId` = @p -"""); - } - - public override void Lazy_load_many_to_one_reference_to_principal_null_FK_alternate_key(EntityState state) - { - base.Lazy_load_many_to_one_reference_to_principal_null_FK_alternate_key(state); - - AssertSql(@""); - } - - public override void Lazy_load_one_to_one_reference_to_principal_null_FK_alternate_key(EntityState state) - { - base.Lazy_load_one_to_one_reference_to_principal_null_FK_alternate_key(state); - - AssertSql(@""); - } - - public override void Lazy_load_collection_shadow_fk(EntityState state) - { - base.Lazy_load_collection_shadow_fk(state); - - AssertSql( - """ -@p='707' (Nullable = true) - -SELECT `c`.`Id`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` -FROM `ChildShadowFk` AS `c` -WHERE `c`.`ParentId` = @p -"""); - } - - public override void Lazy_load_many_to_one_reference_to_principal_shadow_fk(EntityState state) - { - base.Lazy_load_many_to_one_reference_to_principal_shadow_fk(state); - - AssertSql( - state == EntityState.Detached - ? "" - : """ -@p='707' - -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` -FROM `Parent` AS `p` -WHERE `p`.`Id` = @p -"""); - } - - public override void Lazy_load_one_to_one_reference_to_principal_shadow_fk(EntityState state) - { - base.Lazy_load_one_to_one_reference_to_principal_shadow_fk(state); - - AssertSql( - state == EntityState.Detached - ? "" - : """ -@p='707' - -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` -FROM `Parent` AS `p` -WHERE `p`.`Id` = @p -"""); - } - - public override void Lazy_load_one_to_one_reference_to_dependent_shadow_fk(EntityState state) - { - base.Lazy_load_one_to_one_reference_to_dependent_shadow_fk(state); - - AssertSql( - """ -@p='707' (Nullable = true) - -SELECT TOP 1 `s`.`Id`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` -FROM `SingleShadowFk` AS `s` -WHERE `s`.`ParentId` = @p -"""); - } - - public override void Lazy_load_many_to_one_reference_to_principal_null_FK_shadow_fk(EntityState state) - { - base.Lazy_load_many_to_one_reference_to_principal_null_FK_shadow_fk(state); - - AssertSql(@""); - } - - public override void Lazy_load_one_to_one_reference_to_principal_null_FK_shadow_fk(EntityState state) - { - base.Lazy_load_one_to_one_reference_to_principal_null_FK_shadow_fk(state); - - AssertSql(@""); - } - - public override void Lazy_load_collection_composite_key(EntityState state) - { - base.Lazy_load_collection_composite_key(state); - - AssertSql( - """ -@p='Root' (Size = 255) -@p0='707' (Nullable = true) - -SELECT `c`.`Id`, `c`.`ParentAlternateId`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` -FROM `ChildCompositeKey` AS `c` -WHERE `c`.`ParentAlternateId` = @p AND `c`.`ParentId` = @p0 -"""); - } - - public override void Lazy_load_many_to_one_reference_to_principal_composite_key(EntityState state) - { - base.Lazy_load_many_to_one_reference_to_principal_composite_key(state); - - AssertSql( - """ -@p='Root' (Size = 255) -@p0='707' - -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` -FROM `Parent` AS `p` -WHERE `p`.`AlternateId` = @p AND `p`.`Id` = @p0 -"""); - } - - public override void Lazy_load_one_to_one_reference_to_principal_composite_key(EntityState state) - { - base.Lazy_load_one_to_one_reference_to_principal_composite_key(state); - - AssertSql( - """ -@p='Root' (Size = 255) -@p0='707' - -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` -FROM `Parent` AS `p` -WHERE `p`.`AlternateId` = @p AND `p`.`Id` = @p0 -"""); - } - - public override void Lazy_load_one_to_one_reference_to_dependent_composite_key(EntityState state) - { - base.Lazy_load_one_to_one_reference_to_dependent_composite_key(state); - - AssertSql( - """ -@p='Root' (Size = 255) -@p0='707' (Nullable = true) - -SELECT TOP 1 `s`.`Id`, `s`.`ParentAlternateId`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` -FROM `SingleCompositeKey` AS `s` -WHERE `s`.`ParentAlternateId` = @p AND `s`.`ParentId` = @p0 -"""); - } - - public override void Lazy_load_many_to_one_reference_to_principal_null_FK_composite_key(EntityState state) - { - base.Lazy_load_many_to_one_reference_to_principal_null_FK_composite_key(state); - - AssertSql(@""); - } - - public override void Lazy_load_one_to_one_reference_to_principal_null_FK_composite_key(EntityState state) - { - base.Lazy_load_one_to_one_reference_to_principal_null_FK_composite_key(state); - - AssertSql(@""); - } - - public override async Task Load_collection(EntityState state, bool async) - { - await base.Load_collection(state, async); - - if (!async) - { - AssertSql( - """ -@p='707' (Nullable = true) - -SELECT `c`.`Id`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` -FROM `Child` AS `c` -WHERE `c`.`ParentId` = @p -"""); - } - } - - [ConditionalFact] - public override void Top_level_projection_track_entities_before_passing_to_client_method() - { - base.Top_level_projection_track_entities_before_passing_to_client_method(); - - AssertSql( - """ -SELECT TOP 1 `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text` -FROM `Parent` AS `p` -ORDER BY `p`.`Id` - -@p='707' (Nullable = true) - -SELECT TOP 1 `s`.`Id`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text` -FROM `Single` AS `s` -WHERE `s`.`ParentId` = @p -"""); - } - - public override async Task Entity_equality_with_proxy_parameter(bool async) - { - await base.Entity_equality_with_proxy_parameter(async); - - AssertSql( - """ -@entity_equality_called_Id='707' (Nullable = true) - -SELECT `c`.`Id`, `c`.`ParentId`, `c`.`Culture_Rating`, `c`.`Culture_Species`, `c`.`Culture_Subspecies`, `c`.`Culture_Validation`, `c`.`Culture_License_Charge`, `c`.`Culture_License_Title`, `c`.`Culture_License_Tag_Text`, `c`.`Culture_License_Tog_Text`, `c`.`Culture_Manufacturer_Name`, `c`.`Culture_Manufacturer_Rating`, `c`.`Culture_Manufacturer_Tag_Text`, `c`.`Culture_Manufacturer_Tog_Text`, `c`.`Milk_Rating`, `c`.`Milk_Species`, `c`.`Milk_Subspecies`, `c`.`Milk_Validation`, `c`.`Milk_License_Charge`, `c`.`Milk_License_Title`, `c`.`Milk_License_Tag_Text`, `c`.`Milk_License_Tog_Text`, `c`.`Milk_Manufacturer_Name`, `c`.`Milk_Manufacturer_Rating`, `c`.`Milk_Manufacturer_Tag_Text`, `c`.`Milk_Manufacturer_Tog_Text` -FROM `Child` AS `c` -LEFT JOIN `Parent` AS `p` ON `c`.`ParentId` = `p`.`Id` -WHERE `p`.`Id` = @entity_equality_called_Id -"""); - } - - protected override void ClearLog() - => Fixture.TestSqlLoggerFactory.Clear(); - - protected override void RecordLog() - => Sql = Fixture.TestSqlLoggerFactory.Sql; - - private const string FileNewLine = @" -"; - - private void AssertSql(string expected) - { - expected ??= ""; - var sql = Sql ?? ""; - try - { - Assert.Equal( - expected, sql, ignoreLineEndingDifferences: true); - } - catch - { - var methodCallLine = Environment.StackTrace.Split( - [Environment.NewLine], - StringSplitOptions.RemoveEmptyEntries)[2][6..]; - - var indexMethodEnding = methodCallLine.IndexOf(')') + 1; - var testName = methodCallLine.Substring(0, indexMethodEnding); - var parts = methodCallLine[indexMethodEnding..].Split(" ", StringSplitOptions.RemoveEmptyEntries); - var fileName = parts[1][..^5]; - var lineNumber = int.Parse(parts[2]); - - var currentDirectory = Directory.GetCurrentDirectory(); - var logFile = currentDirectory.Substring( - 0, - currentDirectory.LastIndexOf( - $"{Path.DirectorySeparatorChar}artifacts{Path.DirectorySeparatorChar}", - StringComparison.Ordinal) - + 1) - + "QueryBaseline.txt"; - - var testInfo = testName + " : " + lineNumber + FileNewLine; - var newBaseLine = $@" AssertSql( - {"@\"" + sql.Replace("\"", "\"\"") + "\""}); - -"; - - var contents = testInfo + newBaseLine + FileNewLine + "--------------------" + FileNewLine; - - File.AppendAllText(logFile, contents); - - throw; - } - } - - private string Sql { get; set; } - - public class LoadJetFixture : LoadRelationalFixtureBase - { - public TestSqlLoggerFactory TestSqlLoggerFactory - => (TestSqlLoggerFactory)ListLoggerFactory; - - protected override ITestStoreFactory TestStoreFactory - => JetTestStoreFactory.Instance; - } -} diff --git a/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs index cc99b444..5c7a0f48 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/PrimitiveCollectionsQueryJetTest.cs @@ -1227,16 +1227,22 @@ public override void Parameter_collection_in_subquery_and_Convert_as_compiled_qu // Base implementation asserts that a different exception is thrown } - public override Task Parameter_collection_in_subquery_Count_as_compiled_query() - => AssertTranslationFailed(() => base.Parameter_collection_in_subquery_Count_as_compiled_query()); + public override async Task Parameter_collection_in_subquery_Count_as_compiled_query() + { + await base.Parameter_collection_in_subquery_Count_as_compiled_query(); + + AssertSql(); + } public override Task Column_collection_in_subquery_Union_parameter_collection() => AssertTranslationFailedWithDetails(() => base.Column_collection_in_subquery_Union_parameter_collection(), JetStrings.QueryingIntoJsonCollectionsNotSupported()); - // Base implementation asserts that a different exception is thrown - public override Task Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query() - => Assert.ThrowsAsync( - () => base.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query()); + public override async Task Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query() + { + await base.Parameter_collection_in_subquery_Union_another_parameter_collection_as_compiled_query(); + + AssertSql(); + } public override async Task Project_collection_of_ints_simple() { From 9a09f07932f573ada26f1ac5c3377b196a313eff Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 29 Nov 2025 19:55:22 +0800 Subject: [PATCH 27/35] fix --- .../Query/AdHocMiscellaneousQueryJetTest.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs index 95500352..bb3a5823 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs @@ -195,7 +195,7 @@ public virtual async Task Select_nested_projection() """, // """ -@id='2' +@id='1' SELECT TOP 2 `c`.`Id`, `c`.`Name` FROM `Customers` AS `c` @@ -203,7 +203,7 @@ public virtual async Task Select_nested_projection() """, // """ -@id='3' +@id='2' SELECT TOP 2 `c`.`Id`, `c`.`Name` FROM `Customers` AS `c` @@ -923,7 +923,7 @@ ORDER BY `p`.`Id` """, // """ -@p0='3' +@p0='2' DELETE FROM `Products` WHERE `Id` = @p0; From 00b49cde9dd3eddcdf29270fee037f1e9e1c6dda Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sat, 6 Dec 2025 22:28:30 +0800 Subject: [PATCH 28/35] fixes --- .../GreenTests/ace_2010_odbc_x86.txt | 5 ----- .../GreenTests/ace_2010_oledb_x86.txt | 1 - .../JetValueGenerationScenariosTest.cs | 4 ++-- .../JetValueGenerationScenariosTestBase.cs | 7 ++++--- test/EFCore.Jet.FunctionalTests/config.json | 2 +- 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt index 5324e591..bb5b77eb 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt @@ -2623,7 +2623,6 @@ EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Can_add EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Can_add_valid_second_dependent_when_multiple_possible_principal_sides EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Can_insert_when_bool_PK_in_composite_key_has_sentinel_value(async: False, initialValue: False) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Can_insert_when_bool_PK_in_composite_key_has_sentinel_value(async: True, initialValue: False) -EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Can_insert_when_composite_FK_has_default_value_for_one_part(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Can_insert_when_FK_has_default_value(async: False) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Can_insert_when_FK_has_default_value(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientCascadeTest.Can_insert_when_FK_has_sentinel_value(async: False) @@ -4403,7 +4402,6 @@ EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Can_ad EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Can_add_valid_second_dependent_when_multiple_possible_principal_sides EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Can_insert_when_bool_PK_in_composite_key_has_sentinel_value(async: False, initialValue: False) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Can_insert_when_bool_PK_in_composite_key_has_sentinel_value(async: True, initialValue: False) -EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Can_insert_when_composite_FK_has_default_value_for_one_part(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Can_insert_when_FK_has_default_value(async: False) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Can_insert_when_FK_has_default_value(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetClientNoActionTest.Can_insert_when_FK_has_sentinel_value(async: False) @@ -6180,7 +6178,6 @@ EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Can_add_vali EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Can_add_valid_second_dependent_when_multiple_possible_principal_sides EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Can_insert_when_bool_PK_in_composite_key_has_sentinel_value(async: False, initialValue: False) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Can_insert_when_bool_PK_in_composite_key_has_sentinel_value(async: True, initialValue: False) -EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Can_insert_when_composite_FK_has_default_value_for_one_part(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Can_insert_when_FK_has_default_value(async: False) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Can_insert_when_FK_has_default_value(async: True) EntityFrameworkCore.Jet.FunctionalTests.GraphUpdatesJetIdentityTest.Can_insert_when_FK_has_sentinel_value(async: False) @@ -20750,7 +20747,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Enu EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Explicitly_compiled_query_does_not_add_cache_entry EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Filter_on_nested_DTO_with_interface_gets_simplified_correctly(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Filter_on_nested_DTO_with_interface_gets_simplified_correctly(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.First_FirstOrDefault_ix_async EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Flattened_GroupJoin_on_interface_generic(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Flattened_GroupJoin_on_interface_generic(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.GroupBy_aggregate_on_right_side_of_join(async: False) @@ -20851,7 +20847,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocQuerySplittingQueryJetTest.No EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocQuerySplittingQueryJetTest.SplitQuery_disposes_inner_data_readers EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocQuerySplittingQueryJetTest.Unconfigured_query_splitting_behavior_throws_a_warning EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocQuerySplittingQueryJetTest.Using_AsSingleQuery_without_context_configuration_does_not_throw_warning -EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocQuerySplittingQueryJetTest.Using_AsSplitQuery_without_multiple_active_result_sets_works EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexNavigationsCollectionsQueryJetTest.Check_all_tests_overridden EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexNavigationsCollectionsQueryJetTest.Collection_projection_over_GroupBy_over_parameter(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.ComplexNavigationsCollectionsQueryJetTest.Collection_projection_over_GroupBy_over_parameter(async: True) diff --git a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt index 3e5928a1..c8cf4865 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt @@ -20470,7 +20470,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Enu EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Explicitly_compiled_query_does_not_add_cache_entry EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Filter_on_nested_DTO_with_interface_gets_simplified_correctly(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Filter_on_nested_DTO_with_interface_gets_simplified_correctly(async: True) -EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.First_FirstOrDefault_ix_async EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Flattened_GroupJoin_on_interface_generic(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Flattened_GroupJoin_on_interface_generic(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.GroupBy_aggregate_on_right_side_of_join(async: False) diff --git a/test/EFCore.Jet.FunctionalTests/JetValueGenerationScenariosTest.cs b/test/EFCore.Jet.FunctionalTests/JetValueGenerationScenariosTest.cs index ab9f8718..1ca67d0c 100644 --- a/test/EFCore.Jet.FunctionalTests/JetValueGenerationScenariosTest.cs +++ b/test/EFCore.Jet.FunctionalTests/JetValueGenerationScenariosTest.cs @@ -23,8 +23,8 @@ protected override uint UIntSentinel protected override IntKey IntKeySentinel => IntKey.Zero; - protected override ULongKey ULongKeySentinel - => ULongKey.Zero; + /*protected override ULongKey ULongKeySentinel + => ULongKey.Zero;*/ protected override int? NullableIntSentinel => null; diff --git a/test/EFCore.Jet.FunctionalTests/JetValueGenerationScenariosTestBase.cs b/test/EFCore.Jet.FunctionalTests/JetValueGenerationScenariosTestBase.cs index 6ce57f42..2793830a 100644 --- a/test/EFCore.Jet.FunctionalTests/JetValueGenerationScenariosTestBase.cs +++ b/test/EFCore.Jet.FunctionalTests/JetValueGenerationScenariosTestBase.cs @@ -31,7 +31,7 @@ public abstract class JetValueGenerationScenariosTestBase protected abstract int IntSentinel { get; } protected abstract uint UIntSentinel { get; } protected abstract IntKey IntKeySentinel { get; } - protected abstract ULongKey ULongKeySentinel { get; } + //protected abstract ULongKey ULongKeySentinel { get; } protected abstract int? NullableIntSentinel { get; } protected abstract string StringSentinel { get; } protected abstract DateTime DateTimeSentinel { get; } @@ -334,7 +334,8 @@ public enum IntKey SixSixSeven, } - [ConditionalFact] + //Does not support ulong as identity + /*[ConditionalFact] public async Task Insert_ulong_enum_to_Identity_column() { await using var testStore = await JetTestStore.CreateInitializedAsync(DatabaseName); @@ -387,7 +388,7 @@ public enum ULongKey : ulong { Zero, Sentinel - } + }*/ [ConditionalFact] public async Task Insert_string_to_Identity_column_using_value_converter() diff --git a/test/EFCore.Jet.FunctionalTests/config.json b/test/EFCore.Jet.FunctionalTests/config.json index d97040ea..666f9c20 100644 --- a/test/EFCore.Jet.FunctionalTests/config.json +++ b/test/EFCore.Jet.FunctionalTests/config.json @@ -1,7 +1,7 @@ { "Test": { "Jet": { - "DefaultConnection": "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Jet.accdb;Persist Security Info=False;" + "DefaultConnection": "DBQ=Jet.accdb" } } } From 9dc126ccbdaf6ea1755beb668300fdaaaf932943 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sun, 7 Dec 2025 00:11:10 +0800 Subject: [PATCH 29/35] fix --- Version.props | 4 ++-- test/EFCore.Jet.FunctionalTests/config.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Version.props b/Version.props index b70df8e9..4e3ad44a 100644 --- a/Version.props +++ b/Version.props @@ -16,8 +16,8 @@ correctly. --> 10.0.0 - rc - 2 + beta + 1