Optimal Nen Queries, Part 1: Delayed Execution

Nen is  a LINQ provider and as such uses delayed execution. Delayed execution means that whenever a query is written it’s not actually performed until the result set is being accessed, which is often by enumeration. Consider the following: [code]var workOrdersQuery = DataContext.Current.Get<EventWorkOrder>() .Where(t => t.WONumber == 3); // No query has been performed yet! var workOrdersCount = workOrdersQuery.Count(); // This runs the query of SELECT COUNT(*)  FROM slx_EventWorkOrder …. var workOrdersList = workOrdersQuery.ToList(); // This runs a query joining in all related […]

Read More…