Skip to content

Conversation

@edwardneal
Copy link
Contributor

Description

This is perhaps only tangentially related to merging the netfx and netcore projects, but it merges functionality.

The SQL client driver has had support for server-side batching of SQL statements for a long time, starting with SqlCommandSet. The introduction of the DbBatch abstraction in netcore provided an opportunity to expose this using SqlBatch types in #1825 and #2223.

Although the goal in the original PR was to expose these APIs to both netcore and netfx, at this stage we were still building all of SqlClient using netstandard2.0. This generated various build issues, so the types weren't included.

Since we're now only building the ref assemblies using netstandard2.0, we can port (most of) the SqlBatch surface area to netfx. This harmonises more of the API surface between targets. It also means that in the future, we'll be able to remove the internal SqlCommandSet type, since this duplicates the SqlBatch functionality.

There are now five APIs which were already present present in netcore, but which I haven't ported to netfx. This is because they have a return type of DbBatch* types. Changing them to expose SqlBatch* types will be a breaking change on netcore, and if the method has a different return type in netcore to netfx/netstandard2.0, client applications referencing intermediary netstandard2.0-based libraries won't be able to bind to the method. I don't think this is a problem - the APIs aren't necessary to use SqlBatch functionality.

These APIs are:

  • SqlClientFactory.CanCreateBatch
  • SqlClientFactory.CreateBatch
  • SqlClientFactory.CreateBatchCommand
  • SqlConnection.CanCreateBatch
  • SqlConnection.CreateBatch

Issues

None.

Testing

I've enabled the batching tests on both netcore and netfx. Both pass.

APIs not exposed:
* SqlClientFactory.CanCreateBatch
* SqlClientFactory.CreateBatch
* SqlClientFactory.CreateBatchCommand
* SqlConnection.CanCreateBatch
* SqlConnection.CreateBatch
@edwardneal edwardneal requested a review from a team as a code owner February 2, 2026 06:20
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.

1 participant