A little suggestion (readbility) Order.Desc("CreatedAt") instead of new
Order("CreatedAt", false)
On Sat, Nov 1, 2008 at 6:55 PM, Nathan Stott <[EMAIL PROTECTED]> wrote:
>
> This turned out to be what I wanted.
>
>
> var taskChangesForTask =
> DetachedCriteria.For<TaskStatusChange>()
> .Add(Restrictions.EqProperty("Task",
> "task.Id"))
> .AddOrder(new Order("CreatedAt", false))
>
> .SetProjection(Projections.Property("Status"))
> .SetMaxResults(1);
>
> var tasksWithStatus =
> DetachedCriteria.For(typeof (Task), "task")
> .Add(Subqueries.Eq(DesiredStatus,
> taskChangesForTask));
>
> var tasks =
> Repository<Task>.FindAll(tasksWithStatus);
>
> Was simple when I just thought about what SQL I wanted generated.
>
> Thanks for the help guys.
>
> On Sat, Nov 1, 2008 at 10:55 AM, Nathan Stott <[EMAIL PROTECTED]> wrote:
> > That's fair enough. After Ken's comments though I'm not even sure if
> > it is necessary. It is basically just syntactic sugar ontop of what
> > already exists and I'm not sure that it would accomplish what I want
> > it to anyway.
> >
> > I'm going out of town for a couple of days. When I get back I'll
> > either make the Last patch or just do this query in a different, more
> > logical way. The problem I'm beginning to think is the way that this
> > DB is constructed creates a concept of a 'task status' based upon a
> > relationship when maybe it should just have the 'task status' on the
> > task and the history should just be for auditing. I can change the
> > DB, so that's something I'm going to consider.
> >
> > On Sat, Nov 1, 2008 at 10:45 AM, Fabio Maulo <[EMAIL PROTECTED]>
> wrote:
> >> 2008/11/1 Nathan Stott <[EMAIL PROTECTED]>
> >>>
> >>> Ok, I guess that's the Fabio Maulo way of saying "no it doesn't exist
> >>> but we'd love a patch." :)
> >>
> >>
> >> The fact is that HQL is OO and, for functions, there is an very easy, to
> >> implements, extension point.
> >>
> >> --
> >> 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
-~----------~----~----~----~------~----~------~--~---