我有这段代码在所有情况下都有效,除非里面有?
or=
标志{}
var db = new MyContext();
var fullSql =
@"select /*+ PARALLEL(6) */ id
from table1 ( contains(sometext,' ( {?}xxx ) ') > 0 )
and some_field = :someParam order by xxx desc fetch next 10 rows only ";
var sqlParams = new List<object>();
sqlParams.Add(0);
var ids = db.Database.SqlQuery<string>(fullSql, sqlParams.ToArray()).ToList();
如果我删除 {?} 它可以工作,如果我硬编码someParam
它也可以工作。如果没有它通过Input string was not in a correct format
编辑:似乎 EF 将花括号内的内容视为参数