-
Notifications
You must be signed in to change notification settings - Fork 333
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
An ExecuteReaderAsync
that returns MySqlDataReader
#822
Comments
I haven't added this in the past because it would add extra overhead to convert That is, if this method were added: public new async Task<MySqlDataReader> ExecuteReaderAsync(CancellationToken cancellationToken = default) =>
(MySqlDataReader) await base.ExecuteReaderAsync(cancellationToken).ConfigureAwait(false); Then all code calling Or, alternatively, if the default code path did return I think you could write an extension method to do this work (or continue casting the return value as you currently are) but I think the performance penalty that it would incur currently makes it infeasible to include on this API by default. (Hmm, maybe MySqlConnector could provide it as an extension method in a separate namespace so you have to explicit write I don't think C# 9.0 covariant return types (https://github.com/dotnet/csharplang/blob/master/proposals/covariant-returns.md) will help this situation either. |
It looks like Npgsql chooses to implement Microsoft.Data.SqlClient is similar ( It looks like generally an easier-to-use API is preferred over a slight performance boost. (I should benchmark the alternatives and see how they perform.) |
Thanks for the commentary. And regarding |
Benchmarks show that
|
Thank you! |
This is implemented in 0.67.0. |
Hi,
MySqlCommand
has itsExecuteReaderAsync
methods inherited fromDbCommand
. These returnDbDataReader
which is fine for the most part, except sometimes you want the underlyingMySqlDataReader
.For example
MySqlDataReader
has aGetTimeSpan
method thatDbDataReader
does not provide.Could there please be
MySqlDataReader
-returning equivalents ofExecuteReaderAsync
? For now I am explicitly casting the return value.Thank you.
The text was updated successfully, but these errors were encountered: