title: Null Dapper.net query still returning Null Reference Exception with FirstOrDefault()
body: <p>I would like to return the max Id from a table using Dapper.net</p>
  
  <pre><code>var x = connection.Query&lt;int&gt;("SELECT max(val) FROM info").FirstOrDefault();
  </code></pre>
  
  <p>This works - unless no row exists then I get an </p>
  
  <blockquote>
    <p>Object reference not set to an instance of an object.</p>
  </blockquote>
  
  <p>Shouldn't the 'OrDefault' mean this returns 0 when no records are present?</p>
  
  <p>How can I return 0 - or some non null value to prevent a crash.</p>
  
  <p>thx</p>