-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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 <[email protected]>
- Loading branch information
1 parent
b64c1d5
commit 8033475
Showing
12 changed files
with
168 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
src/EFCore.Jet/Migrations/Internal/JetMigrationCommandExecutor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
{ | ||
/// <summary> | ||
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to | ||
/// the same compatibility standards as public APIs. It may be changed or removed without notice in | ||
/// any release. You should only use it directly in your code with extreme caution and knowing that | ||
/// doing so can result in application failures when updating to a new Entity Framework Core release. | ||
/// </summary> | ||
public override int ExecuteNonQuery( | ||
IReadOnlyList<MigrationCommand> 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<int> ExecuteNonQueryAsync( | ||
IReadOnlyList<MigrationCommand> 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<IReadOnlyList<MigrationCommand>> CreateMigrationBatches(IReadOnlyList<MigrationCommand> migrationCommands) | ||
{ | ||
//create new batch if JetSchemaOperationsHandling.IsDatabaseOperation is true otherwise had to current batch | ||
var migrationBatches = new List<IReadOnlyList<MigrationCommand>>(); | ||
var currentBatch = new List<MigrationCommand>(); | ||
foreach (var migrationCommand in migrationCommands) | ||
{ | ||
if (JetSchemaOperationsHandling.IsDatabaseOperation(migrationCommand.CommandText)) | ||
{ | ||
if (currentBatch.Any()) | ||
{ | ||
migrationBatches.Add(currentBatch); | ||
currentBatch = new List<MigrationCommand>(); | ||
} | ||
migrationBatches.Add(new List<MigrationCommand> { migrationCommand }); | ||
} | ||
else | ||
{ | ||
currentBatch.Add(migrationCommand); | ||
} | ||
} | ||
if (currentBatch.Any()) | ||
{ | ||
migrationBatches.Add(currentBatch); | ||
} | ||
return migrationBatches; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.