Dapper icon indicating copy to clipboard operation
Dapper copied to clipboard

Investigate and resolve convertToType usage in QueryUnbufferedAsync

Open mgravell opened this issue 2 years ago • 2 comments

see review comment and discussion here

mgravell avatar Jun 13 '23 16:06 mgravell

I was looking at the QueryUnbuffered method today and noticed the unused convertToType which lead me to check here if it was being looked at. I also noticed it exists in QueryAsync also:

https://github.com/DapperLib/Dapper/blob/bd4f75b512de3e00f2c2631d5309961a1ecfea23/Dapper/SqlMapper.Async.cs#L451

Reading the original discussion it does look like it would be safe to delete but I can't help but feel it would be a performance improvement to use it and stop GetValue from running that code for every result row:

https://github.com/DapperLib/Dapper/blob/bd4f75b512de3e00f2c2631d5309961a1ecfea23/Dapper/SqlMapper.cs#L1394

Apologies for bumping an old issue.

mellis-ao avatar Apr 02 '25 15:04 mellis-ao

Yes, I should revisit this. Note that the Dapper AOT pieces have a new attribute that takes this much further: [StrictTypes]. I should also further document that side of things!

mgravell avatar Apr 02 '25 19:04 mgravell