title: Execute stored procedure w/parameters in Dapper
body: <p>I'm using <a href="https://github.com/SamSaffron/dapper-dot-net" rel="noreferrer">Dapper</a> (thanks <a href="https://github.com/SamSaffron" rel="noreferrer">Sam</a>, great project.) a micro ORM with a DAL and by some reason I'm not able to execute stored procedures with input parameters. </p>
  
  <p>In a example service I've the following code: </p>
  
  <pre><code>public void GetSomething(int somethingId)
  {
      IRepository&lt;Something, SomethingEnum&gt; repository = UnitOfWork.GetRepository&lt;Something, SomethingEnum&gt;();
  
      var param = new DynamicParameters();
      param.Add("@somethingId", dbType: DbType.Int32, value:somethingId, direction: ParameterDirection.Input);
  
      var result = repository.Exec&lt;Something&gt;(SomethingEnum.spMyStoredProcedure, param);
  
      ...
  
  }
  </code></pre>
  
  <p>When the execution of the stored procedure is triggered a SqlException is thrown stating that I need to provide the 'somethingId'</p>
  
  <blockquote>
    <p>Procedure or function 'spMyStoredProcedure' expects parameter '@somethingId', which was not supplied.</p>
  </blockquote>
  
  <p>My <a href="https://github.com/Pencroff/Dapper-DAL" rel="noreferrer">DAL</a> is similar based on this github project of Pencroff.</p>
  
  <p>Am I missing something here?</p>
  
  <p><strong>Update:</strong> I am actually passing the commandType via the SomethingEnum: </p>
  
  <pre><code> public class SomethingEnum : EnumBase&lt;SomethingEnum, string&gt;
   {
      public static readonly SomethingEnum spMyStoredProcedure = new SomethingEnum("spMyStoredProcedure", "[dbo].[spMyStoredProcedure]", CommandType.StoredProcedure);
  
      public SomethingEnum(string Name, string EnumValue, CommandType? cmdType): base(Name, EnumValue, cmdType)
      {
      }
  }
  </code></pre>