Looking at EF4 CTP5 in Parts: Part 3Easy Access to In-Memory Entities
Posted by: Julia Lerman Blog - Dont Be Iffy...,
on 07 Dec 2010 |
View original | Bookmarked: 0 time(s)
Oooh laa laa, my favorite so far.
One of my most oft-repeated bits of EF guidance is that “a query’s job is to execute”.
If you write a query such as
var myquery=context.Customers.Where(c=>Id==24);
Any time you do soomthing with myquery, such as call ToList or Count or bind it to a databinding control, it will be exeucted on the database.
Too many times developers will write that query and execute it and then a little later do something like:
context.Customers.Count
hoping...