Question

I do not wish to know why it's better to use QueryOver and that it's newer.

How can I translate the following QueyOver to a DetachedCriteria:

QueryOver<Category>().Where(x => x.Properties.Any(y => y.Locales.Any(l => l.Value.Name == "propName")));

I don't know if the "Any" extension method is recognized by nhibernate but you can understand what I'm trying to accomplish.

Was it helpful?

Solution

var subquery = DetachedCriteria.For<Category>()
    .CreateCriteria("Properties")
        .CreateCriteria("Locales")
            .Add(Expression.Eq("Name", "propName"));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top