4

Due to server restrictions I am limited to .Net 3.5, I was using lazy loading with Linq to SQL but have since switched to the Entity Framework. L2E does not have lazy loading in 3.5 while L2S did. Is there a way to regenerate the templates somehow to achieve this?

1 Answer 1

4

You have to explicitly call a load method in EF 1 / .NET 3.5.

So, before you access a related collection or entity that is not loaded, you have to call something like:

Examples:

if (!person.Pets.IsLoaded)
    person.Pets.Load();
if (!person.Address.IsLoaded)
    person.Address.Load();

Of course it's so ugly, but this is how it worked in that version.

More details from Microsoft Blogs here:

http://blogs.microsoft.co.il/blogs/idof/archive/2008/08/20/entity-framework-and-lazy-loading.aspx

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

Comments

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.