title: Entity Framework 4.0 Entity SQL passing null ObjectParameter parameters
body: <p>I have an Entity SQL query:</p>
  
  <pre><code>SELECT VALUE t FROM MyEntities AS t 
  WHERE t.Name = @p OR (@p IS NULL AND t.Name IS NULL)
  </code></pre>
  
  <p>I can execute the query as follows:</p>
  
  <pre><code>var results = context.CreateQuery&lt;WorkflowInstance&gt;(
      query, new ObjectParameter("p", name)).ToList();
  </code></pre>
  
  <p>However, if the 'name' variable is null, then I get the System.ArgumentNullException. So I also tried to use DBNull.Value if the name was null, and I get the following exception: </p>
  
  <blockquote>
    <p>System.ArgumentOutOfRangeException was caught<br>
    Message=The specified
    parameter type 'System.DBNull' is not
    valid. Only scalar types, such as
    System.Int32, System.Decimal,
    System.DateTime, and System.Guid, are
    supported.</p>
  </blockquote>
  
  <p>I would like to have parameterized queries where null values are also possible parameter values. How do I achieve this with Entity SQL?</p>