Repository navigation
Add TempTableOptions with a TableNameProvider to the MySQL bulk update and upsert options - #80
Merged
PawelGerr merged 1 commit intoDec 4, 2026
Conversation
…e and upsert options The staging temp table of MySqlBulkUpdateOptions and MySqlBulkInsertOrUpdateOptions was always named by the ReusingTempTableNameProvider, which derives the name from the table of the entity. TableNameProvider of the options redirects the target table only, so a name that must not be used for a table, for example one that still contains a placeholder which is replaced for the target table only, failed with error 1146 on the first statement that referenced the staging table. The SQL Server and PostgreSQL options already expose the provider through TempTableOptions. MySqlBulkOperationTempTableOptions carries the ITempTableNameProvider. The executor leases the staging table name from it and falls back to the ReusingTempTableNameProvider when it is not set, so the default behaviour is unchanged. The provider is copied when options are initialized from another MySqlBulkUpdateOptions or MySqlBulkInsertOrUpdateOptions.
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the configurable MySQL staging-table naming change.
No open issues 🎉
What changed in this PR
Adds configurable staging-table names for MySQL bulk update and upsert operations, independently of target-table naming and without changing default behavior.
Changes:
- Exposes and copies
TempTableOptions.TableNameProviderin both operation options. - Uses the configured provider for staging-name leases, retaining the existing fallback.
- Adds tests for custom names, lease disposal, and option copying.
| File | Description |
|---|---|
tests/Thinktecture.EntityFrameworkCore.MySql.Tests/EntityFrameworkCore/BulkOperations/MySqlBulkOperationExecutorTests/RecordingTempTableNameProvider.cs |
Adds a provider that records lease creation and disposal. |
tests/Thinktecture.EntityFrameworkCore.MySql.Tests/EntityFrameworkCore/BulkOperations/MySqlBulkOperationExecutorTests/BulkUpdateAsync.cs |
Tests custom update staging names and option copying. |
tests/Thinktecture.EntityFrameworkCore.MySql.Tests/EntityFrameworkCore/BulkOperations/MySqlBulkOperationExecutorTests/BulkInsertOrUpdateAsync.cs |
Tests custom upsert staging names and option copying. |
src/Thinktecture.EntityFrameworkCore.MySql/EntityFrameworkCore/BulkOperations/MySqlBulkUpdateOptions.cs |
Exposes and copies staging-table options. |
src/Thinktecture.EntityFrameworkCore.MySql/EntityFrameworkCore/BulkOperations/MySqlBulkOperationTempTableOptions.cs |
Defines and documents the staging-name provider option. |
src/Thinktecture.EntityFrameworkCore.MySql/EntityFrameworkCore/BulkOperations/MySqlBulkOperationExecutor.cs |
Leases staging names through the configured provider or default. |
src/Thinktecture.EntityFrameworkCore.MySql/EntityFrameworkCore/BulkOperations/MySqlBulkInsertOrUpdateOptions.cs |
Exposes and copies staging-table options. |
Review effort: Balanced
PawelGerr
added a commit
that referenced
this pull request
Dec 4, 2026
…provider: add TempTableOptions with a TableNameProvider to the MySQL bulk update and upsert options
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The staging temp table of MySqlBulkUpdateOptions and MySqlBulkInsertOrUpdateOptions was always named by the ReusingTempTableNameProvider, which derives the name from the table of the entity. TableNameProvider of the options redirects the target table only, so a name that must not be used for a table, for example one that still contains a placeholder which is replaced for the target table only, failed with error 1146 on the first statement that referenced the staging table. The SQL Server and PostgreSQL options already expose the provider through TempTableOptions.
MySqlBulkOperationTempTableOptions carries the ITempTableNameProvider. The executor leases the staging table name from it and falls back to the ReusingTempTableNameProvider when it is not set, so the default behaviour is unchanged. The provider is copied when options are initialized from another MySqlBulkUpdateOptions or MySqlBulkInsertOrUpdateOptions.