Chapter 3 provided examples of LINQ query expressions and method call syntax for Standard Query Operators (SQOs) by group. The data sources for queries were collections of relatively simple business objects. The objects included public fields of generic types and generic collections, but these fields were empty. The LINQ query expressions used
GroupJoins to emulate relationships, where appropriate.
This chapter covers more complex LINQ queries over collections of object graphs that emulate real-world business entities, such as customers, orders, employees, suppliers, and products, by taking advantage of the relationships between the entities. Object graphs are tree-like representations for describing collections and instances of objects and hierarchies of their dependent and related objects. An object graph provides an internally consistent view of an application's data.
Much of this chapter is devoted to explaining complex aggregate queries that use the
Sum() SQOs primarily, along with the
Avg(), Min(), and
Max() operators, with or without the join and grouping operators —
Join(), GroupBy(), and
GroupJoin(). You'll also see examples of left outer joins implemented by nested
Other advanced topics covered by this chapter are unconventional use of the
Contains() SQO for widening
Where clause filters and substitutes for T-SQL's
IN() function, compiling specific types ...