Querying Out-of-Process Data · TL;DR
1 min readTL;DR
In-process data lives in your application's memory (a List<T>), so LINQ to Objects can run your lambdas directly as compiled delegates. Out-of-process data lives somewhere else: a SQL database, Cosmos DB, MongoDB, an OData or search service. That process cannot run your C# code, so the query must be translated into something it understands (usually SQL) and shipped there. LINQ does this with IQueryable<T>: the Queryable operators take Expression<Func<…>> instead of Func<…>, so each Where/Select/OrderBy just adds a node to an expression tree; nothing runs until you enumerate, then the query provider (EF Core) translates the whole tree to one SQL statement, sends it, and materializes the rows into objects. The skills interviewers check: knowing exactly where the boundary between SQL and C# falls (AsEnumerable, ToList, a Func parameter), avoiding untranslatable code, N+1 queries, over-fetching, and multiple enumeration, and reading the generated SQL (ToQueryString()).