I know of several LINQ statements that will cause EF to evaluate and return results form the DB to memory. .ToList()
is one. Does anyone have a comprehensive
It's a long list. They boil down to
Aggregate
All
Any
Average
Contains
Count
ElementAt
ElementAtOrDefault
Empty
First
FirstOrDefault
Last
LastOrDefault
LongCount
Max
Min
SequenceEqual
Single
SingleOrDefault
Sum
ToArray
ToDictionary
ToList
ToLookup
The rest are either Deferred Streaming Execution or Deferred Non-Streaming Execution.
In light of your question, SingleOrDefault()
is Immediate Execution and Union()
is Deferred Streaming Execution.