Last active
December 8, 2017 20:46
-
-
Save jesuscampos/d81eb964ce64648f3ed2f9d2f74bf403 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Carga diferida (activada en Entity Framework por defecto) | |
MyContext myContext = new MyContext(); | |
IList<Cliente> clientes = myContext.Clientes.ToList(); | |
IList<Pedido> pedidos = clientes.FirstOrDefault().Pedidos.ToList(); |
This file contains hidden or 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
// Carga explícita | |
MyContext myContext = new MyContext(); | |
IList<Cliente> clientes = myContext.Clientes.ToList(); | |
myContext.Entry(clientes).Reference("Direccion").Load(); | |
myContext.Entry(clientes).Collection("Pedidos").Load(); |
This file contains hidden or 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
// Carga instantánea | |
MyContext myContext = new MyContext(); | |
IList<Cliente> clientes = myContext.Clientes.Where(c => c.IdCliente == 1).Include("Pedidos.DetallesPedidos").ToList(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment