This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I have three tables and Eager Load set to True. When I create a Linq To Lightspeed query which has the "join" statement, the eager loaded entity is null. Example 3 tables Applications (Id, Name, StatusId) ApplicationUsers(Id, UserId, ApplicationId) Status(Id, StatusCode) Eager Load is set to true between Applications and Status. query var applications = (from a in uow.Applications join au in uow.ApplicationUsers on a.Id equals au.ApplicationId
select a).ToList();
I would have expected to have a non null value for the following: applications[index].Status.StatusCode however, this value is null. I'm using LightSpeed 3.0. Is having nulls for eager loaded entities on a join query an expected behavior ? or am I doing something wrong here ?
|
|
|
Unfortunately, combining eager loading with joins isn't supported at the moment. That said, it's probably a bug that we leave you with a null reference rather than erroring during query analysis or defaulting to lazy loading. Thanks for drawing our attention to this. As a workaround, if you want to continue have the option of eager loading the Application.Status association when using "normal" queries, while still being able to fall back to lazy loading when using join queries, you can do this using named aggregates. |
|
|
Thanks for the quick response
Cheers |
|