I\'ve a little question about performance with Entity Framework.
Something like
using (MyContext context = new MyContext())
{
Document DocObject
Yes, ToList()
will evaluate the results (retrieving the objects from database), if you do not use ToList()
, the objects aren´t retrieved from the database.
Linq-To-Entities uses LazyLoading per default.
It works something like this; When you query your underlying DB connection using Linq-To-Entities you will get a proxy object back on which you can perform a number of operations (count being one). This means that you do not get all the data from the DB at once but rather the objects are retrieved from the DB at the time of evaluation. One way of evaluating the object is by using ToList().
Maybe you should read this.