I think the problem with your approach is that the LEFT hand side of the IsInG restriction is a collection. I'm not experienced in the Criterion API but I think you need to do some subquery for the navigation from the product to the Features property because it's a collection type.
And if you want the ALL semantics, you need to create one predicate for each item in the "featureList" collection so the IsInG predicate is not the right choice. So create a subquery expressoin with Eq-predicate for each item in your "featureList" variable. On 16 Jun., 14:13, Karl Cassar <[email protected]> wrote: > I'm not using LINQ - Session.Query<T>() does not exist as a method. > > I cannot find any way how to replicate that functionality using Criteria API > or QueryOver. I've tried various ways: > > crit1.Add(NHibernate.Criterion.Restrictions.On<Product>(item => > item.Features).IsInG(featureList)); > > *Brings up error **'Cannot use collections with InExpression'* > * > * > > *crit1.Add(NHibernate.Criterion.Restrictions.On<Product>(item => > item.Features).IsIn(featuresPKeysList));* > > *Brings up same error - 'Cannot use collections with InExpression'* > * > * > > crit1.Add(NHibernate.Criterion.Restrictions.Where<PropertyItem>(item=>item.PropertyItemFeatures.Contains(featureTmp1))); > > Brings up error - *Unrecognised method call: System.Linq.Enumerable:Boolean > Contains* > * > * > *--* > * > * > Any ideas? There doesn't seem to be much help over the internet on > assocation/collection restrictions! > > Thanks, > Karl -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
