title: How to read an SQL query generated by Dapper?
body: <p>I have a standard code:</p>
  
  <pre><code>public IEnumerable ExperimentSelect(object parameters)
  {
      using (var connection = new SqlConnection(ConnectionString))
      {
          connection.Open();
          var dynamicparam = new DynamicParameters(parameters);
  
          var rows = connection.Query("[dbo].[ptbSapOrderSelect]", dynamicparam, 
                  commandType: CommandType.StoredProcedure);
  
          if (rows.Any())
              TotalRows = ((long)rows.ToList()[0].TotalRows);
  
          return rows;
      }
  }
  </code></pre>
  
  <p>How to automate saving queries generated by Dapper to the file using eg NLog? I am thinking of getting source of SQL query as shown in the SQL Server Profiler.</p>