A sample linq query from MSDN:
var expensiveInStockProducts =
from p in products
where p.UnitsInStock > 0 && p.UnitPrice > 3.00M
select p;
Does this query select EVERY column from the database table immediately, or does it return some sort of pointer that retieves the actual column data on demand? ie. If there are 50 columns in my table and I only use a single p.UnitsInStock in my actual code, then am I retrieving 50 times more data than I expected?
if you debugged that then you would probably see every column in your
productstable in theSELECT ...portion of the queryif you did
select p.UnitsInStockyou would only see that in theSELECT ...portion of the query.So to answer your question, yes, it does select every column unless you specify what you want or dump the selection into an anonymous object like so: