How about if you do it all with QueryOver, since I believe it's still not
possible to do subqueries using the linq provider, but I could be
mistaken...
So perhaps something like this:
var subQuery = QueryOver.Of<Category>()
.Where(c => /* condition here */ && /* another
condition here */ && /* another condition here too */)
.Select(Projections.Id());
Product productAlias = null;
Supplier supplierAlias = null;
Order orderAlias = null;
OrderRow orderRowAlias = null;
var result = Session.QueryOver(() => productAlias)
.Left.JoinAlias(() => productAlias.Supplier, () =>
supplierAlias)
.Left.JoinAlias(() => productAlias.Order, () => orderAlias)
.Left.JoinAlias(() => orderAlias.OrderRow, () =>
orderRowAlias)
.WithSubquery.WhereProperty(() => productAlias.Category
.Id).In(subQuery)
.OrderBy(() => productAlias.Name).Desc
.TransformUsing(Transformers.DistinctRootEntity)
.List();
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/nhusers/-/v2l6mLTNlsQJ.
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.