NNibernate Reusable QueryOver

Posted by colinramsay on Stack Overflow See other posts from Stack Overflow or by colinramsay
Published on 2011-01-12T12:52:15Z Indexed on 2011/01/12 12:53 UTC
Read the original article Hit count: 245

Filed under:

To keep my queries self-contained and potentially reusable, I tended to do this in NH2:

public class FeaturedCarFinder : DetachedCriteria
{
    public FeaturedCarFinder(int maxResults) : base(typeof(Car))
    {
        Add(Restrictions.Eq("IsFeatured", true));
        SetMaxResults(maxResults);
        SetProjection(BuildProjections());
        SetResultTransformer(typeof(CarViewModelMessage));
    }
}

I'd like to use QueryOver now that I've moved to NH3, but I'm not sure how to do the above using QueryOver?

© Stack Overflow or respective owner

Related posts about nhibernate