Unless I'm missing something, it's just:
session.QueryOver<Parent>()
.Where(p => p.ParentName == "Jim")
.JoinQueryOver(p => p.Children)
.Where(c => c.ChildName == "Joey")
.List();
-----Original Message-----
From: RyanL
Sent: Monday, June 06, 2011 9:52 PM
To: nhusers
Subject: [nhusers] Queryover with criteria for parent and child
The following DetachedCriteria will select a list of Parent objects
for each parent that contains a particular child.
So for example this would select a list of all parents named Jim who
had a child named Joey. I want to write the same query using the
QueryOver syntax and am having no luck. How would I write this using
QueryOver?
List<Parent> parentsNamedJimWithAChildNamedJoey =
session.List<Parent>(DetachedCriteria.For<Parent>()
.Add(Expression.Eq("ParentName", "Jim"))
.CreateCriteria("Children")
.Add(Expression.Eq("ChildName", "Joey")));
--
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.