From the course: .NET Essentials: LINQ for Databases
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Projection, get fewer columns - .NET Tutorial
From the course: .NET Essentials: LINQ for Databases
Projection, get fewer columns
- In this chapter, we'll look at query techniques and interesting tools for querying the data. We'll start by looking at ways to reduce the amount of data return from a database query. There are several ways to handle this in LINQ. What I'm looking at in this video is the where extension method and the select extension method which are also the where and select clauses when we're using the query expression. The where clause is used to filter the number of rows that are returned and the select clause, also known as projection, is used to filter the number of columns returned. So what I do in starting here in this code, is I count the number of rows in the customers table, and I see there are 91 rows. Then I use a where clause here in my query expression to filter the list to only rows where the city name starts with the capital letter, uppercase S. When output that information, I see there's 12 items, so we did…
Contents
-
-
-
-
-
-
-
(Locked)
Projection, get fewer columns2m 19s
-
(Locked)
Paging with Take and Skip1m 49s
-
(Locked)
Use Find for faster search by key1m 58s
-
(Locked)
Use EF navigation properties instead of joins3m 4s
-
(Locked)
Use the Contains method for1m 36s
-
(Locked)
Organize query results into groups with GroupBy3m 7s
-
(Locked)
Flatten child collections with SelectMany1m 36s
-
(Locked)
Find data within a date range1m 20s
-
(Locked)
-