To-One Mapping Problem

May 27, 2009 at 6:28 PM

I am new to using the IQToolkit and have a simple question that you may be able to answer.

I have a class definition Employee which has a to one relationship to Facility (The same as the Order => Customer in Northwinds). When I run the query below it runs fine but when inspecting my object model I would have expected the Employee.Facility property to be set on the Employee object. This does not appear to be the case. Is this scenario suppose to be handled via the Include QueryPolicy? Or is the framework suppose to infer the include because I am accessing the Facility property from the Employee object in the query? I am asking cause I want to know whether I messed up on my mapping class or if this is by design.

var employees = from e in context.Employees
                         orderby e.Facility.Name
                         where e.Name.StartsWith("A")
                         select new {e, e.Facility};


Thanks for any help,