Skip to content

Add TempTableOptions with a TableNameProvider to the MySQL bulk update and upsert options - #80

Merged
PawelGerr merged 1 commit into
PawelGerr:releases/10.0.xfrom
pengweiqhca:fix/mysql-staging-table-name-provider
Dec 4, 2026
Merged

PawelGerr merged 1 commit into
PawelGerr:releases/10.0.xfrom
pengweiqhca:fix/mysql-staging-table-name-provider

Conversation

@pengweiqhca

Copy link
Copy Markdown
Contributor

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.

…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.
Copilot AI balanced review requested due to automatic review settings December 3, 2026 08:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.TableNameProvider in 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
@PawelGerr
PawelGerr merged commit e36bc3e into PawelGerr:releases/10.0.x Dec 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants