Function not yet implemented. Track his progress using issue # 624 . Here is a crude extension method that you can use now.
public static int ExecuteSqlCommand(this RelationalDatabase database, string sql) { var connection = database.Connection; var command = connection .DbConnection.CreateCommand(); command.CommandText = sql; try { connection.Open(); return command.ExecuteNonQuery(); } finally { connection.Close(); } }
Use it as follows:
db.Database.AsRelational().ExecuteSqlCommand("EXEC MySproc");
Please note that this does not take into account any active transactions.
bricelam
source share