Only the first query with Where is a database query. As soon as you apply a greedy statement like FirstOrDefault , the request will be executed. The second request is executed in memory. If Object.Table2 is a collection (which, apparently, is) and you don't have lazy loading, your code will crash because the collection is null . If you have lazy loading enabled, the second query is executed without the slightest effort to load the collection - the complete collection and filter are executed in memory.
Instead, the query should look like @adrift code, which will really be just one database query.
source share