I am trying to generate a query using an inline selection which has a
join condition on the root. I would like to do the entire query using
QueryOver but I find it necessary to fall back to ICritiera in order
to specify the WHERE clause in the inline selection. Is there a way to
stay true all the way which QueryOver and not have to use untyped
aliases via the Expression.EqProperty clause?

  SELECT
          a.color,
          (SELECT top 1 b.name FROM tableB b WHERE b.Id = a.Id)
      FROM
           tableA a
      WHERE
          a.Id = @p2;

===================================

EntityA alias = null;

Session.QueryOver<EntityA>(() => alias)
.Where(x => x.Id = somevalue)
.SelectList(list => list
.Select(x => x.Color)
.SelectSubQuery<EntityB>(detachedCriteria));

var detachedCritiera = QueryOver.Of<EntityB>()
.Where(Expression.EqProperty("Id", "alias.Id"))
.Select(p => p.Name)
.Take(1);



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