I understand this is the way we call a stored procedure using Entity Framework.
context.Database.SqlQuery<myEntityType>( "mySpName @param1, @param2, @param3", new SqlParameter("param1", param1), new SqlParameter("param2", param2), new SqlParameter("param3", param3) );
But, what if my stored procedure only a has couple of update statements and does not return anything, what should I put instead of myEntityType
?
You want context.Database.ExecuteSqlCommand
instead of SqlQuery
context.Database.ExecuteSqlCommand( "mySpName @param1, @param2, @param3", new SqlParameter("param1", param1), new SqlParameter("param2", param2), new SqlParameter("param3", param3) );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With