-
Notifications
You must be signed in to change notification settings - Fork 319
Merge | SqlInternalConnectionTds #3760
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
Conversation
…InBytes, _accessTokenCallback, _cleanSQLDNSCaching, _currentSessionData, _sessionRecoveryAcknowledged, _fedAuthRequired, _federatedAuthenticationAcknowledged, _federatedAuthenticationInfoReceived, _federatedAuthenticationInfoRequested, _federatedAuthenticationRequested, _sspiContextProvider, _activeDirectoryAuthTimeoutRetryHelper, _credential, _fedAuthFeatureExtensionData, _fedAuthToken, _loginAck, _parser, _poolGroupProviderInfo, _recoverySessionData, _serverSupportsDNSCaching, _sessionRecoveryRequested
…Supported, IsDnsCachingBeforeRedirectSupported, IsSQLDNSRetryEnabled
…JsonSupportEnabled, IsVectorSupportEnabled, pendingSQLDNSObject, _tceVersionSupported, _dbConnectionPool, _dbConnectionPoolAuthenticationContextKey, _newDbConnectionPoolAuthenticationContext
…nContextUnLockedRefreshTimeSpan, s_transientErrors
…tPacketSize, _identity, _instanceName, _originalDatabase, _originalLanguage, _fResetConnection, CurrentSessionData
…nation, _threadIdOwningParserLock, _timeout, _timeoutErrorInternal, TimeoutErrorInternal
…ction, Identity, OriginalClientConnectionId, PendingTransaction, RoutingDestination, RoutingInfo, IsTransientError()
…e, Is2008OrNewer, IsLockedForBulkCopy, PacketSize, Parser, PoolGroupProviderInfo, ServerProcessId (made internal), ServerProvidedFailoverPartner, ReadyToPrepareTransaction # Conflicts: # src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs # src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Move IsSqlDNSCachingSupported
(split long lines, added parameter labels to literals, replaced ad-hoc SQL with string interpolation)
(Split long lines, adopt netcore style trave event formatting, use null propagation for parser.disconnect, move comments around)
(remove redundant parantheses, split long lines, moved a couple comments)
(split long lines, flip enum comparison operands, add parameter labels for constant)
(diff denoted by #if NETFRAMEWORK, rebalance comments)
(rebalance comments, flip comparison with constant operands)
(split long lines, rebalanced comments)
(rewrote disconnectransaction into a single line)
(use `is Enum or Enum` pattern, chop argument list)
(make private, split long lines, rebalance comments)
…actionEnded (redundant override) (split long lines)
(labels for constant parameters, split long lines, adopt netcore style trace event strings)
(split long lines, rebalanced comments)
(split long lines, introduce temp variable for source type b/c the ternary was was too long to use in-line, reorder temp variable declaration order to group similar variables)
(extract exception number checks to variable, comment to xmldocs)
(resolve conflicts with #if, split long lines, rebalance comments, introduce some ternaries, nothing too crazy)
(Split long lines, flip constant comparisons, standardize the indenting)
(rebalanced comments, use typed provider info)
…ad, SyncAsyncLock.ThreadMayHaveLock (moved to property)
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 completes a major refactoring by merging the platform-specific SqlInternalConnectionTds implementations into a single shared file. The main accomplishment is consolidating the last non-trivial class merge for the SqlClient codebase.
Key Changes
- Merged SqlInternalConnectionTds from netfx and netcore into a single common implementation
- Introduced new Microsoft.Data.SqlClient.Connection namespace for helper classes (ServerInfo, SessionData, SessionStateRecord)
- Changed
ThreadMayHaveLock()from method to property for consistency - Fixed spelling error in SqlException.cs
- Removed stub files that were used during the merge process
- Updated project files to reference the new shared implementation
Reviewed Changes
Copilot reviewed 13 out of 16 changed files in this pull request and generated 22 comments.
Show a summary per file
| File | Description |
|---|---|
| SqlInternalConnectionTds.cs | New merged implementation of the core TDS connection class with 3688 lines, consolidating netfx and netcore versions |
| Connection/SessionData.cs | Moved to new namespace, contains session state management logic |
| Connection/SessionStateRecord.cs | Moved to new namespace, represents individual session state records |
| Connection/ServerInfo.cs | Moved to new namespace, contains server connection information |
| SqlException.cs | Added new overload for creating exceptions with single SqlError, fixed spelling error |
| TdsParser.cs | Updated using statements and property access to match API changes |
| TdsParserStateObject.cs | Updated property access from method call to property |
| SqlConnection.cs, SqlConnectionFactory.cs, SspiContextProvider.cs | Added using statement for new Connection namespace |
| netfx/netcore project files | Updated to reference shared files instead of platform-specific ones |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SessionData.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SessionData.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/ServerInfo.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlException.cs
Show resolved
Hide resolved
paulmedynski
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.
Since the new SqlInternalConnectionTds.cs is 3688 lines long, most of which I assume are identical to the two previous files, it would be helpful to have the functional differences called out. There are too many commits for reviewers to walk through and try to keep track of it all IMO.
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/ServerInfo.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SessionData.cs
Outdated
Show resolved
Hide resolved
|
@paulmedynski since I called out in bold at the beginning of the PR description that the PR is big and can be split up if necessary and that if you want it smaller you should reject it, I will trust you read that and decided not to reject because you are ok with it being a very big PR. I called out code changes in the commit comments themselves, but I can scrub them again and check for "functional changes" to call out. |
benrr101
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.
Adding comments that call out less-trivial changes. There are no true "functional" changes here, just tweaks to formatting.
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlInternalConnectionTds.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SessionStateRecord.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SessionData.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SessionData.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/ServerInfo.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/ServerInfo.cs
Show resolved
Hide resolved
* Use string.Format again for UserServerName assignment in ServerInfo.cs * Make fields readonly that were called out by copilot * Fixed typo in comment for _dbConnectionPoolAuthenticationContextKey * Restored TODO comment from @mdaigle * Added `using` for cancellation token source in the middle of active directory junk
paulmedynski
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.
Thanks for the comments - very helpful! A couple of suggestions, but not blocking.
Description
This is a big PR! If you want me to split it up, I have a couple branches I could split it into! Just reject the PR and I'll do that!
At long last, the last (non-trivial) class merge! This mainly merges the SqlInternalConnectionTds class, but because there are multiple classes in the file, they have also been split up. Each commit is a single (or small collection) of members, so it can be reviewed one-commit-at-a-time. Each commit also has notes about what changes were made to the member.
The only non-trivial change made as part of this merge is to move the smaller classes in the file to a new Microsoft.Data.SqlClient.Connection namespace. It's unclear what they're used for unless you put them in a new namespace.
Issues
More or less finishes up #1261
Testing
Projects still build. I kinda expect a handful of test failures, but we'll sort that out as they happen.