我会这样创建一个QueryOver
SELECT *
FROM Table
WHERE Field IN (1,2,3,4,5)
我尝试了
Contains
方法,但是遇到了异常这是我的代码
var qOver = _HibSession.QueryOver<MyModel>(() => baseModel)
.JoinAlias(() => baseModel.Submodels, () => subModels)
.Where(() => subModels.ID.Contains(IDsSubModels))
.List<MyModel>();
最佳答案
我找到了解决方案!! :-)
var qOver = _HibSession.QueryOver<MyModel>(() => baseModel)
.JoinAlias(() => baseModel.Submodels, () => subModels)
.WhereRestrictionOn(() => subModels.ID).IsIn(IDsSubModels)
.List<MyModel>();
关于c# - NHibernate在WHERE IN中使用QueryOver,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5408781/