From 80334750320e9bce8b9277ec0b44093643e82e40 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Fri, 4 Oct 2024 00:32:09 +0800 Subject: [PATCH] Sync to an RC2 build (#265) * RC2 History Repo * return the right ValueGenerated if it is mapped to json * Since Jet doesn't do anything for GO we don't need to do anything like Sql server does * Update the HistoryRepository * Remove unused tests * [GitHub Actions] Update green tests. --------- Co-authored-by: github-actions --- Dependencies.targets | 6 +- .../JetSchemaOperationsHandling.cs | 5 +- .../JetServiceCollectionExtensions.cs | 1 + .../JetValueGeneratorConvention.cs | 9 ++ .../Internal/JetHistoryRepository.cs | 61 +++++-------- .../Internal/JetMigrationCommandExecutor.cs | 85 +++++++++++++++++++ .../Internal/JetMigrationDatabaseLock.cs | 37 +++++++- .../Migrations/JetMigrationsSqlGenerator.cs | 50 +---------- .../GreenTests/ace_2010_odbc_x86.txt | 7 +- .../GreenTests/ace_2010_oledb_x86.txt | 7 +- .../JetMigrationsSqlGeneratorTest.cs | 61 ------------- .../MigrationsInfrastructureJetTest.cs | 6 +- 12 files changed, 168 insertions(+), 167 deletions(-) create mode 100644 src/EFCore.Jet/Migrations/Internal/JetMigrationCommandExecutor.cs diff --git a/Dependencies.targets b/Dependencies.targets index 83dbda20..2b43d26d 100644 --- a/Dependencies.targets +++ b/Dependencies.targets @@ -1,8 +1,8 @@ [9.0.100-rc.1.24452.12,9.0.999] - [9.0.0-rc.1.24451.1,9.0.999] - [9.0.0-rc.1.24431.7,9.0.999] + [9.0.0-rc.2.24460.3,9.0.999] + [9.0.0-rc.2.24456.9,9.0.999] @@ -26,7 +26,7 @@ - + diff --git a/src/EFCore.Jet.Data/JetStoreSchemaDefinition/JetSchemaOperationsHandling.cs b/src/EFCore.Jet.Data/JetStoreSchemaDefinition/JetSchemaOperationsHandling.cs index 7aeddfaa..0b8ce6ca 100644 --- a/src/EFCore.Jet.Data/JetStoreSchemaDefinition/JetSchemaOperationsHandling.cs +++ b/src/EFCore.Jet.Data/JetStoreSchemaDefinition/JetSchemaOperationsHandling.cs @@ -2,7 +2,7 @@ namespace EntityFrameworkCore.Jet.Data.JetStoreSchemaDefinition { - internal static class JetSchemaOperationsHandling + public static class JetSchemaOperationsHandling { private static readonly Regex _renameTableRegex = new Regex( $@"^\s*alter\s+table\s+{GetIdentifierPattern("OldTableName")}\s+rename\s+to\s+{GetIdentifierPattern("NewTableName")}\s*$", @@ -12,6 +12,9 @@ internal static class JetSchemaOperationsHandling $@"^\s*alter\s+table\s+{GetIdentifierPattern("TableName")}\s+rename\s+column\s+{GetIdentifierPattern("OldColumnName")}\s+to\s+{GetIdentifierPattern("NewColumnName")}\s*$", RegexOptions.IgnoreCase); + public static bool IsDatabaseOperation(string commandText) + => _renameTableRegex.IsMatch(commandText) || _renameTableColumnRegex.IsMatch(commandText); + public static bool TryDatabaseOperation(JetConnection connection, string commandText) { var match = _renameTableRegex.Match(commandText); diff --git a/src/EFCore.Jet/Extensions/JetServiceCollectionExtensions.cs b/src/EFCore.Jet/Extensions/JetServiceCollectionExtensions.cs index 4fb71d20..de93ac24 100644 --- a/src/EFCore.Jet/Extensions/JetServiceCollectionExtensions.cs +++ b/src/EFCore.Jet/Extensions/JetServiceCollectionExtensions.cs @@ -52,6 +52,7 @@ public static IServiceCollection AddEntityFrameworkJet([NotNull] this IServiceCo .TryAdd(p => p.GetRequiredService()) .TryAdd() .TryAdd() + .TryAdd() .TryAdd() .TryAdd() .TryAdd() diff --git a/src/EFCore.Jet/Metadata/Conventions/JetValueGeneratorConvention.cs b/src/EFCore.Jet/Metadata/Conventions/JetValueGeneratorConvention.cs index 36fc4356..d5724977 100644 --- a/src/EFCore.Jet/Metadata/Conventions/JetValueGeneratorConvention.cs +++ b/src/EFCore.Jet/Metadata/Conventions/JetValueGeneratorConvention.cs @@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; using System.Linq; +using Microsoft.EntityFrameworkCore.Metadata.Internal; // ReSharper disable once CheckNamespace namespace Microsoft.EntityFrameworkCore.Metadata.Conventions @@ -61,6 +62,14 @@ public override void ProcessPropertyAnnotationChanged( /// The store value generation strategy to set for the given property. protected override ValueGenerated? GetValueGenerated(IConventionProperty property) { + if (property.DeclaringType.IsMappedToJson() +#pragma warning disable EF1001 // Internal EF Core API usage. + && property.IsOrdinalKeyProperty() +#pragma warning restore EF1001 // Internal EF Core API usage. + && (property.DeclaringType as IReadOnlyEntityType)?.FindOwnership()!.IsUnique == false) + { + return ValueGenerated.OnAdd; + } var declaringTable = property.GetMappedStoreObjects(StoreObjectType.Table).FirstOrDefault(); if (declaringTable.Name == null) { diff --git a/src/EFCore.Jet/Migrations/Internal/JetHistoryRepository.cs b/src/EFCore.Jet/Migrations/Internal/JetHistoryRepository.cs index 0e060329..3638eb03 100644 --- a/src/EFCore.Jet/Migrations/Internal/JetHistoryRepository.cs +++ b/src/EFCore.Jet/Migrations/Internal/JetHistoryRepository.cs @@ -34,7 +34,7 @@ namespace EntityFrameworkCore.Jet.Migrations.Internal public class JetHistoryRepository : HistoryRepository { private static readonly TimeSpan _retryDelay = TimeSpan.FromSeconds(1); - + public override LockReleaseBehavior LockReleaseBehavior => LockReleaseBehavior.Explicit; /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in @@ -128,18 +128,21 @@ public override string GetDeleteScript(string migrationId) .ToString(); } - public override IDisposable GetDatabaseLock() + public override IMigrationsDatabaseLock AcquireDatabaseLock() { - if (!InterpretExistsResult(Dependencies.RawSqlCommandBuilder.Build(CreateExistsSql(LockTableName)) - .ExecuteScalar(CreateRelationalCommandParameters()))) + Dependencies.MigrationsLogger.AcquiringMigrationLock(); + + if (!InterpretExistsResult( + Dependencies.RawSqlCommandBuilder.Build(CreateExistsSql(LockTableName)) + .ExecuteScalar(CreateRelationalCommandParameters()))) { try { CreateLockTableCommand().ExecuteNonQuery(CreateRelationalCommandParameters()); } - catch (DbException) + catch (DbException e) { - //if (!e.Message.Contains("already exists")) throw; + if (!e.Message.Contains("already exists")) throw; } } @@ -152,11 +155,11 @@ public override IDisposable GetDatabaseLock() try { insertCount = (int?)CreateInsertLockCommand(DateTimeOffset.UtcNow) - .ExecuteScalar(CreateRelationalCommandParameters()); + .ExecuteScalar(CreateRelationalCommandParameters()); } - catch (DbException) + catch (DbException e) { - //if (!e.Message.Contains("duplicate")) throw; + if (!e.Message.Contains("duplicate")) throw; } if ((int)insertCount! == 1) { @@ -169,44 +172,28 @@ public override IDisposable GetDatabaseLock() retryDelay = retryDelay.Add(retryDelay); } } - - throw new TimeoutException(); } - public override async Task GetDatabaseLockAsync(CancellationToken cancellationToken = new CancellationToken()) + public override async Task AcquireDatabaseLockAsync( + CancellationToken cancellationToken = default) { - if (!InterpretExistsResult(await Dependencies.RawSqlCommandBuilder.Build(CreateExistsSql(LockTableName)) - .ExecuteScalarAsync(CreateRelationalCommandParameters(), cancellationToken).ConfigureAwait(false))) + Dependencies.MigrationsLogger.AcquiringMigrationLock(); + + if (!InterpretExistsResult( + await Dependencies.RawSqlCommandBuilder.Build(CreateExistsSql(LockTableName)) + .ExecuteScalarAsync(CreateRelationalCommandParameters(), cancellationToken).ConfigureAwait(false))) { - //No CREATE TABLE IF EXISTS in Jet. We try a normal CREATE TABLE and catch the exception if it already exists - try - { - await CreateLockTableCommand() - .ExecuteNonQueryAsync(CreateRelationalCommandParameters(), cancellationToken) - .ConfigureAwait(false); - } - catch (DbException) - { - //if (!e.Message.Contains("already exists")) throw; - } + await CreateLockTableCommand().ExecuteNonQueryAsync(CreateRelationalCommandParameters(), cancellationToken) + .ConfigureAwait(false); } var retryDelay = _retryDelay; while (true) { var dbLock = CreateMigrationDatabaseLock(); - int? insertCount = 0; - try - { - insertCount = (int?)await CreateInsertLockCommand(DateTimeOffset.UtcNow) + var insertCount = await CreateInsertLockCommand(DateTimeOffset.UtcNow) .ExecuteScalarAsync(CreateRelationalCommandParameters(), cancellationToken) .ConfigureAwait(false); - - } - catch (DbException) - { - //if (!e.Message.Contains("duplicate")) throw; - } if ((int)insertCount! == 1) { return dbLock; @@ -218,8 +205,6 @@ await CreateLockTableCommand() retryDelay = retryDelay.Add(retryDelay); } } - - throw new TimeoutException(); } private IRelationalCommand CreateLockTableCommand() @@ -254,7 +239,7 @@ DELETE FROM `{LockTableName}` } private JetMigrationDatabaseLock CreateMigrationDatabaseLock() - => new(CreateDeleteLockCommand(), CreateRelationalCommandParameters()); + => new(CreateDeleteLockCommand(), CreateRelationalCommandParameters(), this); private RelationalCommandParameterObject CreateRelationalCommandParameters() => new( diff --git a/src/EFCore.Jet/Migrations/Internal/JetMigrationCommandExecutor.cs b/src/EFCore.Jet/Migrations/Internal/JetMigrationCommandExecutor.cs new file mode 100644 index 00000000..07dbf56e --- /dev/null +++ b/src/EFCore.Jet/Migrations/Internal/JetMigrationCommandExecutor.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore.Diagnostics; +using Microsoft.EntityFrameworkCore.Migrations; +using System.Transactions; +using EntityFrameworkCore.Jet.Data.JetStoreSchemaDefinition; +using Microsoft.EntityFrameworkCore.Migrations.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +namespace EntityFrameworkCore.Jet.Migrations.Internal +{ + public class JetMigrationCommandExecutor(IExecutionStrategy executionStrategy) : MigrationCommandExecutor(executionStrategy) + { + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public override int ExecuteNonQuery( + IReadOnlyList migrationCommands, + IRelationalConnection connection, + MigrationExecutionState executionState, + bool commitTransaction, + System.Data.IsolationLevel? isolationLevel = null) + { + var batches = CreateMigrationBatches(migrationCommands); + foreach (var batch in batches) + { + base.ExecuteNonQuery(batch, connection, executionState, true, isolationLevel); + } + + return -1; + } + + public override async Task ExecuteNonQueryAsync( + IReadOnlyList migrationCommands, + IRelationalConnection connection, + MigrationExecutionState executionState, + bool commitTransaction, + System.Data.IsolationLevel? isolationLevel = null, + CancellationToken cancellationToken = default) + { + var batches = CreateMigrationBatches(migrationCommands); + foreach (var batch in batches) + { + await base.ExecuteNonQueryAsync(batch, connection, executionState, true, isolationLevel, cancellationToken); + } + + return -1; + } + + List> CreateMigrationBatches(IReadOnlyList migrationCommands) + { + //create new batch if JetSchemaOperationsHandling.IsDatabaseOperation is true otherwise had to current batch + var migrationBatches = new List>(); + var currentBatch = new List(); + foreach (var migrationCommand in migrationCommands) + { + if (JetSchemaOperationsHandling.IsDatabaseOperation(migrationCommand.CommandText)) + { + if (currentBatch.Any()) + { + migrationBatches.Add(currentBatch); + currentBatch = new List(); + } + migrationBatches.Add(new List { migrationCommand }); + } + else + { + currentBatch.Add(migrationCommand); + } + } + if (currentBatch.Any()) + { + migrationBatches.Add(currentBatch); + } + return migrationBatches; + } + } +} diff --git a/src/EFCore.Jet/Migrations/Internal/JetMigrationDatabaseLock.cs b/src/EFCore.Jet/Migrations/Internal/JetMigrationDatabaseLock.cs index b0c4755c..1cff30d7 100644 --- a/src/EFCore.Jet/Migrations/Internal/JetMigrationDatabaseLock.cs +++ b/src/EFCore.Jet/Migrations/Internal/JetMigrationDatabaseLock.cs @@ -2,8 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Data.Common; using System.Threading; using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage; namespace EntityFrameworkCore.Jet.Migrations.Internal; @@ -15,11 +17,20 @@ namespace EntityFrameworkCore.Jet.Migrations.Internal; /// doing so can result in application failures when updating to a new Entity Framework Core release. /// public class JetMigrationDatabaseLock( - IRelationalCommand relationalCommand, + IRelationalCommand releaseLockCommand, RelationalCommandParameterObject relationalCommandParameters, + IHistoryRepository historyRepository, CancellationToken cancellationToken = default) - : IDisposable, IAsyncDisposable + : IMigrationsDatabaseLock { + /// + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// + public virtual IHistoryRepository HistoryRepository => historyRepository; + /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in @@ -27,7 +38,16 @@ public class JetMigrationDatabaseLock( /// doing so can result in application failures when updating to a new Entity Framework Core release. /// public void Dispose() - => relationalCommand.ExecuteScalar(relationalCommandParameters); + { + try + { + releaseLockCommand.ExecuteScalar(relationalCommandParameters); + } + catch (DbException e) + { + if (!e.Message.Contains("cannot find the input table")) throw; + } + } /// /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to @@ -36,5 +56,14 @@ public void Dispose() /// doing so can result in application failures when updating to a new Entity Framework Core release. /// public async ValueTask DisposeAsync() - => await relationalCommand.ExecuteScalarAsync(relationalCommandParameters, cancellationToken).ConfigureAwait(false); + { + try + { + await releaseLockCommand.ExecuteScalarAsync(relationalCommandParameters, cancellationToken); + } + catch (DbException e) + { + if (!e.Message.Contains("cannot find the input table")) throw; + } + } } diff --git a/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs b/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs index b88acd31..280316e0 100644 --- a/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs +++ b/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs @@ -781,55 +781,9 @@ protected override void Generate( /// The command builder to use to build the commands. protected override void Generate(SqlOperation operation, IModel? model, MigrationCommandListBuilder builder) { - // TODO: Jet does not support batches and should never generate a "GO" in the first place. - // So this code should do nothing. - - var batches = Regex.Split( - Regex.Replace( - operation.Sql, - @"\\\r?\n", - string.Empty, - default(RegexOptions), - TimeSpan.FromMilliseconds(1000.0)), - @"^\s*(GO[ \t]+[0-9]+|GO)(?:\s+|$)", - RegexOptions.IgnoreCase | RegexOptions.Multiline, - TimeSpan.FromMilliseconds(1000.0)); - for (var i = 0; i < batches.Length; i++) - { - if (batches[i] - .StartsWith("GO", StringComparison.OrdinalIgnoreCase) - || string.IsNullOrWhiteSpace(batches[i])) - { - continue; - } - - var count = 1; - if (i != batches.Length - 1 - && batches[i + 1] - .StartsWith("GO", StringComparison.OrdinalIgnoreCase)) - { - var match = Regex.Match( - batches[i + 1], "([0-9]+)", - default(RegexOptions), - TimeSpan.FromMilliseconds(1000.0)); - if (match.Success) - { - count = int.Parse(match.Value); - } - } - - for (var j = 0; j < count; j++) - { - builder.Append(batches[i]); + builder.AppendLine(operation.Sql); - if (i == batches.Length - 1) - { - builder.AppendLine(); - } - - EndStatement(builder, operation.SuppressTransaction); - } - } + EndStatement(builder, operation.SuppressTransaction); } protected override void Generate( 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 2c9be180..d6dff24c 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_odbc_x86.txt @@ -2784,11 +2784,6 @@ EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.RenameInde EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.RenameTableOperation EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.RenameTableOperation_legacy EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.SqlOperation -EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.SqlOperation_handles_backslash -EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.SqlOperation_handles_go -EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.SqlOperation_handles_go_with_count -EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.SqlOperation_ignores_non_go -EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.SqlOperation_ignores_sequential_gos EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.UpdateDataOperation_all_args EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.UpdateDataOperation_all_args_composite EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.UpdateDataOperation_all_args_composite_multi @@ -8996,6 +8991,7 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Can_configure_ownership_foreign_key EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Can_configure_property_and_owned_entity_of_same_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Can_configure_relationship_with_PK_ValueConverter +EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Can_configure_relationship_with_PK_ValueConverter_shadow_FK EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Can_configure_self_ownership EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Can_configure_single_owned_type_using_attribute EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Can_map_base_of_owned_type @@ -9723,6 +9719,7 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Can_configure_ownership_foreign_key EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Can_configure_property_and_owned_entity_of_same_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Can_configure_relationship_with_PK_ValueConverter +EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Can_configure_relationship_with_PK_ValueConverter_shadow_FK EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Can_configure_self_ownership EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Can_configure_single_owned_type_using_attribute EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Can_map_base_of_owned_type 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 159f72e8..0d001863 100644 --- a/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt +++ b/test/EFCore.Jet.FunctionalTests/GreenTests/ace_2010_oledb_x86.txt @@ -2856,11 +2856,6 @@ EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.RenameInde EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.RenameTableOperation EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.RenameTableOperation_legacy EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.SqlOperation -EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.SqlOperation_handles_backslash -EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.SqlOperation_handles_go -EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.SqlOperation_handles_go_with_count -EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.SqlOperation_ignores_non_go -EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.SqlOperation_ignores_sequential_gos EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.UpdateDataOperation_all_args EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.UpdateDataOperation_all_args_composite EntityFrameworkCore.Jet.FunctionalTests.JetMigrationsSqlGeneratorTest.UpdateDataOperation_all_args_composite_multi @@ -9068,6 +9063,7 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Can_configure_ownership_foreign_key EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Can_configure_property_and_owned_entity_of_same_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Can_configure_relationship_with_PK_ValueConverter +EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Can_configure_relationship_with_PK_ValueConverter_shadow_FK EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Can_configure_self_ownership EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Can_configure_single_owned_type_using_attribute EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderGenericTest+JetGenericOwnedTypes.Can_map_base_of_owned_type @@ -9795,6 +9791,7 @@ EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericT EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Can_configure_ownership_foreign_key EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Can_configure_property_and_owned_entity_of_same_type EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Can_configure_relationship_with_PK_ValueConverter +EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Can_configure_relationship_with_PK_ValueConverter_shadow_FK EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Can_configure_self_ownership EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Can_configure_single_owned_type_using_attribute EntityFrameworkCore.Jet.FunctionalTests.ModelBuilding.JetModelBuilderNonGenericTest+JetNonGenericOwnedTypes.Can_map_base_of_owned_type diff --git a/test/EFCore.Jet.FunctionalTests/JetMigrationsSqlGeneratorTest.cs b/test/EFCore.Jet.FunctionalTests/JetMigrationsSqlGeneratorTest.cs index 9f902b98..7136257a 100644 --- a/test/EFCore.Jet.FunctionalTests/JetMigrationsSqlGeneratorTest.cs +++ b/test/EFCore.Jet.FunctionalTests/JetMigrationsSqlGeneratorTest.cs @@ -538,67 +538,6 @@ public override void RenameTableOperation() "); } - [ConditionalFact] - public virtual void SqlOperation_handles_backslash() - { - Generate( - new SqlOperation { Sql = @"-- Multiline \" + EOL + "comment" }); - - AssertSql( - @"-- Multiline comment -"); - } - - [ConditionalFact] - public virtual void SqlOperation_ignores_sequential_gos() - { - Generate( - new SqlOperation { Sql = "-- Ready set" + EOL + "GO" + EOL + "GO" }); - - AssertSql( - @"-- Ready set -"); - } - - [ConditionalFact] - public virtual void SqlOperation_handles_go() - { - Generate( - new SqlOperation { Sql = "-- I" + EOL + "go" + EOL + "-- Too" }); - - AssertSql( - @"-- I -GO - --- Too -"); - } - - [ConditionalFact] - public virtual void SqlOperation_handles_go_with_count() - { - Generate( - new SqlOperation { Sql = "-- I" + EOL + "GO 2" }); - - AssertSql( - @"-- I -GO - --- I -"); - } - - [ConditionalFact] - public virtual void SqlOperation_ignores_non_go() - { - Generate( - new SqlOperation { Sql = "-- I GO 2" }); - - AssertSql( - @"-- I GO 2 -"); - } - public override void SqlOperation() { base.SqlOperation(); diff --git a/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsInfrastructureJetTest.cs b/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsInfrastructureJetTest.cs index 418c8414..5682eb85 100644 --- a/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsInfrastructureJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Migrations/MigrationsInfrastructureJetTest.cs @@ -115,6 +115,8 @@ Value With INSERT INTO Table1 (Id, Bar, Description) VALUES (-3, 5, 'GO Value With +GO + Empty Lines GO') @@ -296,10 +298,10 @@ public async Task Empty_Migration_Creates_Database() } public override void Can_apply_all_migrations() // Issue efcore #33331 - => Assert.ThrowsAny(() => base.Can_apply_all_migrations()); + => base.Can_apply_all_migrations(); public override Task Can_apply_all_migrations_async() // Issue efcore #33331 - => Assert.ThrowsAnyAsync(() => base.Can_apply_all_migrations_async()); + => base.Can_apply_all_migrations_async(); [ConditionalFact(Skip ="For now")] public override void Can_apply_one_migration_in_parallel()