title: Dapper and Downward Integer Conversion
body: <p>I am checking out v1.25 of Dapper with Sqlite via System.Data.Sqlite. If I run this query:</p>
  
  <pre><code>var rowCount = dbc.Query&lt;int&gt;("SELECT COUNT(*) AS RowCount FROM Data").Single();
  </code></pre>
  
  <p>I get the following error: <code>System.InvalidCastException: Specified cast is not valid</code></p>
  
  <p>This is because Sqlite returns the above value as an Int64, which I can verify with the following code. This will throw "Int64":</p>
  
  <pre><code>var row = dbc.Query("SELECT COUNT(*) AS RowCount FROM Data").Single();
  Type t = row.RowCount.GetType();
  throw new System.Exception(t.FullName);
  </code></pre>
  
  <p>Now, the following code will actually handle the downward conversion from Int64 to Int32:</p>
  
  <pre><code>public class QuerySummary
  {
      public int RecordCount { get; set; }
  }
  var qs = dbc.Query&lt;QuerySummary&gt;("SELECT COUNT(*) AS RecordCount FROM Data").Single();
  rowCount = qs.RecordCount;
  throw new System.Exception(rowCount.ToString());
  </code></pre>
  
  <p>When I throw this exception, it gives me the actual row count, indicating that Dapper handled the conversion for me.</p>
  
  <p>My question is, why is it that <code>dbc.Query&lt;int&gt;</code> does not handle the downward conversion in a similar way to <code>dbc.Query&lt;QuerySummary&gt;</code>? Is this intended behavior?</p>