It seems that support for stored procedures is still lagging .
Here is an example extension method that you can call with _dbContext.ExecuteStoredProcedure("someSproc", "param"); .
public static class DbContextExtension { public static int ExecuteStoredProcedure(this DbContext context, string name, string parameter) { var command = context.Database.GetDbConnection().CreateCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = name; var param = command.CreateParameter(); param.ParameterName = "@p0"; param.Value = parameter; command.Parameters.Add(param); return (int)command.ExecuteScalar(); } }
source share