Cleanup | Merge SqlTypes resource string methodology#3733
Cleanup | Merge SqlTypes resource string methodology#3733edwardneal wants to merge 3 commits intodotnet:mainfrom
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
There was a problem hiding this comment.
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.csfile entirely - Migrated
SQLResource.NullStringtoSQLMessage.NullString()method - Migrated
SQLResource.ConversionOverflowMessagetoSQL.ConversionOverflow()method - Migrated
SQLResource.InvalidArraySizeMessageusage toADP.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 |
|
This pull request has been marked as stale due to inactivity for more than 30 days. If you would like to keep this pull request open, please provide an update or respond to any comments. Otherwise, it will be closed automatically in 7 days. |
|
This PR is not stale. |
|
@edwardneal - Can you merge main to get the latest CI configs? |
609b460
|
Thanks @paulmedynski, I've just merged. |
|
/azp run |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
|
This pull request has been marked as stale due to inactivity for more than 30 days. If you would like to keep this pull request open, please provide an update or respond to any comments. Otherwise, it will be closed automatically in 7 days. |
|
This PR is not stale. |
|
This pull request has been marked as stale due to inactivity for more than 30 days. If you would like to keep this pull request open, please provide an update or respond to any comments. Otherwise, it will be closed automatically in 7 days. |
|
This PR is not stale. |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Description
The SqlTypes namespace has had its own
SQLResourceclass since its inception, sat alongside the existingStrings,StringsHelper,SQLandSQLMessageclasses. 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
SqlVectorTestsclass was modified, and this passes. I'm not expecting any other impact - any issues should be flagged by a simple compilation.