Hi Richard, I'm talking about the NHibernate.Criterion.Restrictions API.  If 
I want to have a query like: 'SELECT FROM XXX WHERE FIELD1 is null OR FIELD2 
is null OR FIELD3 is null OR FIELD4 is null'  I need to do ugliness like 
this (Note: assume these are aliases):

session.QueryOver<XXX>().Where(Restrictions.Or(
          Restrictions.On<XXX>(x => x.FIELD1).IsNull,
          Restrictions.Or(
              Restrictions.Or(
                  Restrictions.On<XXX>(x => se.FIELD2).IsNull,
                  Restrictions.On<XXX>(x => se.FIELD3).IsNull,
                  ), Restrictions.On<XXX>(x => se.FIELD4).IsNull
              )
          )).List();


It does not need to be so ugly, it could be:

session.QueryOver<XXX>().Where(Restrictions.Or(
          Restrictions.On<XXX>(x => x.FIELD1).IsNull,
          Restrictions.On<XXX>(x => x.FIELD2).IsNull,
          Restrictions.On<XXX>(x => x.FIELD3).IsNull,
          Restrictions.On<XXX>(x => x.FIELD4).IsNull)).List();

All that is needed for this is that the Restrictions.Or (and 
Restrictions.AND) API allow for an unbounded params array rather than a 
fixed 2 parameters (lhs, rhs).

Note: I wrote the examples out without testing (in this post) them so I'm 
sure they are buggy but I think they are clear enough to explain what I 
mean.

Thanks All

Guido

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to