2010-11-22 7 views

Répondre

1

Vous pouvez utiliser un Expression et écrire du code SQL, c'est ce qui fonctionne pour moi.

criteria.Add(Expression.Sql("Column1 > (Column2 + Column3)")); 
4

Eh bien, après avoir lu pour la énième fois une question avec ce problème précis, j'ai décidé d'écrire une implémentation qui n'inclut pas l'écriture SQL.

Vous pouvez vérifier la mise en œuvre à http://savale.blogspot.com/2011/04/nhibernate-and-missing.html avec lequel vous pouvez écrire:

criteria.Add(
    Restrictions 
    .GeProperty("Prop1", 
       new ArithmeticOperatorProjection("+", 
           NHibernateUtil.Int32, 
           Projections.Property("Prop2"), Projections.Property("Prop3") 
               ) 
       ) 
); 
Questions connexes