nhibernate - Is it possible to create ICriteria/ICriterion from LINQ or HQL? -


i creating method can create filter understood nhibernate (by filter mean set of icriteria object example) abstract filter object.

public static ienumerable<icriterion> tonhcriteria(this mycriteria criteria) {    // t4 generated function    // lots of result.add(expression.or(expression.eq(),expression.eq)) expression trees - hard generate    // there way generate hql/linq query here istead? } 

then want like

session.createcriteria<entity>().add(mycriteria.tonhcriteria()) 

to filter entities. problem using expression. methods (expression.or etc) quite tedious (the method generated , have multiple or statements have joined expression somehow). there way avoid using expression.or() , create icrietrion / icriteria using linq or hql?

hey, did check out this question? shows going linq nhibernate multicriteria (and on way transforms linq query icriteria)


Comments

Popular posts from this blog

Delphi Wmi Query on a Remote Machine -