tags:

views:

498

answers:

2
A: 

Try this:

var groupsCrit = items.CreateCriteria("Groups");
var groupIds = Restrictions.Disjunction();
foreach (var groupid in Groups)
{
    groupIds.Add(Restrictions.Eq("Id", groupid)); // "Id" should be the name of the Id property on the Group class
}
groupsCrit.Add(groupIds);
Stuart Childs
A: 

I ended up finding a good solution for this:

if (Groups!= null && Groups.Count > 0)
{
    var items = Groups.ConvertAll(i => i.Id).ToArray();

    criteria.CreateCriteria("Groups", "g", JoinType.LeftOuterJoin);
    criteria.Add(Restrictions.In("g.Id", items));
}

This does exactly what I am looking for.

Max Schilling