Skip to content

Conversation

@benrr101
Copy link
Contributor

Description

In this installment of the SqlCommand merge PRs, we merge the ExecuteNonQuery APIs. This includes adding a partial SqlCommand.NonQuery, merging the ExecuteNonQueryAsyncCallContext subclass and merging the following methods:

  • BeginExecuteNonQuery
  • BeginExecuteNonQueryInternal
  • BeginExecuteNonQueryInternalReadState
  • BeginExecuteNonQueryAsync
  • CleanupAfterExecuteNonQueryAsync
  • EndExecuteNonQuery
  • EndExecuteNonQueryAsync
  • EndExecuteNonQueryInternal
  • ExecuteNonQuery
  • ExecuteNonQueryAsync
  • ExecuteNonQueryAsyncCallCallback
  • InternalEndExecuteNonQuery
  • InternalExecuteNonQuery
  • InternalExecuteNonQueryAsync
  • InternalExecuteNonQueryWithRetry
  • InternalExecuteNonQueryWithRetryAsync
  • RunExecuteNonQueryTds
  • RunExecuteNonQueryTdsSetupReconnectContinuation

I tried my best to avoid functional changes when making stylistic changes. But I can be a bit heavy handed with the stylistic changes from time to time.

Issues

Continuation of work on #1261

Testing

Code still compiles, CI will validate

@benrr101 benrr101 added this to the 7.0-preview2 milestone Sep 23, 2025
@benrr101 benrr101 requested a review from a team as a code owner September 23, 2025 19:19
Copilot AI review requested due to automatic review settings September 23, 2025 19:19
@benrr101 benrr101 added the Common Project 🚮 Things that relate to the common project project label Sep 23, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR merges ExecuteNonQuery-related APIs from platform-specific files into a common shared file as part of the ongoing SqlCommand consolidation effort. It creates a new SqlCommand.NonQuery.cs partial class containing all ExecuteNonQuery methods and removes duplicate code from both .NET Framework and .NET Core implementations.

  • Consolidates ExecuteNonQuery APIs into a single shared implementation
  • Removes platform-specific duplicates from both netfx and netcore files
  • Updates class declaration to be sealed consistently across files

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
SqlCommand.NonQuery.cs New shared partial class containing merged ExecuteNonQuery APIs
SqlCommand.Scalar.cs Updates class to be sealed partial and improves variable naming
SqlCommand.netfx.cs Removes duplicate ExecuteNonQuery implementations moved to shared file
SqlCommand.netcore.cs Removes duplicate ExecuteNonQuery implementations moved to shared file
Microsoft.Data.SqlClient.csproj (netfx) Adds reference to new shared NonQuery partial file
Microsoft.Data.SqlClient.csproj (netcore) Adds reference to new shared NonQuery partial file

@codecov
Copy link

codecov bot commented Sep 23, 2025

Codecov Report

❌ Patch coverage is 84.08644% with 81 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.04%. Comparing base (37d8a3f) to head (f76d171).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...rc/Microsoft/Data/SqlClient/SqlCommand.NonQuery.cs 85.17% 71 Missing ⚠️
...src/Microsoft/Data/SqlClient/SqlCommand.netcore.cs 65.51% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3630      +/-   ##
==========================================
- Coverage   66.13%   66.04%   -0.09%     
==========================================
  Files         276      277       +1     
  Lines       60765    60554     -211     
==========================================
- Hits        40184    39995     -189     
+ Misses      20581    20559      -22     
Flag Coverage Δ
addons 90.82% <ø> (ø)
netcore 68.11% <83.16%> (+0.03%) ⬆️
netfx 69.99% <84.77%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mdaigle mdaigle self-assigned this Sep 23, 2025
@benrr101 benrr101 merged commit aa8bf73 into main Sep 25, 2025
252 checks passed
@benrr101 benrr101 deleted the dev/russellben/merge/sqlcommand-nocer-nonquery branch September 25, 2025 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Common Project 🚮 Things that relate to the common project project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants