If I have something like this:
x = from f in first.Include("second")
where f.id == 1
select f
y = from s in second
where s.first.id == 1
select s
Will two queries be sent to my database? I realize that I could just set y = f.second to ensure that only one call is made, but I frequently want to factor my code such that I can do the second call independent of whether I’ve done the first – having to make an overload where you can pass in f.second is annoying.
Assuming you Enumerate the queries two calls would be made.
Do you have a reason why you want to keep the queries separate? The two queries you wrote are the same. You have already retrieved all the data you need in query x. You dont need to do the second query because you can just do