I think you should be able to rewrite:
var detachedCritiera = QueryOver.Of<EntityB>()
.Where(Expression.EqProperty("Id", "alias.Id"))
.Select(p => p.Name)
as simply
var detachedCritiera = QueryOver.Of<EntityB>()
.Where(p => p.Id == alias.Id)
.Select(p => p.Name)
... if that doesn't work, let me know the error?
--------------------------------------------------
From: "ragamuf" <[email protected]>
Sent: Friday, September 17, 2010 3:57 PM
To: "nhusers" <[email protected]>
Subject: [nhusers] QueryOver inline selection
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.
--
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.