I have written stored procedure which return two result sets. and I have called stord procedure from C# code by dapper API
like this
var Count= result.Read<int>().ToList().FirstOrDefault();
var Employees= result.Read<EmployeeData>().ToList();
the issue is
If in stored procedure i directly return normal query then dapper api working fine
SELECT COUNT(ID) FROM Employee
SELECT EmpId,EmpName From Employee
but when i change stord procedure and add some dynamic queries it is giving error while reading second result
changed SQL
SET @Query ='SELECT COUNT(ID) FROM Employee;
SELECT EmpId,EmpName From Employee'
exec (@Query);
Result of both the approches are same in sql
but in C# with dapper API for first case its working fine but for second approch (with dynamic query) its getting break at second read statemnet
var Count= result.Read<int>().ToList().FirstOrDefault();
var Employees= result.Read<EmployeeData>().ToList();<<= for second approach breaking here
Error message : "The reader has been disposed; this can happen after all data has been consumed Object name: 'Dapper.SqlMapper+GridReader'."