Hi,
We're currently evaluating DevForce EF, and have come across some unexpected behavior.
There's a possibility that this behavior is as-designed, but it would seem rather irrational, so here goes :
We have a self-referencing Category table with internal hierarchical relationships.
Certainly, the business class Category has a collection property called Children to represent the relationship.
To get the entire hierarchy at once and to prevent any subsequent lazy-loading round-trips, we do something like this:
var qry = from c in mgr.Categories.Include(Category.PathFor(c => c.Children))select c;
Both the SQL Profiler and DebugLog.xml show that the original request indeed contains the instructions to include the span, and the collections certainly get populated correctly.
The awkward thing is this: when we subsequently access the Children collection on those entities that have no such children, an extra lazy-load request is made to the server.
It almost looks like the framework is for some reason unable to distinguish between a never-loaded collection and an emtpy one. Another possibility could be in the principle that the framework simply attempts to see if there's any children now as opposed to originally, which would itself present an inconsistency since in that case it would also have to go and see if there are new/deleted children in those entities that already had children, - yet this is not happening.
Advance thanks for any helpful information!