Hi all,
We have a project where the default method to query on the database is
using QueryOver. I would like to know how can we add a "where" filter over
a child collection and project if there is a record on it.
Using linq, we usually do something like this:
var query = from e in session.Query<Entity>()
* let hasPermission = e.Childs.Any(c => c.HasPermission)*
where e.IsEnable && *hasPermission*
select new EntityDto()
{
... // fill some properties of Dto here
HasPermission = *hasPermission*
};
var result = query.ToList();
How can we have a query like "let" keyworkd but using QueryOver. I tried
using JoinAlias but I am not sure why it isn't working. I tried this:
Child child = null;
var query = Session.QueryOver<Entity>()
.JoinAlias(t => t.Childs, () => child)
.Where(x => x.CustomerId == customerId)
.And(x => x.Childs.Any(p => p.HasPermission)) // I don
know how continue here... ??/
Thank you.
--
______________________________________
Felipe B Oriani
[email protected]
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.