Skip to content

Conversation

benrr101
Copy link
Contributor

Description

The SqlBuffer class has a netfx-specific partial with two methods in it. We can easily add them to the common project SqlBuffer class and remove the netfx partial. That is exactly what this PR does.

Issues

Assists with #1261

Testing

Project still builds, no changes to the functionality of the code at all.

@benrr101 benrr101 added this to the 6.1-preview2 milestone May 20, 2025
@Copilot Copilot AI review requested due to automatic review settings May 20, 2025 23:07
@benrr101 benrr101 added the Common Project 🚮 Things that relate to the common project project label May 20, 2025
@benrr101 benrr101 requested a review from a team as a code owner May 20, 2025 23:07
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 merges two .NET Framework–specific methods (SetToDate and SetToDateTime2) into the common SqlBuffer class and removes the separate NetFX partial file and its csproj include, reducing code duplication.

  • Converted internal sealed partial class SqlBuffer to a single class and added #if NETFRAMEWORK guards around the two date methods.
  • Deleted SqlBuffer.netfx.cs and removed its compile entry from the NetFX project file.
  • No behavioral changes; class still builds under all TFMs.

Reviewed Changes

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

File Description
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBuffer.cs Removed partial keyword, inlined NetFX methods with #if NETFRAMEWORK
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlBuffer.netfx.cs Deleted redundant NetFX partial file
src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj Removed <Compile Include="SqlBuffer.netfx.cs" />
Comments suppressed due to low confidence (2)

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBuffer.cs:1262

  • These new methods lack direct unit tests—add tests to verify that SetToDate and SetToDateTime2 correctly set internal fields for various inputs.
internal void SetToDateTime2(DateTime dateTime, byte scale)

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBuffer.cs:1242

  • [nitpick] Consider adding XML doc comments to explain what SetToDate does and any expectations (e.g., valid date range).
internal void SetToDate(DateTime date)

Copy link

codecov bot commented May 22, 2025

Codecov Report

Attention: Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.

Project coverage is 67.08%. Comparing base (b8948f2) to head (4d9843c).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...qlClient/src/Microsoft/Data/SqlClient/SqlBuffer.cs 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3368      +/-   ##
==========================================
+ Coverage   67.04%   67.08%   +0.04%     
==========================================
  Files         300      299       -1     
  Lines       65376    65376              
==========================================
+ Hits        43831    43860      +29     
+ Misses      21545    21516      -29     
Flag Coverage Δ
addons 92.58% <ø> (ø)
netcore 72.21% <ø> (+0.02%) ⬆️
netfx 65.23% <0.00%> (+0.04%) ⬆️

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.

@benrr101 benrr101 merged commit 9ef7f78 into main May 23, 2025
251 checks passed
@benrr101 benrr101 deleted the dev/russellben/merge/sqlbuffer branch May 23, 2025 16:18
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