1

I use Dapper library. I have a dynamic query which returns one or more resultsets/tables from QueryMultiple Method. I don't have any specific count of resultsets to write no. of Read() method. Do we have any function or method (e.g. result.Count = no. of return tables) or how many no. of times can we write read() to retrieve N no. of resultsets?

SqlMapper.GridReader result = _connection.QueryMultipleAsync(model.APIName, oPara, commandType: CommandType.StoredProcedure).Result;

dynamic dyn = result.Read();
Alex
  • 7,901
  • 1
  • 41
  • 56
SanketS
  • 963
  • 1
  • 13
  • 36

1 Answers1

5

Dapper currently doesn't have a count of the available result sets in the GridReader.

But you can use the IsConsumed property instead. Once all result sets are processed, IsConsumed is set to true.

while (!result.IsConsumed)
{
   dynamic rs = result.Read();
}
dybzon
  • 1,236
  • 2
  • 15
  • 21
Alex
  • 7,901
  • 1
  • 41
  • 56