Having:
- an entity
Personwhich has a proprietyName - a
List<string> namesloaded with some names
How can I query using criteria to obtain all Person instances who have a Name which is not found in the names list?
Thanks for answers!
Solution:
var myQuery = session.CreateCriteria(typeof(Person))
.Add(Expression.Not(Expression.In("Name", names));
Your looking for an In expression, see:
Nhibernate HQL where IN query
That would make your particular case something like: