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.

Était-ce utile?

La solution

var subquery = DetachedCriteria.For<Category>()
    .CreateCriteria("Properties")
        .CreateCriteria("Locales")
            .Add(Expression.Eq("Name", "propName"));
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top