-
Notifications
You must be signed in to change notification settings - Fork 286
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
System.Data.SqlClient clarify SqlDataReader get char #68
Comments
|
They're modelled as strings. I'm not proposing to change that. We could also hide GetTimeSpan since no-one should really use it, it doesn't return a real timespan it interprets the rowversion as one which is confusing at best and incorrect at worst. Rowversion should probably be read as int64. |
I'm not proposing to change that either, since it would be a breaking change to remove the ability to use GetString and GetChars for a char(1) column. But, shouldn't it be possible to also allow GetChar to be used in that specific case. In the case of a char(1) column, wouldn't GetString create a new string for each row? If, as in my case, you only had a small number of a enum values, it would be more efficient to read them as a .net char. |
So far no-one has missed it. If you want to provide an implementation go ahead. I'm just asking about making it hidden as it is on desktop. |
@Wraith2 the not browsable attributes can be taken into consideration. Will take this as enhancement, and could be up for grabs. |
I realise there was an extra item i mentioned in the discussion and didn't edit into the original post
If that's approved I can do the work unless @MarkPflug wants to have a go. |
As recently announced in the .NET Blog, focus on new SqlClient features an improvements is moving to the new Microsoft.Data.SqlClient package. For this reason, we are moving this issue to the new repo at https://github.com/dotnet/SqlClient. We will still use https://github.com/dotnet/corefx to track issues on other providers like System.Data.Odbc and System.Data.OleDB, and general ADO.NET and .NET data access issues. |
It seems that part of this issue has been resolved already, as |
If you've checked and I hid it but didn't close this issue then it's closable now. |
Thanks @Wraith2 for confirming, we'll close this thread then. |
Sql Server doesn't have an individual char datatype and in desktop .net the
SqlDataReader.GetChar
is marked as not browsable and implemented as aNotSupportedException
. The version in this repository lacks the browsable attribute (in src and ref) and I think it should be re-added.The documentation for
SqlDataReader.GetFieldValue<T>
lists char as one of the permitted types but it will not work, there is no metadata support or way to get a char from the database. This means it will always throw anInvalidCastException
and I believe it should throwNotSupportedException
where T is char to align withGetChar
. This would be a behaviour change and need adding to the documentation.@saurabh500 @afsanehr @tarikulsabbir
The text was updated successfully, but these errors were encountered: