I need LINQ to grab the whole table, but that doesn't seem to work ... every time I select values with the pkey, the selection starts again.
So actually this code:
DataContext dc = new DataContext();
dc.Stores.ToList();
Store st = dc.Stores.SingleOrDefault(p => p.Id == 124671);
does
select * from store
in the "ToList ()" method and OPTIONAL
select * from store where id = 124671
in terms of choice under it ...
Of course, I want him not to make a second choice.
How can I do it? (I DO NOT want to store the result of ToList () in an additional property, such as List <Store>)
UPDATE:
Regarding your answers, which mean that:
Store st = stores.SingleOrDefault(p => p.Id == 124671);
Store st = stores.SingleOrDefault(p => p.Id == 124671);
will run 2 choices in the database, which would make the LINQ idea useless ?! Or am I wrong here?
, LINQ , select, , "". - "" .
# 2
, , ( ) , "" ...