How to get SqlDataReader with Dapper?

I have a web application that uses the old school class SqlHelper .

I want to create my custom SqlHelper that uses Dapper at the bottom. So how can I get SqlDataReader from Dapper?

+13
dapper
source share
1 answer

There is an ExecuteReader method that returns a data reader generated by the connection: you can play it if you know that it is really SqlDataReader . In this case, dapper only processes parameters and literals.

 using(var reader = (DbDataReader) conn.ExecuteReader(sql, args)) { // use reader here } 

I am, however, more than intrigued as to what you want SqlHelper do, which the depper does not yet (but better). Genuine question: I like to improve the library. If there is a gap, let me know.

+18
source share

All Articles