I thought you could also do this:

criteria.Where(Restrictions.On<Listing>(l => l.Id).Not.IsIn(ClickedItems));

... but it looks like I missed that syntax (my mistake - I'll add it).  You 
could also (assuming the IQueryOver has the required types) use:

criteria.WhereRestrictionOn(l => l.Id).Not.IsIn(ClickedItems);
  From: Cristian Prieto 
  Sent: Friday, July 16, 2010 6:47 PM
  To: [email protected] 
  Subject: Re: [nhusers] Not In with QueryOver


  That was my first thought... but It was too much easy to be true... :P

  Now I love QueryOver even more than before :)

  -- Cristian



  On Fri, Jul 16, 2010 at 11:19 AM, Fabio Maulo <[email protected]> wrote:

    Have you tried this 
criteria.Where(!Restrictions.On<Listing>(l => l.Id).IsIn(ClickedItems));

    On Fri, Jul 16, 2010 at 1:59 PM, Cristian Prieto <[email protected]> 
wrote:

      Hi pals,

      I've been playing a little with new QueryOver with NH trunk, I really 
love it... But after reading and searching a little in internet I could not 
find how to do a "Not In" query using QueryOver and turns this into a negative 
query:

      Snippet
SnippetISession session = Factory.GetCurrentSession();IQueryOver<Listing, 
Listing> criteria = session.QueryOver<Listing>();




criteria.Where(Restrictions.On<Listing>(l => l.Id).IsIn(ClickedItems));I mean, 
IsIn must become a IsNotIn...

      Thanks a lot for your help!

      -- Cristian


      -- 
      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.




    -- 
    Fabio Maulo



    -- 
    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.




  -- 
  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.

-- 
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