I have a web application that uses old school SqlHelper
class.
I want to create my custom SqlHelper
which uses Dapper underneath. So, how can I get SqlDataReader
from Dapper?
There is an ExecuteReader
method that hands you back the data-reader that the connection generated: you can cast this if you know it is actually a SqlDataReader
. In this scenario, dapper only processes parameters and literal injection.
using(var reader = (DbDataReader)
conn.ExecuteReader(sql, args))
{
// use reader here
}
I am, however, more than a little intrigued as to what you want SqlHelper
to do that dapper doesn't already do (but better). Genuine question: I like improving the library. If there is a gap, let me know.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With