我正在尝试为 MultiQuery 中的 Query 设置参数:
var multiQuery = SessionHolder.Current.CreateMultiQuery();
foreach (string name in names)
{
var query = SessionHolder.Current
.CreateQuery("select c.Name, c.Surname " +
"from Person as p " +
"where p.Name = :name or " +
"p.Name like ':name/%'")
.SetParameter("name", name);
multiQuery = multiQuery.Add(query);
}
var multiQueryResult = multiQuery.List();
并得到这个例外:
QueryException was unhandled by user code
The named parameter code was used in more than one query. Either give unique names to your parameters, or use the multi query SetParameter() methods to set the named parameter
如何使用多查询 SetParameter() 方法设置命名参数,以便示例按预期工作?
感谢您的回复!