I'm doing the following query using dapper and C#7 ValueTuples (installed nuget):
await connection.QueryAsync<(int, Guid)>(
$@"SELECT tenant, pid FROM Table
ORDER BY id
OFFSET {skip} ROWS
FETCH NEXT {dbBatchSize} ROWS ONLY");
It returns a list of 0 and Guid.Empty.
If I use only int or only Guid it works ok
I also tried naming the ValueTuple according to the columns in the table:
await connection.QueryAsync<(int tenant, Guid pid)>("...")
Same result.
Anyone has any tip? Thanks in advance!
This is a known limitation of dapper. It doesn't support copying a query result into a ValueTuple. There is an open issue on Github requesting support for this.
The OP of that request creating a working example of how it could be done in April and it is currently scheduled for the v2.0 release.
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