0

All references that I find for lazy loading say it's possible but they all mention POCOs and that's it. I am using EF4 with the model-first methodology. In my model diagram I have a Project table and a UserObject table, with a 1 to many relationship between them. However, in code, when I have a valid UserObject and I attempt to get the project performing: Project prj = userobj.Project. Unfortunately, this doesn't work as it claims that UserObject.Project is null.

It seems like I have to explicitly load the Project object via calling UserObject.ProjectReference.Load() prior to calling .Project. Is there any way for this to occur automatically when I access the .Project property?

1 Answer 1

1

This should work just fine. Right click on the EDMX, click Properties, check that Lazy loading enabled is set for the EDMX.

Sign up to request clarification or add additional context in comments.

2 Comments

I don't see a lazy loading option in any of the properties in the EDMX
Found it. Apparently my domain model project was set for .net 3.5. Setting it to 4.0 enabled this option!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.