-
Notifications
You must be signed in to change notification settings - Fork 317
Merge | SqlCommand Public Properties #3611
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
Merge | SqlCommand Public Properties #3611
Conversation
# Conflicts: # src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlCommand.cs
* Replace "" with string.Empty
* Removed temp storage of _commandType
…ationAutoEnlist, _sqlDep
…nEnabled, InternalRecordsAffected, _rowsAffected, PropertyChanging()
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 continues the merging of the SqlCommand class across different target frameworks by consolidating public, internal, and protected properties into a shared base implementation. The primary goal is to eliminate code duplication between .NET Framework and .NET Core implementations by moving shared properties to the common SqlCommand.cs file.
Key changes include:
- Moved field declarations and property implementations from platform-specific files to the shared base
- Consolidated property getter/setter logic with minor stylistic improvements
- Standardized the
InvalidCommandTimeoutexception method across platforms
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlCommand.cs | Added shared field declarations, public properties, and internal/protected properties that were previously duplicated across platforms |
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs | Consolidated InvalidCommandTimeout method definitions by moving the version with [CallerMemberName] to the shared location and removing duplicates |
| src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.netfx.cs | Removed field declarations and property implementations that are now in the shared base class |
| src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.netcore.cs | Removed field declarations and property implementations that are now in the shared base class |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlCommand.cs
Outdated
Show resolved
Hide resolved
edwardneal
left a comment
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.
One or two comments, but it's great to see this pressing forwards!
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlCommand.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlCommand.cs
Outdated
Show resolved
Hide resolved
…r.Refresh on netfx
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3611 +/- ##
===========================================
+ Coverage 65.48% 90.82% +25.33%
===========================================
Files 275 6 -269
Lines 61518 316 -61202
===========================================
- Hits 40288 287 -40001
+ Misses 21230 29 -21201
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
samsharma2700
left a comment
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.
Looks good.
Description
This is a continuation of the merge of SqlCommand class. This specifically focuses on merging public, internal, and protected properties. As with the previous PRs, each commit is bite sized and stands on its own. The following members are merged:
_batchRPCMode_columnEncryptionSetting_commandTimeout_designTimeInvisible_notification_notificationAutoEnlist_parameters_pendingCancel_preparedConnectionCloseCount_preparedConnectionReconnectionCount_retryLogicProvider_rowsAffected_sqlDep_statementCompletedEventHandler_transaction_updatedRowSourceColumnEncryptionSettingCommandText-""was replaced withstring.EmptyCommandTimeoutCommandType- removed temp variableConnectionDbConnectionDbParameterCollectionDbTransactionDefaultCommandTimeoutDesignTimeVisibleEnableOptimizedParameterBindingInternalRecordsAffectedInternalTdsConnectionIsColumnEncryptionEnabledNotificationNotificationAutoEnlistParametersPropertyChanging()RetryLogicProviderStatementCompletedStatisticsTransactionUpdatedRowSourceAnd a few changes to things other than SqlCommand:
ADP.InvalidCommandTimeoutwas defined twice in AdapterUtility, once for netfx without[CallerMemberName]and once for netcore with[CallerMemberName]. I standardized on the netcore version and moved it where the rest of the methods live.Issues
Continuation of work for #1261
Testing
Code is moving with minimal stylistic changes here and there. Compilation and CI should be sufficient testing.