I’m using Entity Framework in an ASP.NET MVC3 application and I’m trying to use the following code:
var token = "";
this.Database.ExecuteSqlCommand("exec dbo.MyUsp", new SqlParameter("token", token));
My stored proc signature is:
CREATE PROCEDURE MyUSP(@token varchar(10) OUT)
(...)
When I use this code I get an error saying that parameter “@token” was expected but not supplied.
How do I tell EF that the token parameter is for output?
I ended up using this to get it working, but I’m sure there’s a more optimal way: