I have a class Foo which has a list of Bar instances.

Foo
  Bars : IList<Bar>

And the Bar class which has the following

ParentFood Foo
Added_On   int

I want to select all Foos and return only the most recent Bar

Session.CreateCriteria(typeof(Foo), "foo")
   .CreateCriteria("Bars", "bars")
   .AddOrder(Order.Desc("bars.Added_On"))
   .SetMaxResult(1)

But the MaxResult works against Foo.  Obviously I need to create a
separate criteria but I'm not sure how I would link it back to the Foo
criteria to get the ParentFoo.

Thoughts?
--~--~---------~--~----~------------~-------~--~----~
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