title: ExecuteStoreQuery with TVP parameters
body: <p>I have a stored procedure in my database that takes a table value parameter, a list of IdTable objects which contain a single integer Id column.</p>
  
  <p>I have an entity model for the database and want to do the following...</p>
  
  <pre><code>ProjectEntities projectEntities = new ProjectEntities ();
  
  DataTable stationIds = new DataTable();
  stationIds.Columns.Add("Id");
  stationIds.Rows.Add(1);
  stationIds.Rows.Add(2);
  
  SqlParameter parameter = new SqlParameter("@stationIds",stationIds);
  parameter.TypeName = "IdTable";
  
  var parameters = new object[] {parameter};
  
  var results = projectEntities .ExecuteStoreQuery&lt;ProjectSummary&gt;("exec ProjectSummary", parameters);
  
  var count = results.Count();
  </code></pre>
  
  <p>This runs and returns no results, when it should return a bunch of ProjectSummary entities.</p>
  
  <p>When I profile this in SQL Profiler, I get the following</p>
  
  <pre><code>declare @p3 IdTable
  insert into @p3 values(N'1')
  insert into @p3 values(N'2')
  
  exec sp_executesql N'exec ProjectSummary',N'@stationIds [IdTable] READONLY',@stationIds=@p3
  </code></pre>
  
  <p>If I declare the stored procedure to be</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[ProjectSummary]
      @stationIds  [dbo].[IdTable] READONLY
  AS
  BEGIN
      -- SET NOCOUNT ON added to prevent extra result sets from
      -- interfering with SELECT statements.
      SET NOCOUNT ON;
  SELECT * FROM @stationIds
  ...
  </code></pre>
  
  <p>Then I get not results back, it looks like the TVP parameter is coming through empty.</p>
  
  <p>Where as if I manually execute </p>
  
  <pre><code>declare @p3 IdTable
  insert into @p3 values(N'1')
  insert into @p3 values(N'2')
  
  EXEC    [ProjectSummary]
          @stationIds = @p3
  
  GO
  </code></pre>
  
  <p>I get the values 1 and 2 returned from the SELECT query.</p>
  
  <p>So, it looks like I want to use EXEC rather than SP_EXECUTESQL when I run ExecuteStoreCommand. Given the code example above, how on earth do I do that?</p>