Not with Entity Framework. The placeholders in the query are replaced with parameter names, not the values passed in to the method. Tracing through the code, you eventually come to the System.Data.Entity.Core.Objects.ObjectContext.CreateStoreCommand method. The relevant part of the code looks something like this:
if (parameters != null && parameters.Length > 0)
{
DbParameter[] values = new DbParameter[parameters.Length];
if (parameters.All(p => p is DbParameter))
{
for (int i = 0; i < parameters.Length; i++)
{
values[i] = (DbParameter) parameters[i];
}
}
else
{
if (parameters.Any(p => p is DbParameter))
{
throw new InvalidOperationException(...);
}
string\[\] parameterNames = new string\[parameters.Length\];
string\[\] parameterNamesWithPrefix = new string\[parameters.Length\];
for (int i = 0; i < parameters.Length; i++)
{
parameterNames\[i\] = string.Format(CultureInfo.InvariantCulture, "p{0}", i);
parameterNamesWithPrefix\[i\] = "@" + parameterNames\[i\];
values\[i\] = command.CreateParameter();
values\[i\].ParameterName = parameterNames\[i\];
values\[i\].Value = parameters\[i\] ?? DBNull.Value;
}
command.CommandText = string.Format(CultureInfo.InvariantCulture, command.CommandText, parameterNamesWithPrefix);
}
command.Parameters.AddRange(values);
}
So if you pass in the parameter values, rather than DbParameters, the code will automatically create parameters called p0, p1, etc., and insert the parameter names into the query.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer