From 4bdfe95f6aae97ba76c22df848eb4a3ca2339578 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sun, 1 Dec 2024 03:48:15 +0800 Subject: [PATCH 1/5] update to match efc 9 ga --- Dependencies.targets | 10 +- EFCore.Jet.sln | 5 - global.json | 2 +- .../Sql/Internal/JetQuerySqlGenerator.cs | 26 +++ .../JetValueGenerationScenariosTestBase.cs | 2 +- .../MigrationsInfrastructureJetTest.cs | 195 +----------------- .../Migrations/MigrationsJetTest.cs | 73 +------ .../Query/AdHocMiscellaneousQueryJetTest.cs | 126 +---------- .../Query/AdHocPrecompiledQueryJetTest.cs | 29 +++ .../Query/ComplexNavigationsQueryJetTest.cs | 4 +- .../Query/GearsOfWarQueryJetTest.cs | 24 +-- .../Query/ManyToManyNoTrackingQueryJetTest.cs | 4 +- .../Query/ManyToManyQueryJetTest.cs | 4 +- ...teOperatorsQueryJetTest.ResultOperators.cs | 57 +++-- .../NorthwindEFPropertyIncludeQueryJetTest.cs | 28 +-- ...orthwindFunctionsQueryJetTest.Functions.cs | 38 ++-- .../Query/NorthwindGroupByQueryJetTest.cs | 10 +- .../NorthwindIncludeNoTrackingQueryJetTest.cs | 16 +- .../Query/NorthwindIncludeQueryJetTest.cs | 106 +++++----- .../NorthwindMiscellaneousQueryJetTest.cs | 27 ++- .../NorthwindQueryFiltersQueryJetTest.cs | 12 +- .../Query/NorthwindSelectQueryJetTest.cs | 8 +- ...hwindSplitIncludeNoTrackingQueryJetTest.cs | 16 +- .../NorthwindSplitIncludeQueryJetTest.cs | 16 +- .../NorthwindStringIncludeQueryJetTest.cs | 28 +-- .../Query/NorthwindWhereQueryJetTest.cs | 100 ++++----- .../Query/NullSemanticsQueryJetTest.cs | 26 +-- .../Query/OperatorsQueryJetTest.cs | 2 +- .../Query/TPCManyToManyQueryJetTest.cs | 6 +- .../Query/TPHInheritanceQueryJetTest.cs | 4 +- .../TPTFiltersInheritanceQueryJetTest.cs | 4 +- .../Query/TPTGearsOfWarQueryJetTest.cs | 16 +- .../TPTManyToManyNoTrackingQueryJetTest.cs | 6 +- .../Query/TPTManyToManyQueryJetTest.cs | 6 +- .../Update/NonSharedModelUpdatesJetTest.cs | 46 ++--- .../Update/StoredProcedureUpdateJetTest.cs | 2 +- 36 files changed, 404 insertions(+), 680 deletions(-) diff --git a/Dependencies.targets b/Dependencies.targets index d8e389e9..0e751f3c 100644 --- a/Dependencies.targets +++ b/Dependencies.targets @@ -1,8 +1,8 @@ - [9.0.0-rc.2.24473.5,9.0.999] - [9.0.0-rc.2.24474.1,9.0.999] - [9.0.0-rc.2.24473.5,9.0.999] + [9.0.0,9.0.999] + [9.0.0,9.0.999] + [9.0.0,9.0.999] @@ -29,8 +29,8 @@ - - + + diff --git a/EFCore.Jet.sln b/EFCore.Jet.sln index 35c4eb56..6a9117a6 100644 --- a/EFCore.Jet.sln +++ b/EFCore.Jet.sln @@ -56,11 +56,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Jet.Odbc", "src\EFCo EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Jet.OleDb", "src\EFCore.Jet.OleDb\EFCore.Jet.OleDb.csproj", "{FFC89A2D-F68F-47E3-BA00-47E9C0BEDB71}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{05A38BCD-0042-446F-8E89-84090230BE76}" - ProjectSection(SolutionItems) = preProject - .editorconfig = .editorconfig - EndProjectSection -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/global.json b/global.json index 4d888615..b3db90e6 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "9.0.100-rc.2.24474.11", + "version": "9.0.100", "allowPrerelease": true, "rollForward": "latestFeature" } diff --git a/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs b/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs index 900d49ae..56ca6eab 100644 --- a/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs +++ b/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs @@ -348,6 +348,22 @@ private List ExtractColumnExpressions(SqlUnaryExpression unary return result; } + protected override Expression VisitInnerJoin(InnerJoinExpression innerJoinExpression) + { + parent.Push(innerJoinExpression); + var result = base.VisitInnerJoin(innerJoinExpression); + parent.Pop(); + return result; + } + + protected override Expression VisitLeftJoin(LeftJoinExpression leftJoinExpression) + { + parent.Push(leftJoinExpression); + var result = base.VisitLeftJoin(leftJoinExpression); + parent.Pop(); + return result; + } + protected override Expression VisitProjection(ProjectionExpression projectionExpression) { if (projectionExpression.Expression is SqlConstantExpression { Value: null } constantExpression && (constantExpression.Type == typeof(int) || constantExpression.Type == typeof(double) || constantExpression.Type == typeof(float) || constantExpression.Type == typeof(decimal) || constantExpression.Type == typeof(short))) @@ -1037,5 +1053,15 @@ protected override void CheckComposableSqlTrimmed(ReadOnlySpan sql) throw new InvalidOperationException(RelationalStrings.FromSqlNonComposable); } } + + protected override bool RequiresParentheses(SqlExpression outerExpression, SqlExpression innerExpression) + { + var withinjoin = parent.Any(x => x is JoinExpressionBase); + if (outerExpression is SqlBinaryExpression { OperatorType: ExpressionType.OrElse, Right: SqlBinaryExpression } && withinjoin) + { + return true; + } + return base.RequiresParentheses(outerExpression, innerExpression); + } } } \ No newline at end of file diff --git a/test/EFCore.Jet.FunctionalTests/JetValueGenerationScenariosTestBase.cs b/test/EFCore.Jet.FunctionalTests/JetValueGenerationScenariosTestBase.cs index 0254ff83..ff07708e 100644 --- a/test/EFCore.Jet.FunctionalTests/JetValueGenerationScenariosTestBase.cs +++ b/test/EFCore.Jet.FunctionalTests/JetValueGenerationScenariosTestBase.cs @@ -1123,7 +1123,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) } } - [ConditionalFact] + [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); diff --git a/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsInfrastructureJetTest.cs b/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsInfrastructureJetTest.cs index 2f53ab15..cef89ba7 100644 --- a/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsInfrastructureJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsInfrastructureJetTest.cs @@ -66,195 +66,6 @@ IF NOT EXISTS (SELECT * FROM `INFORMATION_SCHEMA.TABLES` WHERE `TABLE_NAME` = '_ ignoreLineEndingDifferences: true); } - public override void Can_generate_up_scripts() - { - base.Can_generate_up_scripts(); - - Assert.Equal( - """ - 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`) - ); - ; - - BEGIN TRANSACTION; - - 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 ('00000000000001_Migration1', '7.0.0-test'); - - ALTER TABLE `Table1` RENAME COLUMN `Foo` TO `Bar`; - - INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) - VALUES ('00000000000002_Migration2', '7.0.0-test'); - - INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) - VALUES ('00000000000003_Migration3', '7.0.0-test'); - - INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) - VALUES ('00000000000004_Migration4', '7.0.0-test'); - - INSERT INTO Table1 (Id, Bar, Description) VALUES (-1, 3, 'Value With - - Empty Lines') - - INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) - VALUES ('00000000000005_Migration5', '7.0.0-test'); - - INSERT INTO Table1 (Id, Bar, Description) VALUES (-2, 4, 'GO - Value With - - Empty Lines') - - INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) - VALUES ('00000000000006_Migration6', '7.0.0-test'); - - INSERT INTO Table1 (Id, Bar, Description) VALUES (-3, 5, 'GO - Value With - - GO - - Empty Lines - GO') - - INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) - VALUES ('00000000000007_Migration7', '7.0.0-test'); - - COMMIT TRANSACTION; - - - """, - Sql, - ignoreLineEndingDifferences: true); - } - - public override void Can_generate_one_up_script() - { - base.Can_generate_one_up_script(); - - Assert.Equal( - """ - BEGIN TRANSACTION; - - ALTER TABLE `Table1` RENAME COLUMN `Foo` TO `Bar`; - - INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) - VALUES ('00000000000002_Migration2', '7.0.0-test'); - - COMMIT TRANSACTION; - - - """, - Sql, - ignoreLineEndingDifferences: true); - } - - public override void Can_generate_up_script_using_names() - { - base.Can_generate_up_script_using_names(); - - Assert.Equal( - """ - BEGIN TRANSACTION; - - ALTER TABLE `Table1` RENAME COLUMN `Foo` TO `Bar`; - - INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) - VALUES ('00000000000002_Migration2', '7.0.0-test'); - - COMMIT TRANSACTION; - - - """, - Sql, - ignoreLineEndingDifferences: true); - } - - public override void Can_generate_idempotent_up_scripts() - => Assert.Throws(() => base.Can_generate_idempotent_up_scripts()); - - public override void Can_generate_idempotent_up_scripts_noTransactions() - => Assert.Throws(() => base.Can_generate_idempotent_up_scripts_noTransactions()); - - public override void Can_generate_down_scripts() - { - base.Can_generate_down_scripts(); - - Assert.Equal( - """ - BEGIN TRANSACTION; - - ALTER TABLE `Table1` RENAME COLUMN `Bar` TO `Foo`; - - DELETE FROM `__EFMigrationsHistory` - WHERE `MigrationId` = '00000000000002_Migration2'; - - DROP TABLE `Table1`; - - DELETE FROM `__EFMigrationsHistory` - WHERE `MigrationId` = '00000000000001_Migration1'; - - COMMIT TRANSACTION; - - - """, - Sql, - ignoreLineEndingDifferences: true); - } - - public override void Can_generate_idempotent_down_scripts() - => Assert.Throws(() => base.Can_generate_idempotent_down_scripts()); - - public override void Can_generate_one_down_script() - { - base.Can_generate_one_down_script(); - - Assert.Equal( - """ - BEGIN TRANSACTION; - - ALTER TABLE `Table1` RENAME COLUMN `Bar` TO `Foo`; - - DELETE FROM `__EFMigrationsHistory` - WHERE `MigrationId` = '00000000000002_Migration2'; - - COMMIT TRANSACTION; - - - """, - Sql, - ignoreLineEndingDifferences: true); - } - - public override void Can_generate_down_script_using_names() - { - base.Can_generate_down_script_using_names(); - - Assert.Equal( - """ - BEGIN TRANSACTION; - - ALTER TABLE `Table1` RENAME COLUMN `Bar` TO `Foo`; - - DELETE FROM `__EFMigrationsHistory` - WHERE `MigrationId` = '00000000000002_Migration2'; - - COMMIT TRANSACTION; - - - """, - Sql, - ignoreLineEndingDifferences: true); - } - public override void Can_get_active_provider() { base.Can_get_active_provider(); @@ -922,6 +733,12 @@ public override void Can_diff_against_3_0_ASP_NET_Identity_model() DiffSnapshot(new AspNetIdentity30ModelSnapshot(), context); } + protected override Task ExecuteSqlAsync(string value) + { + ((JetTestStore)Fixture.TestStore).ExecuteScript(value); + return Task.CompletedTask; + } + public class AspNetIdentity30ModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) diff --git a/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsJetTest.cs b/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsJetTest.cs index ce4ed737..3c5d689f 100644 --- a/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsJetTest.cs @@ -301,11 +301,7 @@ public override async Task Move_table() AssertSql( """ -IF SCHEMA_ID(N'TestTableSchema') IS NULL EXEC(N'CREATE SCHEMA [TestTableSchema];'); -""", - // - """ -ALTER SCHEMA [TestTableSchema] TRANSFER [TestTable]; +ALTER TABLE `TestTable` RENAME TO `TestTable`; """); } @@ -491,7 +487,7 @@ await Test( { var table = Assert.Single(model.Tables); var column = Assert.Single(table.Columns, c => c.Name == "RowVersion"); - Assert.Equal("rowversion", column.StoreType); + Assert.Equal("varbinary(8)", column.StoreType); Assert.True(column.IsRowVersion()); }); @@ -1219,42 +1215,6 @@ public virtual async Task Alter_column_remove_identity() Assert.Equal(JetStrings.AlterIdentityColumn, ex.Message); } - [ConditionalFact] - public virtual async Task Alter_column_change_type_with_identity() - { - await Test( - builder => builder.Entity( - "People", e => - { - e.Property("Id"); - e.Property("IdentityColumn").UseJetIdentityColumn(); - }), - builder => builder.Entity( - "People", e => - { - e.Property("Id"); - e.Property("IdentityColumn").UseJetIdentityColumn(); - }), - model => - { - var table = Assert.Single(model.Tables); - var column = Assert.Single(table.Columns, c => c.Name == "IdentityColumn"); - Assert.Equal("decimal(20,0)", column.StoreType); - Assert.Equal(ValueGenerated.OnAdd, column.ValueGenerated); - }); - - 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'IdentityColumn'); -IF @var0 IS NOT NULL EXEC(N'ALTER TABLE [People] DROP CONSTRAINT [' + @var0 + '];'); -ALTER TABLE [People] ALTER COLUMN [IdentityColumn] bigint NOT NULL; -"""); - } - [ConditionalFact] public virtual async Task Alter_column_change_identity_seed() { @@ -1269,9 +1229,7 @@ await Test( }); AssertSql( - """ -DBCC CHECKIDENT(N'[People]', RESEED, 100); -"""); +); } [ConditionalFact] @@ -1295,31 +1253,6 @@ await Test( """); } - [ConditionalFact] - public virtual async Task Alter_column_change_comment_with_default() - { - await Test( - builder => builder.Entity("People").Property("Name").HasDefaultValue("Doe"), - builder => { }, - builder => builder.Entity("People").Property("Name") - .HasComment("Some comment"), - model => - { - var nameColumn = Assert.Single(Assert.Single(model.Tables).Columns); - Assert.Equal("'Doe'", nameColumn.DefaultValueSql); - Assert.Equal("Some comment", nameColumn.Comment); - }); - - AssertSql( - """ -DECLARE @defaultSchema AS sysname; -SET @defaultSchema = SCHEMA_NAME(); -DECLARE @description AS sql_variant; -SET @description = N'Some comment'; -EXEC sp_addextendedproperty 'MS_Description', @description, 'SCHEMA', @defaultSchema, 'TABLE', N'People', 'COLUMN', N'Name'; -"""); - } - public override async Task Drop_column() { await base.Drop_column(); diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs index 3edb6785..343733ff 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocMiscellaneousQueryJetTest.cs @@ -293,10 +293,10 @@ public virtual async Task Projecting_entity_with_value_converter_and_include_wor AssertSql( """ -SELECT TOP(1) [p].[Id], [p].[ChildId], [c].[Id], [c].[ParentId], [c].[ULongRowVersion] -FROM [Parents] AS [p] -LEFT JOIN [Children] AS [c] ON [p].[ChildId] = [c].[Id] -ORDER BY [p].[Id] +SELECT TOP 1 `p`.`Id`, `p`.`ChildId`, `c`.`Id`, `c`.`ParentId`, `c`.`ULongRowVersion` +FROM `Parents` AS `p` +LEFT JOIN `Children` AS `c` ON `p`.`ChildId` = `c`.`Id` +ORDER BY `p`.`Id` """); } @@ -309,10 +309,10 @@ public virtual async Task Projecting_column_with_value_converter_of_ulong_byte_a AssertSql( """ -SELECT TOP(1) [c].[ULongRowVersion] -FROM [Parents] AS [p] -LEFT JOIN [Children] AS [c] ON [p].[ChildId] = [c].[Id] -ORDER BY [p].[Id] +SELECT TOP 1 `c`.`ULongRowVersion` +FROM `Parents` AS `p` +LEFT JOIN `Children` AS `c` ON `p`.`ChildId` = `c`.`Id` +ORDER BY `p`.`Id` """); } @@ -331,7 +331,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasConversion(new NumberToBytesConverter()) .IsRowVersion() .IsRequired() - .HasColumnType("RowVersion"); + .HasColumnType("varbinary(8)"); modelBuilder.Entity(); } @@ -867,114 +867,6 @@ public class List #endregion - #region 24216 - - [ConditionalFact] - public virtual async Task Subquery_take_SelectMany_with_TVF() - { - var contextFactory = await InitializeAsync(); - using var context = contextFactory.CreateContext(); - - context.Database.ExecuteSqlRaw( - """ -create function [dbo].[GetPersonStatusAsOf] (@personId bigint, @timestamp datetime2) -returns @personStatus table -( - Id bigint not null, - PersonId bigint not null, - GenderId bigint not null, - StatusMessage nvarchar(max) -) -as -begin - insert into @personStatus - select [m].[Id], [m].[PersonId], [m].[PersonId], null - from [Message] as [m] - where [m].[PersonId] = @personId and [m].[TimeStamp] = @timestamp - return -end -"""); - - ClearLog(); - - var q = from m in context.Message - orderby m.Id - select m; - - var q2 = - from m in q.Take(10) - from asof in context.GetPersonStatusAsOf(m.PersonId, m.Timestamp) - select new { Gender = (from g in context.Gender where g.Id == asof.GenderId select g.Description).Single() }; - - q2.ToList(); - - AssertSql( - """ -@__p_0='10' - -SELECT ( - SELECT TOP(1) [g0].[Description] - FROM [Gender] AS [g0] - WHERE [g0].[Id] = [g].[GenderId]) AS [Gender] -FROM ( - SELECT TOP(@__p_0) [m].[Id], [m].[PersonId], [m].[Timestamp] - FROM [Message] AS [m] - ORDER BY [m].[Id] -) AS [m0] -CROSS APPLY [dbo].[GetPersonStatusAsOf]([m0].[PersonId], [m0].[Timestamp]) AS [g] -ORDER BY [m0].[Id] -"""); - } - - private class Gender24216 - { - public long Id { get; set; } - - public string Description { get; set; } - } - - private class Message24216 - { - public long Id { get; set; } - - public long PersonId { get; set; } - - public DateTime Timestamp { get; set; } - } - - private class PersonStatus24216 - { - public long Id { get; set; } - - public long PersonId { get; set; } - - public long GenderId { get; set; } - - public string StatusMessage { get; set; } - } - - private class Context24216(DbContextOptions options) : DbContext(options) - { - public DbSet Gender { get; set; } - - public DbSet Message { get; set; } - - public IQueryable GetPersonStatusAsOf(long personId, DateTime asOf) - => FromExpression(() => GetPersonStatusAsOf(personId, asOf)); - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - base.OnModelCreating(modelBuilder); - - modelBuilder.HasDbFunction( - typeof(Context24216).GetMethod( - nameof(GetPersonStatusAsOf), - [typeof(long), typeof(DateTime)])); - } - } - - #endregion - #region 27427 /*[ConditionalTheory] diff --git a/test/EFCore.Jet.FunctionalTests/Query/AdHocPrecompiledQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/AdHocPrecompiledQueryJetTest.cs index efe66afd..3a700515 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/AdHocPrecompiledQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/AdHocPrecompiledQueryJetTest.cs @@ -79,6 +79,35 @@ public override async Task Materialize_non_public() """"); } + public override async Task Projecting_property_requiring_converter_with_closure_is_not_supported() + { + await base.Projecting_property_requiring_converter_with_closure_is_not_supported(); + + AssertSql(); + } + + public override async Task Projecting_expression_requiring_converter_without_closure_works() + { + await base.Projecting_expression_requiring_converter_without_closure_works(); + + AssertSql( + """ +SELECT `b`.`AudiobookDate` +FROM `Books` AS `b` +"""); + } + + public override async Task Projecting_entity_with_property_requiring_converter_with_closure_works() + { + await base.Projecting_entity_with_property_requiring_converter_with_closure_works(); + + AssertSql( + """ +SELECT `b`.`Id`, `b`.`AudiobookDate`, `b`.`Name`, `b`.`PublishDate` +FROM `Books` AS `b` +"""); + } + [ConditionalFact] public virtual void Check_all_tests_overridden() => TestHelpers.AssertAllMethodsOverridden(GetType()); diff --git a/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsQueryJetTest.cs index f494806a..14aab6be 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ComplexNavigationsQueryJetTest.cs @@ -2645,7 +2645,7 @@ public override async Task Join_condition_optimizations_applied_correctly_when_a """ SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id` FROM `LevelOne` AS `l` -INNER JOIN `LevelTwo` AS `l0` ON `l`.`OneToMany_Optional_Self_Inverse1Id` = `l0`.`Level1_Optional_Id` OR ((`l`.`OneToMany_Optional_Self_Inverse1Id` IS NULL) AND (`l0`.`Level1_Optional_Id` IS NULL)) +INNER JOIN `LevelTwo` AS `l0` ON (`l`.`OneToMany_Optional_Self_Inverse1Id` = `l0`.`Level1_Optional_Id`) OR (`l`.`OneToMany_Optional_Self_Inverse1Id` IS NULL AND `l0`.`Level1_Optional_Id` IS NULL) """); } @@ -2654,7 +2654,7 @@ public override async Task Join_condition_optimizations_applied_correctly_when_a await base.Join_condition_optimizations_applied_correctly_when_anonymous_type_with_multiple_properties(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` INNER JOIN `LevelTwo` AS `l0` ON (`l`.`OneToMany_Optional_Self_Inverse1Id` = `l0`.`Level1_Optional_Id` OR (`l`.`OneToMany_Optional_Self_Inverse1Id` IS NULL AND `l0`.`Level1_Optional_Id` IS NULL)) AND (`l`.`OneToOne_Optional_Self1Id` = `l0`.`OneToMany_Optional_Self_Inverse2Id` OR (`l`.`OneToOne_Optional_Self1Id` IS NULL AND `l0`.`OneToMany_Optional_Self_Inverse2Id` IS NULL)) diff --git a/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs index f6be9cdb..0466fa7e 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/GearsOfWarQueryJetTest.cs @@ -491,11 +491,11 @@ public override async Task Where_bitwise_and_nullable_enum_with_null_constant(bo await base.Where_bitwise_and_nullable_enum_with_null_constant(isAsync); AssertSql( - $""" - SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` - FROM `Weapons` AS `w` - WHERE (`w`.`AmmunitionType` BAND NULL) > 0 - """); + """ +SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` +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) @@ -537,7 +537,7 @@ public override async Task Where_bitwise_or_enum(bool isAsync) await base.Where_bitwise_or_enum(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 @@ -1506,7 +1506,7 @@ public override async Task Where_subquery_distinct_singleordefault_boolean2(bool await base.Where_subquery_distinct_singleordefault_boolean2(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`.`HasSoulPatch` = TRUE AND IIF(( @@ -2337,7 +2337,7 @@ public override async Task Optional_navigation_type_compensation_works_with_bina await base.Optional_navigation_type_compensation_works_with_binary_and_expression(isAsync); AssertSql( -""" + """ SELECT IIF(`g`.`HasSoulPatch` = TRUE AND (`t`.`Note` LIKE '%Cole%') AND `t`.`Note` IS NOT NULL, TRUE, FALSE) FROM `Tags` AS `t` LEFT JOIN `Gears` AS `g` ON `t`.`GearNickName` = `g`.`Nickname` AND `t`.`GearSquadId` = `g`.`SquadId` @@ -5973,7 +5973,7 @@ public override async Task Double_order_by_on_Like(bool isAsync) await base.Double_order_by_on_Like(isAsync); 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` @@ -6078,7 +6078,7 @@ public override async Task String_concat_on_various_types(bool isAsync) await base.String_concat_on_various_types(isAsync); AssertSql( -""" + """ SELECT ('HasSoulPatch ' & (`g`.`HasSoulPatch` & '')) & ' HasSoulPatch' AS `HasSoulPatch`, ('Rank ' & (`g`.`Rank` & '')) & ' Rank' AS `Rank`, ('SquadId ' & (`g`.`SquadId` & '')) & ' SquadId' AS `SquadId`, ('Rating ' & IIF((`m`.`Rating` & '') IS NULL, '', (`m`.`Rating` & ''))) & ' Rating' AS `Rating`, ('Timeline ' & (`m`.`Timeline` & '')) & ' Timeline' AS `Timeline` FROM `Gears` AS `g`, `Missions` AS `m` @@ -8525,7 +8525,7 @@ public override async Task Projecting_property_converted_to_nullable_with_additi await base.Projecting_property_converted_to_nullable_with_addition(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` @@ -9356,7 +9356,7 @@ public override async Task String_concat_nullable_expressions_are_coalesced(bool await base.String_concat_nullable_expressions_are_coalesced(async); AssertSql( -""" + """ SELECT ((`g`.`FullName` & '') & IIF(`g`.`LeaderNickname` IS NULL, '', `g`.`LeaderNickname`)) & '' FROM `Gears` AS `g` """); diff --git a/test/EFCore.Jet.FunctionalTests/Query/ManyToManyNoTrackingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ManyToManyNoTrackingQueryJetTest.cs index 45bac3ba..957c01ad 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ManyToManyNoTrackingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ManyToManyNoTrackingQueryJetTest.cs @@ -38,7 +38,7 @@ public override async Task Skip_navigation_any_without_predicate(bool async) await base.Skip_navigation_any_without_predicate(async); AssertSql( -""" + """ SELECT `e`.`Id`, `e`.`Name` FROM `EntityOnes` AS `e` WHERE EXISTS ( @@ -54,7 +54,7 @@ public override async Task Skip_navigation_any_with_predicate(bool async) await base.Skip_navigation_any_with_predicate(async); AssertSql( -""" + """ SELECT `e`.`Id`, `e`.`Name` FROM `EntityOnes` AS `e` WHERE EXISTS ( diff --git a/test/EFCore.Jet.FunctionalTests/Query/ManyToManyQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ManyToManyQueryJetTest.cs index 03819cb7..333d4dae 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ManyToManyQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ManyToManyQueryJetTest.cs @@ -38,7 +38,7 @@ public override async Task Skip_navigation_any_without_predicate(bool async) await base.Skip_navigation_any_without_predicate(async); AssertSql( -""" + """ SELECT `e`.`Id`, `e`.`Name` FROM `EntityOnes` AS `e` WHERE EXISTS ( @@ -54,7 +54,7 @@ public override async Task Skip_navigation_any_with_predicate(bool async) await base.Skip_navigation_any_with_predicate(async); AssertSql( -""" + """ SELECT `e`.`Id`, `e`.`Name` FROM `EntityOnes` AS `e` WHERE EXISTS ( diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs index 62325220..fda4409a 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs @@ -1,10 +1,13 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using EntityFrameworkCore.Jet.Data; using EntityFrameworkCore.Jet.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore.Query; +using Microsoft.EntityFrameworkCore.TestModels.Northwind; using Microsoft.EntityFrameworkCore.TestUtilities; using Xunit; using Xunit.Abstractions; @@ -341,6 +344,24 @@ SELECT MAX(`o`.`OrderID`) """); } + private static readonly IEnumerable StaticIds = new List { "ALFKI", "ANATR" }; + + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual async Task Contains_with_static_IList(bool async) + { + await AssertQuery( + async, + ss => ss.Set().Where(c => StaticIds.Contains(c.CustomerID))); + + 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 Average_no_data(bool async) { await base.Average_no_data(async); @@ -2613,15 +2634,15 @@ public override async Task Collection_Last_member_access_in_projection_translate await base.Collection_Last_member_access_in_projection_translated(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` LIKE 'F%') AND ( - SELECT TOP 1 `o`.`CustomerID` - FROM `Orders` AS `o` - WHERE `c`.`CustomerID` = `o`.`CustomerID` - ORDER BY `o`.`OrderID`) = `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` LIKE 'F%') AND ( + SELECT TOP 1 `o`.`CustomerID` + FROM `Orders` AS `o` + WHERE `c`.`CustomerID` = `o`.`CustomerID` + ORDER BY `o`.`OrderID`) = `c`.`CustomerID` +"""); } public override async Task Collection_LastOrDefault_member_access_in_projection_translated(bool isAsync) @@ -2629,15 +2650,15 @@ public override async Task Collection_LastOrDefault_member_access_in_projection_ await base.Collection_LastOrDefault_member_access_in_projection_translated(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` LIKE 'F%') AND ( - SELECT TOP 1 `o`.`CustomerID` - FROM `Orders` AS `o` - WHERE `c`.`CustomerID` = `o`.`CustomerID` - ORDER BY `o`.`OrderID`) = `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` LIKE 'F%') AND ( + SELECT TOP 1 `o`.`CustomerID` + FROM `Orders` AS `o` + WHERE `c`.`CustomerID` = `o`.`CustomerID` + ORDER BY `o`.`OrderID`) = `c`.`CustomerID` +"""); } public override async Task Sum_over_explicit_cast_over_column(bool isAsync) diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs index 40a30bcc..c280173c 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindEFPropertyIncludeQueryJetTest.cs @@ -100,7 +100,7 @@ public override async Task Include_references_then_include_multi_level(bool asyn await base.Include_references_then_include_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -596,7 +596,7 @@ public override async Task Include_multiple_references_multi_level_reverse(bool await base.Include_multiple_references_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM ((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) @@ -800,7 +800,7 @@ public override async Task Include_multiple_references_then_include_collection_m await base.Include_multiple_references_then_include_collection_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate` FROM (((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) @@ -1013,7 +1013,7 @@ public override async Task Include_references_and_collection_multi_level(bool as await base.Include_references_and_collection_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate` FROM ((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1085,7 +1085,7 @@ public override async Task Include_references_multi_level(bool async) await base.Include_references_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1175,7 +1175,7 @@ public override async Task Include_reference_alias_generation(bool async) await base.Include_reference_alias_generation(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` @@ -1203,7 +1203,7 @@ public override async Task Include_references_then_include_collection_multi_leve await base.Include_references_then_include_collection_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate` FROM ((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1286,7 +1286,7 @@ public override async Task Include_multiple_references_then_include_collection_m await base.Include_multiple_references_then_include_collection_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM (((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1547,7 +1547,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve await base.Include_multiple_references_and_collection_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate` FROM (((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) @@ -1782,7 +1782,7 @@ public override async Task Include_multiple_references_multi_level(bool async) await base.Include_multiple_references_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM ((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1893,7 +1893,7 @@ public override async Task Include_multiple_references_then_include_multi_level_ await base.Include_multiple_references_then_include_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM ((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) @@ -2020,7 +2020,7 @@ public override async Task Include_multiple_references_then_include_multi_level( await base.Include_multiple_references_then_include_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM ((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -2073,7 +2073,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve await base.Include_multiple_references_and_collection_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM (((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -2129,7 +2129,7 @@ public override async Task Include_multiple_references(bool async) await base.Include_multiple_references(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs index aeb5b358..cb06f0c0 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs @@ -1256,11 +1256,11 @@ 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 - """); + """ +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) @@ -1304,11 +1304,11 @@ 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 - """); + """ +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) @@ -1630,7 +1630,7 @@ 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 @@ -1678,7 +1678,7 @@ 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 @@ -2388,13 +2388,13 @@ 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 +WHERE (INSTR(1, `c`.`ContactName`, @__pattern_0, 1) - IIF(@__pattern_0 = '', 0, 1)) = 1 """); } @@ -2403,7 +2403,7 @@ public override async Task Indexof_with_constant_starting_position(bool async) await base.Indexof_with_constant_starting_position(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 @@ -2415,12 +2415,12 @@ 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 +WHERE (INSTR(@__start_0 + 1, `c`.`ContactName`, 'a', 1) - 1) = 4 """); } @@ -2553,7 +2553,7 @@ 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 '') @@ -2565,7 +2565,7 @@ 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` """); diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs index e3641809..c7248e3c 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindGroupByQueryJetTest.cs @@ -274,11 +274,11 @@ public override async Task GroupBy_aggregate_projecting_conditional_expression(b await base.GroupBy_aggregate_projecting_conditional_expression(isAsync); AssertSql( - $""" - SELECT `o`.`OrderDate` AS `Key`, IIF(COUNT(*) = 0, 1, IIF(SUM(IIF((`o`.`OrderID` MOD 2) = 0, 1, 0)) IS NULL, 0, SUM(IIF((`o`.`OrderID` MOD 2) = 0, 1, 0))) \ COUNT(*)) AS `SomeValue` - FROM `Orders` AS `o` - GROUP BY `o`.`OrderDate` - """); + """ +SELECT `o`.`OrderDate` AS `Key`, IIF(COUNT(*) = 0, 1, IIF(SUM(IIF((`o`.`OrderID` MOD 2) = 0, 1, 0)) IS NULL, 0, SUM(IIF((`o`.`OrderID` MOD 2) = 0, 1, 0))) \ COUNT(*)) AS `SomeValue` +FROM `Orders` AS `o` +GROUP BY `o`.`OrderDate` +"""); } public override async Task GroupBy_aggregate_projecting_conditional_expression_based_on_group_key(bool isAsync) diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs index 24c902ac..47cfcb67 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeNoTrackingQueryJetTest.cs @@ -449,7 +449,7 @@ public override async Task Include_multiple_references(bool async) await base.Include_multiple_references(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -490,7 +490,7 @@ public override async Task Include_multiple_references_multi_level_reverse(bool await base.Include_multiple_references_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM ((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) @@ -523,7 +523,7 @@ public override async Task Include_multiple_references_multi_level(bool async) await base.Include_multiple_references_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM ((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -738,7 +738,7 @@ public override async Task Include_references_then_include_multi_level(bool asyn await base.Include_references_then_include_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -843,7 +843,7 @@ public override async Task Include_references_multi_level(bool async) await base.Include_references_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1755,7 +1755,7 @@ public override async Task Include_reference_alias_generation(bool async) await base.Include_reference_alias_generation(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` @@ -1811,7 +1811,7 @@ public override async Task Include_multiple_references_then_include_multi_level( await base.Include_multiple_references_then_include_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM ((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1869,7 +1869,7 @@ public override async Task Include_multiple_references_then_include_multi_level_ await base.Include_multiple_references_then_include_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM ((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs index ca2580f0..2ad6d813 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindIncludeQueryJetTest.cs @@ -187,13 +187,13 @@ public override async Task Include_references_multi_level(bool async) await base.Include_references_multi_level(async); AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM (`Order Details` AS `o` - INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) - LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` - WHERE (`o`.`OrderID` MOD 23) = 13 - """); + """ +SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM (`Order Details` AS `o` +INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) +LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` +WHERE (`o`.`OrderID` MOD 23) = 13 +"""); } public override async Task Include_multiple_references_multi_level(bool async) @@ -201,14 +201,14 @@ public override async Task Include_multiple_references_multi_level(bool async) await base.Include_multiple_references_multi_level(async); AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` - FROM ((`Order Details` AS `o` - INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) - LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) - INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID` - WHERE (`o`.`OrderID` MOD 23) = 13 - """); + """ +SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` +FROM ((`Order Details` AS `o` +INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) +LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) +INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID` +WHERE (`o`.`OrderID` MOD 23) = 13 +"""); } public override async Task Include_multiple_references_multi_level_reverse(bool async) @@ -216,14 +216,14 @@ public override async Task Include_multiple_references_multi_level_reverse(bool await base.Include_multiple_references_multi_level_reverse(async); AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` - FROM ((`Order Details` AS `o` - INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) - INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) - LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` - WHERE (`o`.`OrderID` MOD 23) = 13 - """); + """ +SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM ((`Order Details` AS `o` +INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) +INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) +LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID` +WHERE (`o`.`OrderID` MOD 23) = 13 +"""); } public override async Task Include_references_and_collection_multi_level(bool async) @@ -231,15 +231,15 @@ public override async Task Include_references_and_collection_multi_level(bool as await base.Include_references_and_collection_multi_level(async); AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate` - FROM ((`Order Details` AS `o` - INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) - LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) - LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` - WHERE (`o`.`OrderID` MOD 23) = 13 AND `o`.`UnitPrice` < 10.0 - ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o0`.`OrderID`, `c`.`CustomerID` - """); + """ +SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate` +FROM ((`Order Details` AS `o` +INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) +LEFT JOIN `Customers` AS `c` ON `o0`.`CustomerID` = `c`.`CustomerID`) +LEFT JOIN `Orders` AS `o1` ON `c`.`CustomerID` = `o1`.`CustomerID` +WHERE (`o`.`OrderID` MOD 23) = 13 AND `o`.`UnitPrice` < 10.0 +ORDER BY `o`.`OrderID`, `o`.`ProductID`, `o0`.`OrderID`, `c`.`CustomerID` +"""); } public override async Task Include_multi_level_reference_and_collection_predicate(bool async) @@ -840,13 +840,13 @@ public override async Task Include_multiple_references(bool async) await base.Include_multiple_references(async); AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` - FROM (`Order Details` AS `o` - INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) - INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID` - WHERE (`o`.`OrderID` MOD 23) = 13 - """); + """ +SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` +FROM (`Order Details` AS `o` +INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) +INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID` +WHERE (`o`.`OrderID` MOD 23) = 13 +"""); } public override async Task Include_reference_alias_generation(bool async) @@ -854,12 +854,12 @@ public override async Task Include_reference_alias_generation(bool async) await base.Include_reference_alias_generation(async); AssertSql( - $""" - SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` - FROM `Order Details` AS `o` - INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` - WHERE (`o`.`OrderID` MOD 23) = 13 - """); + """ +SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` +FROM `Order Details` AS `o` +INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` +WHERE (`o`.`OrderID` MOD 23) = 13 +"""); } public override async Task Include_duplicate_reference(bool async) @@ -1831,7 +1831,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve await base.Include_multiple_references_and_collection_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM (((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1909,7 +1909,7 @@ public override async Task Include_references_then_include_multi_level(bool asyn await base.Include_references_then_include_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1938,7 +1938,7 @@ public override async Task Include_references_then_include_collection_multi_leve await base.Include_references_then_include_collection_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate` FROM ((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1968,7 +1968,7 @@ public override async Task Include_multiple_references_then_include_multi_level( await base.Include_multiple_references_then_include_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM ((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1983,7 +1983,7 @@ public override async Task Include_multiple_references_then_include_collection_m await base.Include_multiple_references_then_include_collection_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate` FROM (((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) @@ -2098,7 +2098,7 @@ public override async Task Include_multiple_references_then_include_collection_m await base.Include_multiple_references_then_include_collection_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM (((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -2178,7 +2178,7 @@ public override async Task Include_multiple_references_then_include_multi_level_ await base.Include_multiple_references_then_include_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM ((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) @@ -2193,7 +2193,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve await base.Include_multiple_references_and_collection_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate` FROM (((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs index a0c10b00..0a634a02 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindMiscellaneousQueryJetTest.cs @@ -4817,13 +4817,13 @@ public override async Task Comparing_entities_using_Equals(bool isAsync) await base.Comparing_entities_using_Equals(isAsync); AssertSql( - $""" - SELECT `c`.`CustomerID` AS `Id1`, `c0`.`CustomerID` AS `Id2` - FROM `Customers` AS `c`, - `Customers` AS `c0` - WHERE (`c`.`CustomerID` LIKE 'ALFKI%') AND `c`.`CustomerID` = `c0`.`CustomerID` - ORDER BY `c`.`CustomerID` - """); + """ +SELECT `c`.`CustomerID` AS `Id1`, `c0`.`CustomerID` AS `Id2` +FROM `Customers` AS `c`, +`Customers` AS `c0` +WHERE (`c`.`CustomerID` LIKE 'ALFKI%') AND `c`.`CustomerID` = `c0`.`CustomerID` +ORDER BY `c`.`CustomerID` +"""); } public override async Task Comparing_different_entity_types_using_Equals(bool isAsync) @@ -5175,7 +5175,7 @@ public override async Task Let_entity_equality_to_other_entity(bool isAsync) await base.Let_entity_equality_to_other_entity(isAsync); AssertSql( -""" + """ SELECT `c`.`CustomerID`, ( SELECT TOP 1 `o0`.`OrderDate` FROM `Orders` AS `o0` @@ -5673,6 +5673,17 @@ public override async Task MemberInitExpression_NewExpression_is_funcletized_eve """); } + public override async Task Funcletize_conditional_with_evaluatable_test(bool async) + { + await base.Funcletize_conditional_with_evaluatable_test(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` +"""); + } + public override async Task Projecting_collection_split(bool async) { await base.Projecting_collection_split(async); diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryFiltersQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryFiltersQueryJetTest.cs index 0142fa61..15ffc5d1 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryFiltersQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryFiltersQueryJetTest.cs @@ -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) 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_0_startswith) AND `c`.`CustomerID` = @__p_0 """); } @@ -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) SELECT `c`.`CustomerID`, `c`.`Address`, `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_0_startswith) AND `c`.`CustomerID` = @__customerID """, // - $""" + """ @__ef_filter__TenantPrefix_0_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_0_startswith) AND `c`.`CustomerID` = @__customerID """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs index a8830c90..55d3fd71 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSelectQueryJetTest.cs @@ -2018,10 +2018,10 @@ 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` - FROM `Customers` AS `c` - ORDER BY `c`.`CustomerID` - """); +SELECT TOP 10 (`c`.`CustomerID` & ' ') & IIF(`c`.`City` IS NULL, '', `c`.`City`) AS `Aggregate` +FROM `Customers` AS `c` +ORDER BY `c`.`CustomerID` +"""); } public override async Task Projection_skip_projection_doesnt_project_intermittent_column(bool async) diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryJetTest.cs index 51a14f69..6165fbc5 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQueryJetTest.cs @@ -282,7 +282,7 @@ public override async Task Include_references_multi_level(bool async) await base.Include_references_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -296,7 +296,7 @@ public override async Task Include_multiple_references_then_include_multi_level( await base.Include_multiple_references_then_include_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM ((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -464,7 +464,7 @@ public override async Task Include_multiple_references_multi_level_reverse(bool await base.Include_multiple_references_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM ((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) @@ -809,7 +809,7 @@ public override async Task Include_references_then_include_multi_level(bool asyn await base.Include_references_then_include_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -874,7 +874,7 @@ public override async Task Include_multiple_references_multi_level(bool async) await base.Include_multiple_references_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM ((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1050,7 +1050,7 @@ public override async Task Include_reference_alias_generation(bool async) await base.Include_reference_alias_generation(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` @@ -1894,7 +1894,7 @@ public override async Task Include_multiple_references(bool async) await base.Include_multiple_references(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -2075,7 +2075,7 @@ public override async Task Include_multiple_references_then_include_multi_level_ await base.Include_multiple_references_then_include_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM ((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeQueryJetTest.cs index a9dcd839..1da3510e 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindSplitIncludeQueryJetTest.cs @@ -206,7 +206,7 @@ public override async Task Include_references_multi_level(bool async) await base.Include_references_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -220,7 +220,7 @@ public override async Task Include_multiple_references_multi_level(bool async) await base.Include_multiple_references_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM ((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -235,7 +235,7 @@ public override async Task Include_multiple_references_multi_level_reverse(bool await base.Include_multiple_references_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM ((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) @@ -1184,7 +1184,7 @@ public override async Task Include_multiple_references(bool async) await base.Include_multiple_references(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1198,7 +1198,7 @@ public override async Task Include_reference_alias_generation(bool async) await base.Include_reference_alias_generation(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` @@ -2676,7 +2676,7 @@ public override async Task Include_multiple_references_then_include_multi_level( await base.Include_multiple_references_then_include_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM ((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -2839,7 +2839,7 @@ public override async Task Include_references_then_include_multi_level(bool asyn await base.Include_references_then_include_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -2912,7 +2912,7 @@ public override async Task Include_multiple_references_then_include_multi_level_ await base.Include_multiple_references_then_include_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM ((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs index 5af397f3..76bdd188 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindStringIncludeQueryJetTest.cs @@ -102,7 +102,7 @@ public override async Task Include_references_then_include_multi_level(bool asyn await base.Include_references_then_include_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -598,7 +598,7 @@ public override async Task Include_multiple_references_multi_level_reverse(bool await base.Include_multiple_references_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM ((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) @@ -795,7 +795,7 @@ public override async Task Include_multiple_references_then_include_collection_m await base.Include_multiple_references_then_include_collection_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate` FROM (((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) @@ -995,7 +995,7 @@ public override async Task Include_references_and_collection_multi_level(bool as await base.Include_references_and_collection_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate` FROM ((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1067,7 +1067,7 @@ public override async Task Include_references_multi_level(bool async) await base.Include_references_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1157,7 +1157,7 @@ public override async Task Include_reference_alias_generation(bool async) await base.Include_reference_alias_generation(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate` FROM `Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID` @@ -1185,7 +1185,7 @@ public override async Task Include_references_then_include_collection_multi_leve await base.Include_references_then_include_collection_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate` FROM ((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1268,7 +1268,7 @@ public override async Task Include_multiple_references_then_include_collection_m await base.Include_multiple_references_then_include_collection_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM (((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1522,7 +1522,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve await base.Include_multiple_references_and_collection_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate` FROM (((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) @@ -1757,7 +1757,7 @@ public override async Task Include_multiple_references_multi_level(bool async) await base.Include_multiple_references_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM ((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -1855,7 +1855,7 @@ public override async Task Include_multiple_references_then_include_multi_level_ await base.Include_multiple_references_then_include_multi_level_reverse(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` FROM ((`Order Details` AS `o` INNER JOIN `Products` AS `p` ON `o`.`ProductID` = `p`.`ProductID`) @@ -1982,7 +1982,7 @@ public override async Task Include_multiple_references_then_include_multi_level( await base.Include_multiple_references_then_include_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM ((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -2035,7 +2035,7 @@ public override async Task Include_multiple_references_and_collection_multi_leve await base.Include_multiple_references_and_collection_multi_level(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `p`.`ProductID`, `o1`.`OrderID`, `o1`.`CustomerID`, `o1`.`EmployeeID`, `o1`.`OrderDate`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM (((`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) @@ -2091,7 +2091,7 @@ public override async Task Include_multiple_references(bool async) await base.Include_multiple_references(async); AssertSql( -""" + """ SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`, `o0`.`OrderID`, `o0`.`CustomerID`, `o0`.`EmployeeID`, `o0`.`OrderDate`, `p`.`ProductID`, `p`.`Discontinued`, `p`.`ProductName`, `p`.`SupplierID`, `p`.`UnitPrice`, `p`.`UnitsInStock` FROM (`Order Details` AS `o` INNER JOIN `Orders` AS `o0` ON `o`.`OrderID` = `o0`.`OrderID`) diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs index 193bcfef..c2247215 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs @@ -1380,12 +1380,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' 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_0) """); } @@ -1526,13 +1526,13 @@ 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` - """); + """ +@__i_0='10' + +SELECT `c`.`CustomerID` +FROM `Customers` AS `c` +WHERE (`c`.`CustomerID` & (@__i_0 & '')) = `c`.`CompanyName` +"""); } public override async Task Where_concat_string_int_comparison2(bool isAsync) @@ -1540,13 +1540,13 @@ 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` - """); + """ +@__i_0='10' + +SELECT `c`.`CustomerID` +FROM `Customers` AS `c` +WHERE ((@__i_0 & '') & `c`.`CustomerID`) = `c`.`CompanyName` +"""); } public override async Task Where_concat_string_int_comparison3(bool isAsync) @@ -1554,14 +1554,14 @@ 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` - """); + """ +@__p_0='30' +@__j_1='21' + +SELECT `c`.`CustomerID` +FROM `Customers` AS `c` +WHERE ((((@__p_0 & '') & `c`.`CustomerID`) & (@__j_1 & '')) & (42 & '')) = `c`.`CompanyName` +"""); } public override async Task Where_concat_string_int_comparison4(bool isAsync) @@ -1581,13 +1581,13 @@ 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' - """); + """ +@__i_0='A' (Size = 255) + +SELECT `c`.`CustomerID` +FROM `Customers` AS `c` +WHERE (@__i_0 & `c`.`CustomerID`) = 'AALFKI' +"""); } public override async Task Where_string_concat_method_comparison(bool isAsync) @@ -1595,13 +1595,13 @@ 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' - """); + """ +@__i_0='A' (Size = 255) + +SELECT `c`.`CustomerID` +FROM `Customers` AS `c` +WHERE (@__i_0 & `c`.`CustomerID`) = 'AAROUT' +"""); } public override async Task Where_string_concat_method_comparison_2(bool async) @@ -1609,13 +1609,13 @@ 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' +WHERE (@__i_0 & (@__j_1 & `c`.`CustomerID`)) = 'ABANATR' """); } @@ -1624,14 +1624,14 @@ 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' +WHERE (@__i_0 & (@__j_1 & (@__k_2 & `c`.`CustomerID`))) = 'ABCANTON' """); } @@ -2110,14 +2110,14 @@ public override async Task Using_same_parameter_twice_in_query_generates_one_sql await base.Using_same_parameter_twice_in_query_generates_one_sql_parameter(async); AssertSql( - $""" - @__i_0='10' - @__i_0='10' - - SELECT `c`.`CustomerID` - FROM `Customers` AS `c` - WHERE ((({AssertSqlHelper.Parameter("@__i_0")} & '') & `c`.`CustomerID`) & ({AssertSqlHelper.Parameter("@__i_0")} & '')) = '10ALFKI10' - """); + """ +@__i_0='10' +@__i_0='10' + +SELECT `c`.`CustomerID` +FROM `Customers` AS `c` +WHERE (((@__i_0 & '') & `c`.`CustomerID`) & (@__i_0 & '')) = '10ALFKI10' +"""); } public override async Task Where_Queryable_ToList_Count(bool async) diff --git a/test/EFCore.Jet.FunctionalTests/Query/NullSemanticsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NullSemanticsQueryJetTest.cs index c30ae1b1..d5c037b9 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NullSemanticsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NullSemanticsQueryJetTest.cs @@ -1701,9 +1701,9 @@ public override async Task Join_uses_csharp_semantics_for_anon_objects(bool asyn AssertSql( """ -SELECT [e].[Id] AS [Id1], [e0].[Id] AS [Id2], [e].[NullableIntA], [e0].[NullableIntB] -FROM [Entities1] AS [e] -INNER JOIN [Entities2] AS [e0] ON [e].[NullableIntA] = [e0].[NullableIntB] OR ([e].[NullableIntA] IS NULL AND [e0].[NullableIntB] IS NULL) +SELECT `e`.`Id` AS `Id1`, `e0`.`Id` AS `Id2`, `e`.`NullableIntA`, `e0`.`NullableIntB` +FROM `Entities1` AS `e` +INNER JOIN `Entities2` AS `e0` ON (`e`.`NullableIntA` = `e0`.`NullableIntB`) OR (`e`.`NullableIntA` IS NULL AND `e0`.`NullableIntB` IS NULL) """); } @@ -2352,19 +2352,19 @@ public override async Task Null_semantics_applied_when_comparing_function_with_n await base.Null_semantics_applied_when_comparing_function_with_nullable_argument_to_a_nullable_column(async); AssertSql( -""" + """ SELECT `e`.`Id` FROM `Entities1` AS `e` WHERE (INSTR(1, `e`.`NullableStringA`, 'oo', 1) - 1) = `e`.`NullableIntA` OR (`e`.`NullableStringA` IS NULL AND `e`.`NullableIntA` IS NULL) """, -// -""" + // + """ SELECT `e`.`Id` FROM `Entities1` AS `e` WHERE (INSTR(1, `e`.`NullableStringA`, 'ar', 1) - 1) = `e`.`NullableIntA` OR (`e`.`NullableStringA` IS NULL AND `e`.`NullableIntA` IS NULL) """, -// -""" + // + """ SELECT `e`.`Id` FROM `Entities1` AS `e` WHERE ((INSTR(1, `e`.`NullableStringA`, 'oo', 1) - 1) <> `e`.`NullableIntB` OR `e`.`NullableStringA` IS NULL OR `e`.`NullableIntB` IS NULL) AND (`e`.`NullableStringA` IS NOT NULL OR `e`.`NullableIntB` IS NOT NULL) @@ -2400,19 +2400,19 @@ public override async Task Null_semantics_applied_when_comparing_two_functions_w await base.Null_semantics_applied_when_comparing_two_functions_with_nullable_arguments(async); AssertSql( -""" + """ SELECT `e`.`Id` FROM `Entities1` AS `e` WHERE (INSTR(1, `e`.`NullableStringA`, 'oo', 1) - 1) = (INSTR(1, `e`.`NullableStringB`, 'ar', 1) - 1) OR (`e`.`NullableStringA` IS NULL AND `e`.`NullableStringB` IS NULL) """, -// -""" + // + """ SELECT `e`.`Id` FROM `Entities1` AS `e` WHERE ((INSTR(1, `e`.`NullableStringA`, 'oo', 1) - 1) <> (INSTR(1, `e`.`NullableStringB`, 'ar', 1) - 1) OR `e`.`NullableStringA` IS NULL OR `e`.`NullableStringB` IS NULL) AND (`e`.`NullableStringA` IS NOT NULL OR `e`.`NullableStringB` IS NOT NULL) """, -// -""" + // + """ SELECT `e`.`Id` FROM `Entities1` AS `e` WHERE ((INSTR(1, `e`.`NullableStringA`, 'oo', 1) - 1) <> (INSTR(1, `e`.`NullableStringA`, 'ar', 1) - 1) OR `e`.`NullableStringA` IS NULL) AND `e`.`NullableStringA` IS NOT NULL diff --git a/test/EFCore.Jet.FunctionalTests/Query/OperatorsQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/OperatorsQueryJetTest.cs index 3b35654f..c646edb9 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/OperatorsQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/OperatorsQueryJetTest.cs @@ -73,7 +73,7 @@ public override async Task Projection_with_not_and_negation_on_integer() await base.Projection_with_not_and_negation_on_integer(); AssertSql( -""" + """ SELECT (BNOT-(-((`o1`.`Value` + `o`.`Value`) + 2))) MOD (-(`o0`.`Value` + `o0`.`Value`) - `o`.`Value`) FROM `OperatorEntityLong` AS `o`, `OperatorEntityLong` AS `o0`, diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyQueryJetTest.cs index 4c1b4b59..e06904b4 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPCManyToManyQueryJetTest.cs @@ -44,7 +44,7 @@ public override async Task Skip_navigation_any_without_predicate(bool async) await base.Skip_navigation_any_without_predicate(async); AssertSql( -""" + """ SELECT `e`.`Id`, `e`.`Name` FROM `EntityOnes` AS `e` WHERE EXISTS ( @@ -60,7 +60,7 @@ public override async Task Skip_navigation_any_with_predicate(bool async) await base.Skip_navigation_any_with_predicate(async); AssertSql( -""" + """ SELECT `e`.`Id`, `e`.`Name` FROM `EntityOnes` AS `e` WHERE EXISTS ( @@ -2162,7 +2162,7 @@ public override async Task Skip_navigation_any_with_predicate_unidirectional(boo await base.Skip_navigation_any_with_predicate_unidirectional(async); AssertSql( -""" + """ SELECT `u`.`Id`, `u`.`Name` FROM `UnidirectionalEntityOnes` AS `u` WHERE EXISTS ( diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetTest.cs index c9ca5d14..82b0a66e 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/TPTFiltersInheritanceQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPTFiltersInheritanceQueryJetTest.cs index 7ad3a6a1..cbe0d4d9 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' 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_0 """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs index 8850223d..d806ebcd 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPTGearsOfWarQueryJetTest.cs @@ -575,7 +575,7 @@ public override async Task Where_bitwise_and_nullable_enum_with_null_constant(bo await base.Where_bitwise_and_nullable_enum_with_null_constant(async); AssertSql( -""" + """ SELECT `w`.`Id`, `w`.`AmmunitionType`, `w`.`IsAutomatic`, `w`.`Name`, `w`.`OwnerFullName`, `w`.`SynergyWithId` FROM `Weapons` AS `w` WHERE (`w`.`AmmunitionType` BAND NULL) > 0 @@ -621,7 +621,7 @@ public override async Task Where_bitwise_or_enum(bool async) await base.Where_bitwise_or_enum(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` @@ -1678,7 +1678,7 @@ public override async Task Where_subquery_distinct_singleordefault_boolean2(bool await base.Where_subquery_distinct_singleordefault_boolean2(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` @@ -6326,7 +6326,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean2(boo await base.Select_subquery_distinct_singleordefault_boolean2(async); AssertSql( -""" + """ SELECT IIF(( SELECT DISTINCT TOP 1 `w`.`IsAutomatic` FROM `Weapons` AS `w` @@ -6476,7 +6476,7 @@ public override async Task Double_order_by_on_Like(bool 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` @@ -6581,7 +6581,7 @@ public override async Task String_concat_on_various_types(bool async) await base.String_concat_on_various_types(async); AssertSql( -""" + """ SELECT ('HasSoulPatch ' & (`g`.`HasSoulPatch` & '')) & ' HasSoulPatch' AS `HasSoulPatch`, ('Rank ' & (`g`.`Rank` & '')) & ' Rank' AS `Rank`, ('SquadId ' & (`g`.`SquadId` & '')) & ' SquadId' AS `SquadId`, ('Rating ' & IIF((`m`.`Rating` & '') IS NULL, '', (`m`.`Rating` & ''))) & ' Rating' AS `Rating`, ('Timeline ' & (`m`.`Timeline` & '')) & ' Timeline' AS `Timeline` FROM `Gears` AS `g`, `Missions` AS `m` @@ -9500,7 +9500,7 @@ public override async Task Where_TimeOnly_IsBetween(bool async) await base.Where_TimeOnly_IsBetween(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 @@ -10273,7 +10273,7 @@ public override async Task String_concat_nullable_expressions_are_coalesced(bool { await base.String_concat_nullable_expressions_are_coalesced(async); AssertSql( -""" + """ SELECT ((`g`.`FullName` & '') & IIF(`g`.`LeaderNickname` IS NULL, '', `g`.`LeaderNickname`)) & '' FROM `Gears` AS `g` """); diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyNoTrackingQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyNoTrackingQueryJetTest.cs index be981de6..f5fa94b1 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyNoTrackingQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyNoTrackingQueryJetTest.cs @@ -45,7 +45,7 @@ public override async Task Skip_navigation_any_without_predicate(bool async) await base.Skip_navigation_any_without_predicate(async); AssertSql( -""" + """ SELECT `e`.`Id`, `e`.`Name` FROM `EntityOnes` AS `e` WHERE EXISTS ( @@ -61,7 +61,7 @@ public override async Task Skip_navigation_any_with_predicate(bool async) await base.Skip_navigation_any_with_predicate(async); AssertSql( -""" + """ SELECT `e`.`Id`, `e`.`Name` FROM `EntityOnes` AS `e` WHERE EXISTS ( @@ -2102,7 +2102,7 @@ public override async Task Skip_navigation_any_with_predicate_unidirectional(boo await base.Skip_navigation_any_with_predicate_unidirectional(async); AssertSql( -""" + """ SELECT `u`.`Id`, `u`.`Name` FROM `UnidirectionalEntityOnes` AS `u` WHERE EXISTS ( diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyQueryJetTest.cs index 83e5a683..d83975b7 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/TPTManyToManyQueryJetTest.cs @@ -44,7 +44,7 @@ public override async Task Skip_navigation_any_without_predicate(bool async) await base.Skip_navigation_any_without_predicate(async); AssertSql( -""" + """ SELECT `e`.`Id`, `e`.`Name` FROM `EntityOnes` AS `e` WHERE EXISTS ( @@ -60,7 +60,7 @@ public override async Task Skip_navigation_any_with_predicate(bool async) await base.Skip_navigation_any_with_predicate(async); AssertSql( -""" + """ SELECT `e`.`Id`, `e`.`Name` FROM `EntityOnes` AS `e` WHERE EXISTS ( @@ -2102,7 +2102,7 @@ public override async Task Skip_navigation_any_with_predicate_unidirectional(boo await base.Skip_navigation_any_with_predicate_unidirectional(async); AssertSql( -""" + """ SELECT `u`.`Id`, `u`.`Name` FROM `UnidirectionalEntityOnes` AS `u` WHERE EXISTS ( diff --git a/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs b/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs index 4c061574..84e61ffc 100644 --- a/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs @@ -21,79 +21,79 @@ 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' @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' @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; """, - // -""" + // + """ SELECT TOP 2 `b`.`Id`, `b`.`AuthorId`, `b`.`Title`, `a`.`Id`, `a`.`AuthorsClubId`, `a`.`Name` FROM `Book` AS `b` 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' @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' -UPDATE `Book` SET `AuthorId` = {AssertSqlHelper.Parameter("@p3")} -WHERE `Id` = {AssertSqlHelper.Parameter("@p4")}; +UPDATE `Book` SET `AuthorId` = @p3 +WHERE `Id` = @p4; SELECT @@ROWCOUNT; """, - // -$""" + // + """ @p0='1' 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 cd04c851..7da9ce81 100644 --- a/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Update/StoredProcedureUpdateJetTest.cs @@ -214,7 +214,7 @@ CREATE PROCEDURE Entity_Delete(@Id int) """); AssertSql( -""" + """ @p0='1' EXEC `Entity_Delete` p0; From a11ebb921a5846887bb84811a2ddc992476ede86 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sun, 1 Dec 2024 17:25:37 +0800 Subject: [PATCH 2/5] fix tests --- .../Sql/Internal/JetQuerySqlGenerator.cs | 28 +------------------ .../GreenTests/ace_2010_odbc_x86.txt | 11 -------- .../GreenTests/ace_2010_oledb_x86.txt | 11 -------- 3 files changed, 1 insertion(+), 49 deletions(-) diff --git a/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs b/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs index 56ca6eab..fdca1686 100644 --- a/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs +++ b/src/EFCore.Jet/Query/Sql/Internal/JetQuerySqlGenerator.cs @@ -347,23 +347,7 @@ private List ExtractColumnExpressions(SqlUnaryExpression unary return result; } - - protected override Expression VisitInnerJoin(InnerJoinExpression innerJoinExpression) - { - parent.Push(innerJoinExpression); - var result = base.VisitInnerJoin(innerJoinExpression); - parent.Pop(); - return result; - } - - protected override Expression VisitLeftJoin(LeftJoinExpression leftJoinExpression) - { - parent.Push(leftJoinExpression); - var result = base.VisitLeftJoin(leftJoinExpression); - parent.Pop(); - return result; - } - + protected override Expression VisitProjection(ProjectionExpression projectionExpression) { if (projectionExpression.Expression is SqlConstantExpression { Value: null } constantExpression && (constantExpression.Type == typeof(int) || constantExpression.Type == typeof(double) || constantExpression.Type == typeof(float) || constantExpression.Type == typeof(decimal) || constantExpression.Type == typeof(short))) @@ -1053,15 +1037,5 @@ protected override void CheckComposableSqlTrimmed(ReadOnlySpan sql) throw new InvalidOperationException(RelationalStrings.FromSqlNonComposable); } } - - protected override bool RequiresParentheses(SqlExpression outerExpression, SqlExpression innerExpression) - { - var withinjoin = parent.Any(x => x is JoinExpressionBase); - if (outerExpression is SqlBinaryExpression { OperatorType: ExpressionType.OrElse, Right: SqlBinaryExpression } && withinjoin) - { - return true; - } - return base.RequiresParentheses(outerExpression, innerExpression); - } } } \ No newline at end of file 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 c0cd8e7d..6b5c717e 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt @@ -8178,18 +8178,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTe EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_diff_against_2_2_ASP_NET_Identity_model EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_diff_against_2_2_model EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_diff_against_3_0_ASP_NET_Identity_model -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_down_script_using_names -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_down_scripts -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_idempotent_down_scripts -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_idempotent_up_scripts -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_idempotent_up_scripts_noTransactions EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_migration_from_initial_database_to_initial EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_no_migration_script -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_one_down_script -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_one_up_script -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_up_script_using_names -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_up_scripts -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_up_scripts_noTransactions EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_get_active_provider EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_revert_all_migrations EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_revert_one_migrations @@ -10220,7 +10210,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Pus EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Pushdown_does_not_add_grouping_key_to_projection_when_distinct_is_applied(async: True) EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Query_cache_entries_are_evicted_as_necessary EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.QueryBuffer_requirement_is_computed_when_querying_base_type_while_derived_type_has_shadow_prop -EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.SaveChangesAsync_accepts_changes_with_ConfigureAwait_true EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Shadow_property_with_inheritance EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Subquery_first_member_compared_to_null(async: False) EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Subquery_first_member_compared_to_null(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 01e30e8f..0613997f 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt @@ -8250,18 +8250,8 @@ EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTe EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_diff_against_2_2_ASP_NET_Identity_model EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_diff_against_2_2_model EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_diff_against_3_0_ASP_NET_Identity_model -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_down_script_using_names -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_down_scripts -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_idempotent_down_scripts -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_idempotent_up_scripts -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_idempotent_up_scripts_noTransactions EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_migration_from_initial_database_to_initial EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_no_migration_script -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_one_down_script -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_one_up_script -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_up_script_using_names -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_up_scripts -EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_generate_up_scripts_noTransactions EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_get_active_provider EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_revert_all_migrations EntityFrameworkCore.Jet.FunctionalTests.Migrations.MigrationsInfrastructureJetTest.Can_revert_one_migrations @@ -10333,7 +10323,6 @@ EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Que EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.QueryBuffer_requirement_is_computed_when_querying_base_type_while_derived_type_has_shadow_prop EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Relational_command_cache_creates_new_entry_when_parameter_nullability_changes EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Repeated_parameters_in_generated_query_sql -EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.SaveChangesAsync_accepts_changes_with_ConfigureAwait_true EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Select_nested_projection EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.Shadow_property_with_inheritance EntityFrameworkCore.Jet.FunctionalTests.Query.AdHocMiscellaneousQueryJetTest.StoreType_for_UDF_used(async: False) From 3227850900198e7289f61af8cf265578286fbac8 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sun, 1 Dec 2024 19:09:41 +0800 Subject: [PATCH 3/5] fix odbc --- ...orthwindFunctionsQueryJetTest.Functions.cs | 8 ++--- .../NorthwindQueryFiltersQueryJetTest.cs | 12 +++---- .../Query/NorthwindWhereQueryJetTest.cs | 36 +++++++++---------- .../Query/TPHInheritanceQueryJetTest.cs | 4 +-- .../TPTFiltersInheritanceQueryJetTest.cs | 4 +-- .../Update/NonSharedModelUpdatesJetTest.cs | 30 ++++++++-------- 6 files changed, 47 insertions(+), 47 deletions(-) diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs index cb06f0c0..88a9e307 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindFunctionsQueryJetTest.Functions.cs @@ -2388,13 +2388,13 @@ 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`, @__pattern_0, 1) - IIF(@__pattern_0 = '', 0, 1)) = 1 +WHERE (INSTR(1, `c`.`ContactName`, {AssertSqlHelper.Parameter("@__pattern_0")}, 1) - IIF({AssertSqlHelper.Parameter("@__pattern_0")} = '', 0, 1)) = 1 """); } @@ -2415,12 +2415,12 @@ 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(@__start_0 + 1, `c`.`ContactName`, 'a', 1) - 1) = 4 +WHERE (INSTR({AssertSqlHelper.Parameter("@__start_0")} + 1, `c`.`ContactName`, 'a', 1) - 1) = 4 """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryFiltersQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryFiltersQueryJetTest.cs index 15ffc5d1..0142fa61 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryFiltersQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindQueryFiltersQueryJetTest.cs @@ -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) 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 @__ef_filter__TenantPrefix_0_startswith) AND `c`.`CustomerID` = @__p_0 +WHERE (`c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")}) AND `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__p_0")} """); } @@ -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) SELECT `c`.`CustomerID`, `c`.`Address`, `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 @__ef_filter__TenantPrefix_0_startswith) AND `c`.`CustomerID` = @__customerID +WHERE (`c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")}) AND `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} """, // - """ + $""" @__ef_filter__TenantPrefix_0_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 @__ef_filter__TenantPrefix_0_startswith) AND `c`.`CustomerID` = @__customerID +WHERE (`c`.`CompanyName` LIKE {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0_startswith")}) AND `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")} """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs index c2247215..3263b886 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs @@ -1380,12 +1380,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' 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 @__prm_0) +WHERE `p`.`Discontinued` = (IIF(`p`.`ProductID` > 50, TRUE, FALSE) BXOR {AssertSqlHelper.Parameter("@__prm_0")}) """); } @@ -1526,12 +1526,12 @@ 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` & (@__i_0 & '')) = `c`.`CompanyName` +WHERE (`c`.`CustomerID` & ({AssertSqlHelper.Parameter("@__i_0")} & '')) = `c`.`CompanyName` """); } @@ -1540,12 +1540,12 @@ 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 ((@__i_0 & '') & `c`.`CustomerID`) = `c`.`CompanyName` +WHERE (({AssertSqlHelper.Parameter("@__i_0")} & '') & `c`.`CustomerID`) = `c`.`CompanyName` """); } @@ -1554,13 +1554,13 @@ 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 ((((@__p_0 & '') & `c`.`CustomerID`) & (@__j_1 & '')) & (42 & '')) = `c`.`CompanyName` +WHERE (((({AssertSqlHelper.Parameter("@__p_0")} & '') & `c`.`CustomerID`) & {AssertSqlHelper.Parameter("(@__j_1")} & '')) & (42 & '')) = `c`.`CompanyName` """); } @@ -1581,12 +1581,12 @@ 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 (@__i_0 & `c`.`CustomerID`) = 'AALFKI' +WHERE ({AssertSqlHelper.Parameter("@__i_0")} & `c`.`CustomerID`) = 'AALFKI' """); } @@ -1595,12 +1595,12 @@ 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 (@__i_0 & `c`.`CustomerID`) = 'AAROUT' +WHERE ({AssertSqlHelper.Parameter("@__i_0")} & `c`.`CustomerID`) = 'AAROUT' """); } @@ -1609,13 +1609,13 @@ 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 (@__i_0 & (@__j_1 & `c`.`CustomerID`)) = 'ABANATR' +WHERE ({AssertSqlHelper.Parameter("@__i_0")} & ({AssertSqlHelper.Parameter("@__j_1")} & `c`.`CustomerID`)) = 'ABANATR' """); } @@ -1624,14 +1624,14 @@ 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 (@__i_0 & (@__j_1 & (@__k_2 & `c`.`CustomerID`))) = 'ABCANTON' +WHERE ({AssertSqlHelper.Parameter("@__i_0")} & ({AssertSqlHelper.Parameter("@__j_1")} & ({AssertSqlHelper.Parameter("@__k_2")} & `c`.`CustomerID`))) = 'ABCANTON' """); } @@ -2110,13 +2110,13 @@ public override async Task Using_same_parameter_twice_in_query_generates_one_sql await base.Using_same_parameter_twice_in_query_generates_one_sql_parameter(async); AssertSql( - """ + $""" @__i_0='10' @__i_0='10' SELECT `c`.`CustomerID` FROM `Customers` AS `c` -WHERE (((@__i_0 & '') & `c`.`CustomerID`) & (@__i_0 & '')) = '10ALFKI10' +WHERE ((({AssertSqlHelper.Parameter("@__i_0")} & '') & `c`.`CustomerID`) & ({AssertSqlHelper.Parameter("@__i_0")} & '')) = '10ALFKI10' """); } diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPHInheritanceQueryJetTest.cs index 82b0a66e..44fad800 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 (@p0, @p1, @p2, @p3, @p4, @p5, @p6); +VALUES ({AssertSqlHelper.Parameter("@p0")}, {AssertSqlHelper.Parameter("@p1")}, {AssertSqlHelper.Parameter("@p2")}, {AssertSqlHelper.Parameter("@p3")}, {AssertSqlHelper.Parameter("@p4")}, {AssertSqlHelper.Parameter("@p5")}, {AssertSqlHelper.Parameter("@p6")}); SELECT `Id` FROM `Animals` WHERE @@ROWCOUNT = 1 AND `Id` = @@identity; diff --git a/test/EFCore.Jet.FunctionalTests/Query/TPTFiltersInheritanceQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/TPTFiltersInheritanceQueryJetTest.cs index cbe0d4d9..4d69ca41 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' 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` = @__p_0 +WHERE `a`.`Id` = {AssertSqlHelper.Parameter("@__p_0")} """); } diff --git a/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs b/test/EFCore.Jet.FunctionalTests/Update/NonSharedModelUpdatesJetTest.cs index 84e61ffc..b914e1f3 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 (@p0); +VALUES ({AssertSqlHelper.Parameter("@p0")}); SELECT `Id` FROM `AuthorsClub` WHERE @@ROWCOUNT = 1 AND `Id` = @@identity; """, // - """ + $""" @p1='1' @p2='Alice' (Size = 255) INSERT INTO `Author` (`AuthorsClubId`, `Name`) -VALUES (@p1, @p2); +VALUES ({AssertSqlHelper.Parameter("@p1")}, {AssertSqlHelper.Parameter("@p2")}); SELECT `Id` FROM `Author` WHERE @@ROWCOUNT = 1 AND `Id` = @@identity; """, // - """ + $""" @p3='1' @p4=NULL (Size = 255) INSERT INTO `Book` (`AuthorId`, `Title`) -VALUES (@p3, @p4); +VALUES ({AssertSqlHelper.Parameter("@p3")}, {AssertSqlHelper.Parameter("@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 (@p0); +VALUES ({AssertSqlHelper.Parameter("@p0")}); SELECT `Id` FROM `AuthorsClub` WHERE @@ROWCOUNT = 1 AND `Id` = @@identity; """, // - """ + $""" @p1='2' @p2='Author of the year 2023' (Size = 255) INSERT INTO `Author` (`AuthorsClubId`, `Name`) -VALUES (@p1, @p2); +VALUES ({AssertSqlHelper.Parameter("@p1")}, {AssertSqlHelper.Parameter("@p2")}); SELECT `Id` FROM `Author` WHERE @@ROWCOUNT = 1 AND `Id` = @@identity; """, // - """ + $""" @p3='2' @p4='1' -UPDATE `Book` SET `AuthorId` = @p3 -WHERE `Id` = @p4; +UPDATE `Book` SET `AuthorId` = {AssertSqlHelper.Parameter("@p3")} +WHERE `Id` = {AssertSqlHelper.Parameter("@p4")}; SELECT @@ROWCOUNT; """, // - """ + $""" @p0='1' DELETE FROM `Author` -WHERE `Id` = @p0; +WHERE `Id` = {AssertSqlHelper.Parameter("@p0")}; SELECT @@ROWCOUNT; """); } From 1035bf16373ffb76f56fd8cfec3737e2f72a946c Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sun, 1 Dec 2024 19:41:20 +0800 Subject: [PATCH 4/5] fix another test --- .../Query/NorthwindWhereQueryJetTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs index 3263b886..a5bbea0a 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindWhereQueryJetTest.cs @@ -1560,7 +1560,7 @@ public override async Task Where_concat_string_int_comparison3(bool isAsync) SELECT `c`.`CustomerID` FROM `Customers` AS `c` -WHERE (((({AssertSqlHelper.Parameter("@__p_0")} & '') & `c`.`CustomerID`) & {AssertSqlHelper.Parameter("(@__j_1")} & '')) & (42 & '')) = `c`.`CompanyName` +WHERE (((({AssertSqlHelper.Parameter("@__p_0")} & '') & `c`.`CustomerID`) & ({AssertSqlHelper.Parameter("@__j_1")} & '')) & (42 & '')) = `c`.`CompanyName` """); } From e0bf0bb1199ad68212746dbf7829006124a4c71b Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Sun, 1 Dec 2024 19:56:53 +0800 Subject: [PATCH 5/5] Add some missed tests in MigrationsInfrastructure --- .../MigrationsInfrastructureJetTest.cs | 480 ++++++++++++++++++ 1 file changed, 480 insertions(+) diff --git a/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsInfrastructureJetTest.cs b/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsInfrastructureJetTest.cs index cef89ba7..c8c2c082 100644 --- a/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsInfrastructureJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsInfrastructureJetTest.cs @@ -66,6 +66,486 @@ IF NOT EXISTS (SELECT * FROM `INFORMATION_SCHEMA.TABLES` WHERE `TABLE_NAME` = '_ ignoreLineEndingDifferences: true); } + public override async Task Can_generate_up_and_down_scripts() + { + await base.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]) + ); +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]) +); + +INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) +VALUES (N'00000000000001_Migration1', N'7.0.0-test'); + +EXEC sp_rename N'[Table1].[Foo]', N'Bar', 'COLUMN'; + +INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) +VALUES (N'00000000000002_Migration2', N'7.0.0-test'); + +COMMIT; +GO + +CREATE DATABASE TransactionSuppressed; +GO + +DROP DATABASE TransactionSuppressed; +GO + +INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) +VALUES (N'00000000000003_Migration3', N'7.0.0-test'); +GO + +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; + +GO + +SELECT GetDate(); +--GO +SELECT GetDate() +GO + +INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) +VALUES (N'00000000000004_Migration4', N'7.0.0-test'); +GO + +BEGIN TRANSACTION; +INSERT INTO Table1 (Id, Bar, Description) VALUES (-1, 3, 'Value With + +Empty Lines') + +INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) +VALUES (N'00000000000005_Migration5', N'7.0.0-test'); + +INSERT INTO Table1 (Id, Bar, Description) VALUES (-2, 4, 'GO +Value With + +Empty Lines') + +INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) +VALUES (N'00000000000006_Migration6', N'7.0.0-test'); + +INSERT INTO Table1 (Id, Bar, Description) VALUES (-3, 5, '--Start +GO +Value With + +GO + +Empty Lines; +GO +') + +INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) +VALUES (N'00000000000007_Migration7', N'7.0.0-test'); + +COMMIT; +GO + +BEGIN TRANSACTION; +DELETE FROM [__EFMigrationsHistory] +WHERE [MigrationId] = N'00000000000007_Migration7'; + +DELETE FROM [__EFMigrationsHistory] +WHERE [MigrationId] = N'00000000000006_Migration6'; + +DELETE FROM [__EFMigrationsHistory] +WHERE [MigrationId] = N'00000000000005_Migration5'; + +DELETE FROM [__EFMigrationsHistory] +WHERE [MigrationId] = N'00000000000004_Migration4'; + +DELETE FROM [__EFMigrationsHistory] +WHERE [MigrationId] = N'00000000000003_Migration3'; + +EXEC sp_rename N'[Table1].[Bar]', N'Foo', 'COLUMN'; + +DELETE FROM [__EFMigrationsHistory] +WHERE [MigrationId] = N'00000000000002_Migration2'; + +DROP TABLE [Table1]; + +DELETE FROM [__EFMigrationsHistory] +WHERE [MigrationId] = N'00000000000001_Migration1'; + +COMMIT; +GO + + +""", + Sql, + ignoreLineEndingDifferences: true); + } + + public override async Task Can_generate_up_and_down_scripts_noTransactions() + { + await base.Can_generate_up_and_down_scripts_noTransactions(); + + Assert.Equal( + """ +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`) + ); +; + +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 ('00000000000001_Migration1', '7.0.0-test'); + +ALTER TABLE `Table1` RENAME COLUMN `Foo` TO `Bar`; + +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('00000000000002_Migration2', '7.0.0-test'); + +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('00000000000003_Migration3', '7.0.0-test'); + +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('00000000000004_Migration4', '7.0.0-test'); + +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('00000000000005_Migration5', '7.0.0-test'); + +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('00000000000006_Migration6', '7.0.0-test'); + +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('00000000000007_Migration7', '7.0.0-test'); + +DELETE FROM `__EFMigrationsHistory` +WHERE `MigrationId` = '00000000000007_Migration7'; + +DELETE FROM `__EFMigrationsHistory` +WHERE `MigrationId` = '00000000000006_Migration6'; + +DELETE FROM `__EFMigrationsHistory` +WHERE `MigrationId` = '00000000000005_Migration5'; + +DELETE FROM `__EFMigrationsHistory` +WHERE `MigrationId` = '00000000000004_Migration4'; + +DELETE FROM `__EFMigrationsHistory` +WHERE `MigrationId` = '00000000000003_Migration3'; + +ALTER TABLE `Table1` RENAME COLUMN `Bar` TO `Foo`; + +DELETE FROM `__EFMigrationsHistory` +WHERE `MigrationId` = '00000000000002_Migration2'; + +DROP TABLE `Table1`; + +DELETE FROM `__EFMigrationsHistory` +WHERE `MigrationId` = '00000000000001_Migration1'; + + +""", + Sql, + ignoreLineEndingDifferences: true); + } + + public override async Task Can_generate_one_up_and_down_script() + { + await base.Can_generate_one_up_and_down_script(); + + Assert.Equal( + """ +BEGIN TRANSACTION; +ALTER TABLE `Table1` RENAME COLUMN `Foo` TO `Bar`; + +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('00000000000002_Migration2', '7.0.0-test'); + +COMMIT TRANSACTION; + +BEGIN TRANSACTION; +ALTER TABLE `Table1` RENAME COLUMN `Bar` TO `Foo`; + +DELETE FROM `__EFMigrationsHistory` +WHERE `MigrationId` = '00000000000002_Migration2'; + +COMMIT TRANSACTION; + + +""", + Sql, + ignoreLineEndingDifferences: true); + } + + public override async Task Can_generate_up_and_down_script_using_names() + { + await base.Can_generate_up_and_down_script_using_names(); + + Assert.Equal( + """ +BEGIN TRANSACTION; +ALTER TABLE `Table1` RENAME COLUMN `Foo` TO `Bar`; + +INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`) +VALUES ('00000000000002_Migration2', '7.0.0-test'); + +COMMIT TRANSACTION; + +BEGIN TRANSACTION; +ALTER TABLE `Table1` RENAME COLUMN `Bar` TO `Foo`; + +DELETE FROM `__EFMigrationsHistory` +WHERE `MigrationId` = '00000000000002_Migration2'; + +COMMIT TRANSACTION; + + +""", + Sql, + ignoreLineEndingDifferences: true); + } + + public override async Task Can_generate_idempotent_up_and_down_scripts() + { + await base.Can_generate_idempotent_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]) + ); +END; +GO + +BEGIN TRANSACTION; +IF NOT EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000001_Migration1' +) +BEGIN + CREATE TABLE [Table1] ( + [Id] int NOT NULL, + [Foo] int NOT NULL, + [Description] nvarchar(max) NOT NULL, + CONSTRAINT [PK_Table1] PRIMARY KEY ([Id]) + ); +END; + +IF NOT EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000001_Migration1' +) +BEGIN + INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) + VALUES (N'00000000000001_Migration1', N'7.0.0-test'); +END; + +IF NOT EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000002_Migration2' +) +BEGIN + EXEC sp_rename N'[Table1].[Foo]', N'Bar', 'COLUMN'; +END; + +IF NOT EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000002_Migration2' +) +BEGIN + INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) + VALUES (N'00000000000002_Migration2', N'7.0.0-test'); +END; + +COMMIT; +GO + +BEGIN TRANSACTION; +IF EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000002_Migration2' +) +BEGIN + EXEC sp_rename N'[Table1].[Bar]', N'Foo', 'COLUMN'; +END; + +IF EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000002_Migration2' +) +BEGIN + DELETE FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000002_Migration2'; +END; + +IF EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000001_Migration1' +) +BEGIN + DROP TABLE [Table1]; +END; + +IF EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000001_Migration1' +) +BEGIN + DELETE FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000001_Migration1'; +END; + +COMMIT; +GO + + +""", + Sql, + ignoreLineEndingDifferences: true); + } + + public override async Task Can_generate_idempotent_up_and_down_scripts_noTransactions() + { + await base.Can_generate_idempotent_up_and_down_scripts_noTransactions(); + + 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]) + ); +END; +GO + +IF NOT EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000001_Migration1' +) +BEGIN + CREATE TABLE [Table1] ( + [Id] int NOT NULL, + [Foo] int NOT NULL, + [Description] nvarchar(max) NOT NULL, + CONSTRAINT [PK_Table1] PRIMARY KEY ([Id]) + ); +END; +GO + +IF NOT EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000001_Migration1' +) +BEGIN + INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) + VALUES (N'00000000000001_Migration1', N'7.0.0-test'); +END; +GO + +IF NOT EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000002_Migration2' +) +BEGIN + EXEC sp_rename N'[Table1].[Foo]', N'Bar', 'COLUMN'; +END; +GO + +IF NOT EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000002_Migration2' +) +BEGIN + INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) + VALUES (N'00000000000002_Migration2', N'7.0.0-test'); +END; +GO + +IF EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000002_Migration2' +) +BEGIN + EXEC sp_rename N'[Table1].[Bar]', N'Foo', 'COLUMN'; +END; +GO + +IF EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000002_Migration2' +) +BEGIN + DELETE FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000002_Migration2'; +END; +GO + +IF EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000001_Migration1' +) +BEGIN + DROP TABLE [Table1]; +END; +GO + +IF EXISTS ( + SELECT * FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000001_Migration1' +) +BEGIN + DELETE FROM [__EFMigrationsHistory] + WHERE [MigrationId] = N'00000000000001_Migration1'; +END; +GO + + +""", + Sql, + ignoreLineEndingDifferences: true); + } + public override void Can_get_active_provider() { base.Can_get_active_provider();