Can you clarify this please?
public static void MyMethod()
{
var context= new MyModel.Entities();
//myQuery will not have result yet
var myQuery= from a in context.MyEntity where a.id==10 select a;
// object is populated in myqueryResults.
var MyqueryResults= myQuery.ToList();
}
My Understanding of Lazy Loading is, the properties will not populated until, you need, them.
Question:
There are no values coming back in myQuery, until we say .ToList(). So, Is this also a lazy loading?
This is not lazy-loading but lazy execution. Calling ToList twice will execute SQL two times. The result is not “cached” somewhere.
Actually, not ToList is the trigger but enumeration of the sequence. That’s a difference.