I am currently upgrading our projects from NH 2.1 to NH 3.2
How to upgrade following ICriteria to QueryOver?

var res = session.CreateCriteria<ActionItemFactory>()
                    .Add(Restrictions.Eq("EventType.ID", id))
                    .SetFetchMode("Options", FetchMode.Eager)
                    .SetFetchMode("Options.Dependants",
FetchMode.Eager)
                    .SetResultTransformer(new
DistinctRootEntityResultTransformer())
                    .List<ActionItemFactory>();

With new linq provider I did it this way:
var res = session.Query<ActionItemFactory>()
                    .Where(a => a.EventType.ID == id)
                    .FetchMany(a => a.Options)
                        .ThenFetchMany(a => a.Dependants)
                    .ToList();

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