Skip to content

Conversation

benrr101
Copy link
Contributor

@benrr101 benrr101 commented Oct 3, 2025

Description

At this stage of the merge of SqlCommand, I'm more/less in mop-up mode. There's less obvious lines that can be drawn around code to put into partials. This PR focuses on the remaining public (and protected) methods in SqlCommand. As with all the other PRs in this series, each commit is bitesized and focuses on a single or a couple related methods at a time.

The following methods were merged in this PR:

  • SqlCommand constructors

  • Cancel

  • Clone

  • CrreateDbParameter

  • CreateParameter

  • Dispose

  • OnDone

  • OnDoneDescribeParameterEncryptionProc

  • OnDoneProc

  • OnReturnStatus

  • OnReturnValue

  • RegisterColumnEncryptionKeyStoreProvidersOnCommand

  • ResetCommandTimeout (I made a mistake and it isn't added to netfx until the very end)

  • GetSqlParameterWithQueryText - removed as it was no longer being used

Issues

Continuation of work in #1261

Testing

Build passes, SqlCommandTests pass locally. CI should validate the rest of it.

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

@Copilot 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 consolidates SqlCommand public methods from platform-specific files into the shared SqlCommand.cs file. The changes merge constructors, Cancel, Clone, CreateParameter, CreateDbParameter, Dispose, and various internal methods (OnDone*, OnReturn*, RegisterColumnEncryptionKeyStoreProvidersOnCommand, etc.) to eliminate code duplication between .NET Framework and .NET Core implementations.

Key changes:

  • Consolidated all SqlCommand constructors into shared code
  • Merged public methods like Cancel, Clone, CreateParameter, Dispose
  • Unified internal methods for handling TDS protocol events
  • Removed unused GetSqlParameterWithQueryText method

Reviewed Changes

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

Show a summary per file
File Description
SqlCommand.cs Added consolidated constructors, public methods (Cancel, Clone, CreateParameter, Dispose), and internal event handlers (OnDone*, OnReturn*)
SqlCommand.netfx.cs Removed duplicate constructors and methods that were moved to shared file; cleaned up unused imports
SqlCommand.netcore.cs Removed duplicate constructors and methods that were moved to shared file; cleaned up unused imports
TdsParserHelperClasses.cs Added TODO comment for SqlReturnValue property improvements
SqlQueryMetadataCache.cs Added TODO comment to replace GetInstance method with Instance property

Copy link

codecov bot commented Oct 3, 2025

Codecov Report

❌ Patch coverage is 86.04651% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.36%. Comparing base (b555adf) to head (554cbe2).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...lClient/src/Microsoft/Data/SqlClient/SqlCommand.cs 86.04% 30 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3655       +/-   ##
===========================================
- Coverage   90.82%   77.36%   -13.46%     
===========================================
  Files           6      274      +268     
  Lines         316    45556    +45240     
===========================================
+ Hits          287    35246    +34959     
- Misses         29    10310    +10281     
Flag Coverage Δ
addons 90.82% <ø> (ø)
netcore 77.25% <86.04%> (?)
netfx 76.54% <85.98%> (?)

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.

@paulmedynski paulmedynski self-assigned this Oct 8, 2025
@benrr101 benrr101 merged commit be62e90 into main Oct 8, 2025
252 checks passed
@benrr101 benrr101 deleted the dev/russellben/merge/sqlcommand-nocer-publicmethods branch October 8, 2025 20:01
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.

3 participants