0

This is one way to do Eager Loading:

dim Q = from o in contex.Orders.Include("Items").Include("Items.Products")

I want to do that without using Strings.

With one level it's easy:

dim Q = from o in contex.Orders.Include(Function(x) x.Items)

But how do you do the include to include Items.Products?

1 Answer 1

2

EF5 Strings

New to EF5 are named include parameters.

Muliple include levels

You can include multiple child level eager fetches using the following syntax

var orders = db.Orders.Include(a => a.Items.Select(c => c.Products));

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

1 Comment

It only allows me to use a path in the Include function, am I missing something?

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.