I am new to NHibernate and trying to use the QueryOver
. I have the following NHibernate query
var departments = session
.QueryOver<Department>()
.Where(Restrictions.On<Department>x=> x.Parent.Id).IsIn(new List<int> {100}))
.List().ToList();
I have a single value to pass into IsIn and for that I have to new up a list (new List<int> {100}
)). Is there a more cleaner way of doing this?
Best Answer
Your syntax is ok, and only few changes or improvements can be done... here they are:
See more: 16.2. Simple Expressions