title: EF Core 2 executing Stored Procedure with OUTPUT param
body: <p>Why is the output value not getting returned?</p>
  
  <p>Using EF Core 2 (2.1.0-preview-final) as the platform for managing schema through code-first modelling, I wanted to add other database objects such as SPs. That was a journey itself, however the challenge under topic here is executing an SP using context.Database.ExecuteSqlCommandAsync() and retrieving the OUTPUT param value.</p>
  
  <p>This is the code that successfully executes the SP, however the output value is never returned. You would think that setting the Direction of the parameter was sufficient.</p>
  
  <pre><code>public async Task AddAsync(Models.Filename entity)
  {
      SqlParameter name = new SqlParameter("@Name", entity.Name);
      SqlParameter idOut = new SqlParameter
      {
          ParameterName = "@Id",
          SqlDbType = System.Data.SqlDbType.BigInt,
          Direction = System.Data.ParameterDirection.Output
      };
      using (var db = new MetaDataDbContext())
      {
          await db.Database.ExecuteSqlCommandAsync("[dbo].[AddFilename] @Name, @Id", name, idOut);
      }
      entity.Id = Convert.ToInt64(idOut.Value);
  }
  </code></pre>