سؤال

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.

هل كانت مفيدة؟

المحلول

var subquery = DetachedCriteria.For<Category>()
    .CreateCriteria("Properties")
        .CreateCriteria("Locales")
            .Add(Expression.Eq("Name", "propName"));
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top