title: Entity Framework and Stored Procedure Function Import with nullable parameters
body: <p>I noticed that when Entity Framework generates a method for a stored procedure (function import), it tests to see if the parameter is null, and makes a decision like this:</p>
  
  <pre><code>if (contactID.HasValue)
  {
    contactIDParameter = new ObjectParameter("contactID", contactID);
  }  
  else
  {
    contactIDParameter = new ObjectParameter("contactID", typeof(global::System.Int32));
  }
  </code></pre>
  
  <p>I don't understand what its trying to do by passing the Type of the parameter as a parameter when the parameter is null? Exactly how does the stored procedure/function get executed in this case?</p>
  
  <p>I did a test myself with SQL Profiler, and noticed that when I intentionally pass null as a parameter (by calling something like context.MyProcedure(null) ), null is simply passed as the parameter to the SQL server's stored procedure.</p>
  
  <p>Some clarifications on this behavior would be appreciated.</p>