Rush Frisby
Rush Frisby

Reputation: 11454

EF loading entire object graph

For some reason EF is loading my entire object graph. I have lazy loading enabled = false on my edmx and am calling field = db.FormFields.Include("FieldOptions").FirstOrDefault(x => x.FieldID == field.FieldID); but it's loading a couple of other properties hanging off of that along with FieldOptions. How can I turn this off so that not everything is loaded?

Upvotes: 1

Views: 503

Answers (1)

Adam Rackis
Adam Rackis

Reputation: 83358

Set lazy loading to TRUE if you don't want to eagerly pull down your whole object graph. That's the whole point of lazy loading—objects are not pulled down until needed.

By setting that to false, you're turning that off, and telling EF to eagerly load associated properties.

Upvotes: 3

Related Questions