title: Entity Framework Timeouts on SqlQuery
body: <p>I am using EF 6.1.3, and populating a model with one of the stored procs times out.  </p>
  
  <pre><code>var spResult = context.Stuff.SqlQuery("exec GetStuff @p0, @p2", pId, typeId )
  .OrderBy(a =&gt; a.Barcode)
  .ToDataSourceResult(request);
  </code></pre>
  
  <p>I have a stored proc called <code>GetStuff</code> with two parameters: <code>@id int</code> and <code>@typeId int = null //nullable</code>  </p>
  
  <p>In SQL Profiler I can see the stored proc is being executed by EF on the server, with correct parameters.<br>
  When I run the stored proc in SSMS with those same parameters I get results in less than 1 second (copy pasted from Profiler to be sure). </p>
  
  <p>If I change the one parameter when calling from EF, I get immediate results!</p>
  
  <p>In Short: stored procedure <code>GetStuff (1, null)</code> works in EF and SSMS while <code>GetStuff(1, 1)</code> times out in EF, but works in SSMS.</p>
  
  <p>The Stored proc is a Select only, with no transactions in SQL or my C# code defined.</p>