I'm wondering if I need to use parameterized queries when executing sql from ExecuteStoredProcedure in order to prevent SQL Injection attacks?
According to this MSDN link, I should be using parameters.
According to this other MSDN link, a sql string using {0} is the equivalent of using parameters.
So is it really OK to just have a {0}, {1} etc in my SQL statement:
var rv = _context.ExecuteStoreQuery<int>("select ID from table where typeID = {0}", typeID);
or do I need:
var param = new SqlParameter("@typeID", SqlDbType.Int);
param.Value = typeID;
var rv = _context.ExecuteStoreQuery<int>("select ID from table where typeID = @typeID", param);