Last active
January 19, 2018 14:43
-
-
Save alieniasty/d85d41d86596a58906bd851a651d355d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Person{ | |
public String Name{get; set;} | |
public String Email {get; set;} | |
public virtual Employer employer {get; set;} | |
} | |
public List<Person> GetPerson(){ | |
using(DbEntities db = new DbEntities()){ | |
return db.Person.ToList(); | |
} | |
} | |
/* | |
Now after this method is called, you cannot lazy load the Employer entity anymore. | |
Why? because the db object is disposed. So you have to do Person.Include(x=> x.employer) to force that to be loaded - And that's how you perform EAGER loading. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment