LINQ (Language Integrated Query) gives C# a uniform way to fetch, filter, transform, sort, and aggregate data from different sources. In an EF Core API, it lets CRUD code work with C# objects and query operators instead of writing database-specific SQL for every operation. section 5.0 section 5.1
LINQ queries commonly use two equivalent styles:
- Query syntax resembles SQL: select board games where Year equals 2000. section 5.1.1
- Method syntax uses standard C# methods and lambda expressions, such as Where(bg => bg.Year == 2000). section 5.1.1
- Standard operators support filtering, projection, aggregation, sorting, and other query-like operations. section 5.1.1
LINQ works over IEnumerable<T> collections and IQueryable<T> queries. With EF Core, a DbSet<T> exposes IQueryable<T>, so chained operators build an expression tree. EF Core translates that representation into database-specific SQL, and execution occurs when the query is materialized, for example with ToArray(). section 5.1.3 section 5.7
Filtering board games
Given an array containing Axis & Allies, Citadels, and Terraforming Mars, query syntax can select the game published in 2000: `var boardgames = from bg in data where bg.Year == 2000 select bg;`. Method syntax expresses the same operation as `var boardgames = data.Where(bg => bg.Year == 2000);`. section 5.1.1
var query = _context.BoardGames .Where(b => b.Year == 2020) .OrderBy(b => b.Name);
A chained EF Core query filters board games by year and orders them by name, illustrating composable method syntax. section 5.1.3


