Skip to content

Undocumented breaking API changes between 10.0.2 and 10.2.0 (TempTableQuery<T> ctor, IBulkInsertExecutor.BulkInsertAsync) #74

Description

@nealmummau

While upgrading Thinktecture.EntityFrameworkCore.SqlServer from 10.0.2 to 10.2.0, I hit two source-breaking public API changes that don't appear to be called out in the release notes / changelog. Both look intentional and reasonable — I'm filing this so the breaking nature is documented for others doing the upgrade.

Tracing it back, both changes were introduced together in commit feat: add bulk insert/update from query and first shipped in 10.1.0 (not 10.2.0). That feature needs the affected-row count, which is presumably why the count now flows through these two APIs — so this is really about flagging the side effects of that feature as breaking.

1. IBulkInsertExecutor.BulkInsertAsync<T> return type changed (TaskTask<int>)

- Task BulkInsertAsync<T>(IEnumerable<T> entities, IBulkInsertOptions options, CancellationToken ct = default);
+ Task<int> BulkInsertAsync<T>(IEnumerable<T> entities, IBulkInsertOptions options, CancellationToken ct = default);  // returns number of inserted rows

Any custom IBulkInsertExecutor implementation (we have a test fake) no longer satisfies the interface:

'FakeInMemoryBulkInsertExecutor' does not implement interface member 'IBulkInsertExecutor.BulkInsertAsync(...)' ... because it does not have the matching return type of 'Task'

2. TempTableQuery<T> constructor gained a required parameter

The 2-arg constructor was replaced by a 3-arg one (it's a replacement, not an added overload), backed by a new ITempTableQuery<T>.NumberOfInsertedRows property:

- public TempTableQuery(IQueryable<T> query, ITempTableReference tempTableReference)
+ public TempTableQuery(IQueryable<T> query, ITempTableReference tempTableReference, int numberOfInsertedRows)

Code that constructs TempTableQuery<T> directly (e.g. a custom temp-table population helper that fills the table itself and then wraps it) fails to compile:

There is no argument given that corresponds to the required parameter 'numberOfInsertedRows' of 'TempTableQuery.TempTableQuery(IQueryable, ITempTableReference, int)'

Environment

  • Thinktecture.EntityFrameworkCore.SqlServer 10.0.2 → 10.2.0 (changes originate in 10.1.0)
  • .NET 10 / EF Core 10

Request

Could the release/migration notes for 10.1.0 call these out as source-breaking changes? Specifically:

  • IBulkInsertExecutor.BulkInsertAsync now returns Task<int> — breaks custom implementations.
  • The TempTableQuery<T> 2-arg constructor was replaced by a 3-arg one requiring numberOfInsertedRows — breaks direct constructor calls.

And, if it's the intended public path, a short pointer on how a caller that populates a temp table itself should obtain the numberOfInsertedRows value to pass to the constructor (e.g. from the affected-row count of the insert command).

Thanks for the library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions