-
Notifications
You must be signed in to change notification settings - Fork 292
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
Sync SqlDataRecord #1024
Sync SqlDataRecord #1024
Conversation
The original class in
Agreed. Also the other constructor (internal) does not seem to be used and is dead code - can be removed.
Go ahead, except "_fieldNameLookup" I see others are initialized in constructor so it's possible.
I agree it should be checked for in all functions fetching for ordinal.
SQL Server 2012 is the minimum official supported version as per Support Lifecycle. But we have customers still using SQL 2008 so we try not to break them. But checks to support below SQL 2005 can be considered for removal. |
Ok, as stated I'll make those changes in a follow-up unless you strongly prefer I do them here. |
According to documents, nobody's allowed to inherit this class; but the design doesn't prevent it. So, there is a chance of inheriting from this class by customers! Edited |
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/Server/SqlDataRecord.cs
Outdated
Show resolved
Hide resolved
Docs should be updated to reflect reality. That doesn't need to be a part of this PR, though. |
Could you please update docs as well in this PR, to close on this topic and address one last comment from Davoud? |
Docs updated to remove "This class cannot be inherited." |
This is a small one. Identify similar parts of the two SqlDataRecord classes from netcore and netfx and sync those differences so the functional differences can be seen.
Observations:
EnsureSubclassOverride
which checks _recordBuffer is non-null or throws are pointless and I have seen them in profile traces in the past when looking at UDT performance. I propose to removeEnsureSubclassOverride
entirely.ThrowIfInvalidOrdinal(ordinal)
is used only once inIsDBNull
, either it should be used in all functions that take an ordinal parameter or none of them. If it is not used ordinal will often be used without further checks in called methods which could result in out of range or key not found exceptions.Any of those changes would be a separate PR.
Oh. and the docs state that "Represents a single row of data and its metadata. This class cannot be inherited." when the class is not sealed and can be inherited from. Either the docs are wrong or the class should be sealed.