Re Linq: Why would you expect an inner join?? There is no restriction
in the .Where that requires that the Broker must be there. The Fetch
only says "*if* there is Broker, please load it immediately". If you
need only the properties that do have a Broker, you should, in my
opinion just write this:

 //linq version
 var test2 = session.Query<Property>()
                                         .Fetch(p => p.Broker)
                                         .Where(p => p.Status == "T"
&& p.Price > 0 && p.Broker != null) // condition added!
                                         .OrderBy(p => p.Address1)
                                         .Skip(100)
                                         .Take(100)
                                         .ToList();

Re Criteria: I have not used Criteria since NHib 1.x, so I cannot say
anything about them. Still, it seems wrong to me that adding a fetch
mode creates an inner join. Isn't a fetch mode just a "hint" how to
fetch some objects (not lazily, but eagerly) and therefore, should
*not* change the result? [yes, I know there's that issue that eagerly
fetching a collection will "multiply" the result, for which there is
some Distinct... postprocessor. But there, nothing *vanishes* because
of fetching. Still, Criteria might just have this semantics
implicitly ... ... ...]

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