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?

Thewads
  • 4,953
  • 11
  • 55
  • 71

1 Answers1

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));

csherriff
  • 103
  • 6