views:

120

answers:

1

Is it possible to get Nhibernate linq to generate a query with an "In" clause? e.g. - Where AnID in (x,y,z)?

+3  A: 

I don't know the state of nHibernate with respect to generating all the potential LINQ queries, but you should be able to use .Contains() to generate an IN.

var list = new int[] { x, y, x };
var q = db.Entities.Where( e => list.Contains( e.AnID ) );
tvanfosson
Great, that works!
CocoB