ajbeaven
ajbeaven

Reputation: 9562

LinqToSql: stop eager loading

Having set the following options to eager load a customer's orders:

DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<Customer>(c => c.Orders);
db.LoadOptions = dlo;

How would I then stop this and revert back to lazy loading the orders again? Or are these LoadOptions only used for the next query?

Upvotes: 0

Views: 170

Answers (1)

ChrisF
ChrisF

Reputation: 137138

These load operations only apply to the next query.

If you have a second query that doesn't have these options set then it will do lazy loading.

Upvotes: 1

Related Questions