-
Notifications
You must be signed in to change notification settings - Fork 317
Cleanup | Merge SqlTypes resource string methodology #3733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Cleanup | Merge SqlTypes resource string methodology #3733
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
There was a problem hiding this 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.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. |
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.