title: Problems calling a stored procedure using Entity Framework: expects parameter not supplied
body: <p>I have the following stored procedure:</p>
  
  <pre><code>CREATEA PROCEDURE USP_U_Pricing 
  (  
  @ProductId int 
  )  
  AS  
  BEGIN
  ....
  END
  </code></pre>
  
  <p>I setup the DbParameter like this:</p>
  
  <pre><code>var pProductId = dataProvider.GetParameter(); //This returns a DbParameter
  pProductId.ParameterName = "@ProductId";
  pProductId.Value = productId;
  pProductId.DbType = DbType.Int32;
  </code></pre>
  
  <p>And call the procedure like This:</p>
  
  <pre><code>this.Database.SqlQuery&lt;TEntity&gt;("USP_U_Pricing", parameters).ToList();
  </code></pre>
  
  <p>Where pricing is the SP name and parameters an array that contains only the pProduct object. It is there, I checked.</p>
  
  <p>When this line is executed, I get the following exception:</p>
  
  <blockquote>
    <p>Procedure or function 'USP_U_Pricing' expects parameter '@ProductId', which was not supplied.</p>
  </blockquote>
  
  <p>I've been reading around and testing different ways to set the parameter up, but no result.
  If I set two parameters, one called ProductId and the other @ProductId, I get an error that the parameter name should be unique....</p>
  
  <p>Can you help me please?</p>
  
  <p>EDIT: parameters is an array that contains the parameter information. It is populated because I call a method with this signature:</p>
  
  <pre><code> ExecuteStoredProcedureList&lt;TEntity&gt;(string commandText, params object[] parameters)
  </code></pre>
  
  <p>Passing the pProductId as parameter:</p>
  
  <pre><code>dbContext.ExecuteStoredProcedureList&lt;PricingInfo&gt;(
                  "USP_U_Pricing",
                  pProductId);
  </code></pre>