非hibernate标准:使用Expression.in()
本文关键字:in Expression 使用 hibernate 标准 | 更新日期: 2023-09-27 18:17:54
Expression.In()在nhibernate中的用途是什么?等价的sql查询是什么?
生成一个SQL "IN"语句。
例如:var idArray = new int[] { 1, 2, 3, 4, 5 };
Session.CreateCriteria(typeof(Foo))
.Add(Expression.In("Id", idArray)
.List<Foo>();
生成的sql相当于:
select * from Foo where Foo.Id in (1, 2, 3, 4, 5)