Skip to content

Conversation

@edwardneal
Copy link
Contributor

Description

The SqlTypes namespace has had its own SQLResource class since its inception, sat alongside the existing Strings, StringsHelper, SQL and SQLMessage classes. This only had fields referring to twenty resource strings, and only four of these fields were used. I've removed the unused fields and moved the used references to the existing locations.

Besides a modest code cleanup, this also clears the way for a broader point: we've got several hundred resource strings in the library which aren't used. Based on their contents, I think they were pulled in during the split from System.Data for the initial upload. Once everyone's happy with this PR, I plan to remove these strings.

Issues

None.

Testing

The SqlVectorTests class was modified, and this passes. I'm not expecting any other impact - any issues should be flagged by a simple compilation.

@edwardneal edwardneal requested a review from a team as a code owner October 29, 2025 21:51
@apoorvdeshmukh
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

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 refactors error message handling by removing the legacy SQLResource class and migrating its functionality to the existing SQLMessage class in SqlUtil.cs and the ADP class in AdapterUtil.cs. This consolidates error message handling into a consistent pattern using the StringsHelper class.

Key Changes:

  • Removed the SQLResource.cs file entirely
  • Migrated SQLResource.NullString to SQLMessage.NullString() method
  • Migrated SQLResource.ConversionOverflowMessage to SQL.ConversionOverflow() method
  • Migrated SQLResource.InvalidArraySizeMessage usage to ADP.InvalidArraySize() method
  • Updated all references in production and test code

Reviewed Changes

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

Show a summary per file
File Description
src/Microsoft/Data/SqlTypes/SQLResource.cs Deleted legacy resource class containing static error message strings
src/Microsoft/Data/SqlTypes/SqlVector.cs Updated to use SQLMessage.NullString() and ADP.InvalidArraySize() instead of SQLResource
src/Microsoft/Data/SqlClient/SqlUtil.cs Added SQL.ConversionOverflow() and SQLMessage.NullString() methods to provide error messages
src/Microsoft/Data/SqlClient/SqlBuffer.cs Updated exception throwing to use SQL.ConversionOverflow() instead of SQLResource
src/Microsoft/Data/Common/AdapterUtil.cs Added ADP.InvalidArraySize() method to handle invalid array size exceptions
netfx/src/Microsoft.Data.SqlClient.csproj Removed reference to deleted SQLResource.cs file
netcore/src/Microsoft.Data.SqlClient.csproj Removed reference to deleted SQLResource.cs file
tests/UnitTests/.../SqlVectorTest.cs Updated test assertions to use SQLMessage.NullString() instead of SQLResource

@paulmedynski paulmedynski self-assigned this Oct 30, 2025
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.

4 participants