你如何传递Nhibernate HQL中'in'子句的列表?
例如
// data input from the user interface, not known at compile time
object[] productIds = {1, 17, 36, ... };
string hqlQuery = @"
from Product as prod
where prod.Id in ( ? )";
HqlBasedQuery query = new HqlBasedQuery(typeof(Product), hqlQuery, productIds)
ActiveRecordMediator.ExecuteQuery(query);
Run Code Online (Sandbox Code Playgroud)
现在,这不会起作用,就像我希望的那样!我真的坚持做这样的事情:
// data input from the user interface, not known at compile time
object[] productIds = {1, 17, 36, ... };
string hqlQuery = @"
from Product as prod
where prod.Id in ( {0} )"; …Run Code Online (Sandbox Code Playgroud)