Speaking as a non-C# savvy programmer, I'm curious as to the evaluation semantics of LINQ queries like the following:
var people = from p in Person
where p.age < 18
select p
var otherPeople = from p in people
where p.firstName equals "Daniel"
select p
Assuming that Person
is an ADO entity which defines the age
and firstName
fields, what would this do from a database standpoint? Specifically, would the people
query be run to produce an in-memory structure, which would then be queried by the otherPeople
query? Or would the construction of otherPeople
merely pull the data regarding the query from people
and then produce a new database-peered query? So, if I iterated over both of these queries, how many SQL statements would be executed?