title: ExecuteStoreQuery Output parameter not being returned
body: <p>I have some entity framework code to run a stored procedure which returns a parameter. Every time I run the code the parameter comes back as null. Does anyone have any ideas what could be causing this?</p>
  
  <p>Thanks</p>
  
  <p>Code:</p>
  
  <pre><code>SqlParameter Business = new SqlParameter("Business", Search.Term);
                  SqlParameter Location = new SqlParameter("Location", Search.Location);
                  SqlParameter PageNumber = new SqlParameter("PageNumber", Search.CurrentPage);
                  SqlParameter RecordsPerPage = new SqlParameter("RecordsPerPage", Search.RecordsPerPage);                  
  
  
                  var TotalRecords = new SqlParameter
                  {
                      ParameterName = "TotalRecords",
                      Value = 0,
                      Direction = ParameterDirection.Output                        
                  };
  
  
  
                  var List = db.ExecuteStoreQuery&lt;ENT_SearchBusinessResult&gt;("exec usp_BusinessUser_Search @Business,@Location,@PageNumber,@RecordsPerPage,@TotalRecords out", Business, Location, PageNumber, RecordsPerPage, TotalRecords); 
  </code></pre>
  
  <p>I used Sql profiler and found it was doing the following:</p>
  
  <pre><code>declare @p7 int
  set @p7=53
  exec sp_executesql N'exec usp_BusinessUser_Search    @Business,
  @Location,@PageNumber,@RecordsPerPage,
  @TotalRecords out',
  N'@Business  nvarchar(14),@Location nvarchar(14),
  @PageNumber int,
  @RecordsPerPage int,@TotalRecords int output',
  @Business=N'Food 
  and Drink',@Location=N'United   Kingdom',@PageNumber=1,@RecordsPerPage=10,
  @TotalRecords=@p7 output
  select @p7
  </code></pre>
  
  <p>this is fine, it shows the return value if you run this query but is not returning back to my code :(</p>