title: Dapper Call stored procedure and map result to class
body: <p>I have a T-SQL stored procedure:</p>
  
  <pre><code>CREATE PROCEDURE [dbo].[GetRequestTest] 
          @RequestId UNIQUEIDENTIFIER
  AS
  BEGIN
      SELECT 
          Request.Amount,
          Request.Checksum 
      FROM 
          Request 
      WHERE
          RequestId = @RequestId
  END
  </code></pre>
  
  <p>C# mapping class:</p>
  
  <pre><code>public class CustomTest : Itest
  {
      public decimal Amount {get;set;}
      public string Checksum { get; set; }
  }
  </code></pre>
  
  <p>I'm calling trying to invoke stored procedure by using Dapper:</p>
  
  <pre><code>public void Load(CustomTest obj, Guid RequestId)
  {
      using (var con = base.GetClosedConnection())
      {
          con.Open();
  
          var p = new DynamicParameters();
          p.Add("@RequestId", dbType: DbType.Guid, direction: ParameterDirection.Input);               
  
          var result = con.ExecuteReader("[dbo].[GetRequestTest]", param: p, commandType: CommandType.StoredProcedure);
  
          while (result.Read())
               obj.Amount = (decimal)result["Amount"];
      }            
  }
  </code></pre>
  
  <p>But result is null</p>
  
  <p>I tried to call to put SQL statement from stored procedure directly into C# code - and it works fine, but it doesn't work with stored procedure.</p>
  
  <p>Any ideas - how to make it work?</p>