-
Notifications
You must be signed in to change notification settings - Fork 282
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 ContextConnection handling #2862
base: main
Are you sure you want to change the base?
Merge ContextConnection handling #2862
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2862 +/- ##
==========================================
- Coverage 72.22% 71.84% -0.38%
==========================================
Files 297 294 -3
Lines 61091 60307 -784
==========================================
- Hits 44120 43330 -790
- Misses 16971 16977 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@edwardneal Please resolve conflicts so we can continue with reviews. |
Thanks @cheenamalhotra - now resolved, pending CI. |
I would vote for removing the property from .NET Framework too instead of adding and making it obsolete in .NET Core.. This property was first marked obsolete in v3.0. Does that sound acceptable @David-Engel ? |
Thanks @cheenamalhotra. Part of the reason I picked this approach is to make a specific statement that SqlClient doesn't support connecting to SQL Server's context connection, so if the documentation is updated to make that lack of support clear then I don't have any objections to removing the property from .NET Framework (besides the API compatibility concerns - but a v6.0 release is probably our last opportunity to make this kind of breaking change for a while.) The |
@saurabh500 - Do you think MDS will ever get into the CLR? If not, I agree we should just remove the ContextConnection property. |
@David-Engel @cheenamalhotra dont know about forever. 😀 |
@edwardneal Could you please update the PR as per comments from David and Saurabh? Thanks! |
Only removing the public-facing references, and the references added by previous commits.
Thanks all - I've just rolled back the related additions to .NET Core's codebase and removed the ContextConnection property from both codebases. There's one piece of new functionality: specifying SQLCLR casts quite a long shadow here. I've handled the API surface in this PR, and will remove the various Smi classes and code paths once 6.0 is released. Once those are gone, I'll close my original issue 2838. |
Relates to #2838, #1261.
This is partially to fix the documentation and the obsolescence message on
SqlConnectionStringBuilder.ContextConnection
. It goes a little further though: setting ContextConnection to true will now always throw an ArgumentException, and manually specifying it in the connection string will now throw an explicit error highlighting that Microsoft.Data.SqlClient doesn't support it.Doing this also meant merging the handling of it between .NET Core and Framework. Once that was done, I've reintroduced a number of places where references to SqlConnectionString.ContextConnection had been removed from the .NET Core code. This is a prerequisite to merge SqlDataReaderSmi et al.
One point of note here is that SqlConnectionString.ContextConnection (line 763 of SqlConnectionString.cs) is hardcoded to return false. This is so that the .NET JIT can optimise away any evaluation - example here.
This changes the public API surface slightly: it introduces the SqlConnectionStringBuilder.ContextConnection property to .NET Core, and changes the message on its
Obsolete
attribute on both platforms.