Writing LINQ queries
Although we wrote a few LINQ queries in Chapter 8, Working with Databases Using the Entity Framework Core, I didn't properly explain how LINQ works.
LINQ has several parts; some are required and some are optional:
Extension methods (required): These include examples like
Where
,OrderBy
,Select
, and so on. These are what provide the functionality of LINQ.LINQ providers (required): These include LINQ to Objects, LINQ to Entities, LINQ to XML, LINQ to OData, LINQ to Amazon, and so on are LINQ providers. These are what convert standard LINQ operations into specific commands for different types of data.
Lambda expressions (optional): These can be used instead of named methods to simplify LINQ extension method calls.
LINQ query comprehension syntax (optional): These include
from
,in
,where
,orderby
,descending
,select
, and so on. These are C# keywords that are an alias for some of the LINQ extension methods, and their use can simplify the queries you write, especially if you...