NHIbernate QueryOver detached criteria and Any clause

nhibernate

Solution

ProductCategory productCategory = null;
var subquery = QueryOver.Of<Product>()
  .JoinAlias(product => product.ProductCategories, () => productCategory)              
  .Where(() => productCategory.Category.Id == parameter.Category.Id);

What's type of Category? If this is an entity:

productCategory.Category.Id == parameter.Category.Id

If this is base property:

productCategory.Category == parameter.Category

Is it many-to-many relation? (Product and Category)

Category category = null;
var subquery = QueryOver.Of<Product>()
  .JoinAlias(product => product.Category, () => category)            
  .Where(() => category.Id == parameter.Category.Id);

Problem

I have the following in subquery which is failing: ``` var subquery = QueryOver.Of<Product>() .Where(x => x.ProductCategories.Any(y => y.Categgory == parameter.Category)); ``` I get an error for the Any statement: ``` Unrecognised method call: System.Linq.Enumerable:Boolean Any ``` How would I update the above restriction for QueryOver?

Original source