-
Notifications
You must be signed in to change notification settings - Fork 316
Flatten | DbMetaDataFactory -> SqlMetaDataFactory #3818
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?
Flatten | DbMetaDataFactory -> SqlMetaDataFactory #3818
Conversation
SqlConnectionFactory always passed the same value to both parameters
Convert the list of unsupported engines to a static variable. Make the UDT/TVP processing methods static. Change name of constants and ServerVersion parameter to fit naming conventions. Introduce constant for EngineEdition query. Reuse SqlCommand where possible. Remove layer of indentation for using block. Remove redundant client-side checks for null on fields which are declared as non-nullable within SQL Server. Slightly simplify building of assembly qualified names. Convert checks whether columns exist in a DataTable (and DataTables in a DataSet) to debug assertions, since these are statically built now.
Move constants which were only used in one method to that method. Replace an unnecessary string[] allocation with a stack-allocated ReadOnlySpan<string>. Where appropriate, use ?.. Replace == null and != null with pattern matching. Convert checks whether columns exist in a DataTable (and DataTables in a DataSet) to debug assertions, since these are statically built now. Replace use of GetSchemaTable with GetColumnSchema to reduce allocations. Where appropriate, make methods private and/or static. Remove unnecessary ADP.CompareInsensitiveInvariant helper. Simplify IncludeThisColumn to make use of Contains or IndexOf where necessary.
Also implement IDisposable on SqlMetaDataFactory
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionFactory.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlMetaDataFactory.cs
Show resolved
Hide resolved
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.
Looks good!
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3818 +/- ##
==========================================
- Coverage 76.61% 69.20% -7.41%
==========================================
Files 274 267 -7
Lines 43393 66325 +22932
==========================================
+ Hits 33247 45903 +12656
- Misses 10146 20422 +10276
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:
|
Description
This continues some of the earlier work from #3435, which replaced a layer of inheritance between
DbConnectionFactoryandSqlConnectionFactory, and #3773, which does the same betweenSqlInternalConnectionandSqlInternalConnectionTds.Here, we remove
DbMetaDataFactoryand fold its responsibilities intoSqlMetaDataFactory. These are comparatively large files, so it's simplest to move commit-by-commit with whitespace changes hidden. I proceed in stages:protectedandprivateas appropriate.)Issues
No associated issues.
Testing
Automated tests continue to pass.