Yes, the Dapper QueryMultiple can do this:
string query = @"SELECT COUNT(*) FROM TABLEA; SELECT COUNT(*) FROM TABLEB"; using (var multi = connection.QueryMultiple(query, null)) { int countA = multi.Read<int>().Single(); int countB = multi.Read<int>().Single(); }
According to Mark Gravell, this is an ideal way to fulfill multiple requests in one package.
Note. Dapper creator Sam Saffron has posted a detailed explanation with sample code to use QueryMultiple to accomplish this.
Steve Oct 12 '13 at 18:14 2013-10-12 18:14
source share