TotalCount for paging with dapper
<p>I'm using dapper to get result set from stored procedure into object list and return it to the client as json:</p>

<pre><code>public IHttpActionResult Test()
    {
        List&lt;ProductPreview&gt; gridLines;
        var cs = ConfigurationManager.ConnectionStrings["eordConnection"].ConnectionString;
        using (SqlConnection conn = new SqlConnection(cs))
        {
            gridLines = conn.Query&lt;ProductPreview&gt;("dbo.myStoredProcedure", new { userID = 1 },
             commandType: CommandType.StoredProcedure).ToList();
        }
        var totalCount = gridLines[0].MaxCount;//I need to know total count
        ....
        return Ok(gridLines);
    }
</code></pre>

<p>It works.
The last property of object of type ProductPreview is TotalCount, since stored procedure returns total count as column of every row.
(second option is that stored procedure returns two recordsets, but I'm not sure how to change dapper to work with two recordsets). Having two separate queries is not an option.</p>

<p>What would be the best way to return gridLines json object to client without totalCount property(since it is overhead) and read total count from stored procedure to some variable?
Copy gridLines object to some other object without totalCount property would be also unnecessary overhead.</p>