title: Dapper .NET: Customize Mapping
body: <h2>Model</h2>
  
  <pre><code>public class ErrorReport{
      public int? Id {get;set;}
      public ExceptionReport Exception {get;set;}
      public ExceptionReport InnerException {get;set;}
  }
  
  public class ExceptionReport{
      public string Type {get; set;}
      public string Message {get; set;}
  }
  </code></pre>
  
  <h2>Database</h2>
  
  <p>This is the table i want to query from</p>
  
  <p><strong>ErrorReports</strong></p>
  
  <ul>
  <li>Id: int</li>
  <li>ExceptionType: varchar</li>
  <li>ExceptionMessage: varchar</li>
  <li>InnerExceptionType: varchar</li>
  <li>InnerExceptionMessage: varchar</li>
  </ul>
  
  <h2>The problem</h2>
  
  <p>So, what i want to do is querying the database and map the results into my model properties. But this doesn't work:</p>
  
  <pre><code>using (var con = ConnectionFactory.CreateConnection(_connectionString))
  {
       IEnumerable&lt;ErrorReport&gt; reports = con.Query&lt;ErrorReport&gt;("Select * from ErrorReports");
  }
  </code></pre>
  
  <p>I understand that i have to explicitly say which columns map to which property, so, how can i do that?</p>