Skip to content

Commit 8cbae10

Browse files
CopilotwadepickettCopilot
authored
Fix typo and clarity in section of EF Core Razor Pages "Read Related Data" tutorial (#37539)
* Initial plan * Fix typo: "filter select" -> "filter selects" in read-related-data.md Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com> * Small edit pass to related section. * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com> Co-authored-by: wadepickett <wpickett@microsoft.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent c680a4e commit 8cbae10

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

aspnetcore/data/ef-rp/read-related-data.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
---
22
title: Part 6, Razor Pages with EF Core in ASP.NET Core - Read Related Data
3+
ai-usage: ai-assisted
34
author: tdykstra
45
description: Part 6 of Razor Pages and Entity Framework tutorial series.
56
ms.author: tdykstra
6-
ms.date: 09/28/2019
7+
ms.date: 08/27/2026
8+
ms.reviewer: tdykstra
79
uid: data/ef-rp/read-related-data
810
---
911

@@ -25,9 +27,9 @@ The following illustrations show the completed pages for this tutorial:
2527

2628
## Eager, explicit, and lazy loading
2729

28-
There are several ways that EF Core can load related data into the navigation properties of an entity:
30+
EF Core can load related data into the navigation properties of an entity in several ways:
2931

30-
* [Eager loading](/ef/core/querying/related-data#eager-loading). Eager loading is when a query for one type of entity also loads related entities. When an entity is read, its related data is retrieved. This typically results in a single join query that retrieves all of the data that's needed. EF Core will issue multiple queries for some types of eager loading. Issuing multiple queries can be more efficient than a large single query. Eager loading is specified with the <xref:Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.Include%2A> and <xref:Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ThenInclude%2A> methods.
32+
* [Eager loading](/ef/core/querying/related-data#eager-loading). Eager loading is when a query for one type of entity also loads related entities. When you read an entity, EF Core retrieves its related data. This approach typically results in a single join query that retrieves all of the data you need. EF Core issues multiple queries for some types of eager loading. Issuing multiple queries can be more efficient than a large single query. Specify eager loading with the <xref:Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.Include%2A> and <xref:Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ThenInclude%2A> methods.
3133

3234
![Eager loading example](read-related-data/_static/eager-loading.png)
3335

@@ -36,17 +38,17 @@ There are several ways that EF Core can load related data into the navigation pr
3638
* One query for the main query
3739
* One query for each collection "edge" in the load tree.
3840

39-
* Separate queries with `Load`: The data can be retrieved in separate queries, and EF Core "fixes up" the navigation properties. "Fixes up" means that EF Core automatically populates the navigation properties. Separate queries with `Load` is more like explicit loading than eager loading.
41+
* Separate queries with `Load`: You can retrieve the data in separate queries, and EF Core "fixes up" the navigation properties. "Fixes up" means that EF Core automatically populates the navigation properties. Separate queries with `Load` is more like explicit loading than eager loading.
4042

4143
![Separate queries example](read-related-data/_static/separate-queries.png)
4244

43-
**Note:** EF Core automatically fixes up navigation properties to any other entities that were previously loaded into the context instance. Even if the data for a navigation property is *not* explicitly included, the property may still be populated if some or all of the related entities were previously loaded.
45+
**Note:** EF Core automatically fixes up navigation properties to any other entities that it previously loaded into the context instance. Even if you don't explicitly include the data for a navigation property, the property might still be populated if some or all of the related entities were previously loaded.
4446

45-
* [Explicit loading](/ef/core/querying/related-data#explicit-loading). When the entity is first read, related data isn't retrieved. Code must be written to retrieve the related data when it's needed. Explicit loading with separate queries results in multiple queries sent to the database. With explicit loading, the code specifies the navigation properties to be loaded. Use the `Load` method to do explicit loading. For example:
47+
* [Explicit loading](/ef/core/querying/related-data#explicit-loading). When you first read the entity, EF Core doesn't retrieve related data. You must write code to retrieve the related data when it's needed. Explicit loading with separate queries results in multiple queries sent to the database. With explicit loading, you specify the navigation properties to load. Use the `Load` method to do explicit loading. For example:
4648

4749
![Explicit loading example](read-related-data/_static/explicit-loading.png)
4850

49-
* [Lazy loading](/ef/core/querying/related-data#lazy-loading). When the entity is first read, related data isn't retrieved. The first time a navigation property is accessed, the data required for that navigation property is automatically retrieved. A query is sent to the database each time a navigation property is accessed for the first time. Lazy loading can hurt performance, for example when developers use [N+1 queries](https://www.bing.com/search?q=N%2B1+queries). N+1 queries load a parent and enumerate through children.
51+
* [Lazy loading](/ef/core/querying/related-data#lazy-loading). When you first read the entity, EF Core doesn't retrieve related data. The first time you access a navigation property, EF Core automatically retrieves the data required for that navigation property. EF Core sends a query to the database each time you access a navigation property for the first time. Lazy loading can hurt performance, for example when developers use [N+1 queries](https://www.bing.com/search?q=N%2B1+queries). N+1 queries load a parent and enumerate through children.
5052

5153
## Create Course pages
5254

@@ -219,7 +221,7 @@ The following code executes when an instructor is selected, that is, `id != null
219221

220222
The selected instructor is retrieved from the list of instructors in the view model. The view model's `Courses` property is loaded with the `Course` entities from the selected instructor's `Courses` navigation property.
221223

222-
The `Where` method returns a collection. In this case, the filter select a single entity, so the `Single` method is called to convert the collection into a single `Instructor` entity. The `Instructor` entity provides access to the `Course` navigation property.
224+
The `Where` method returns a collection. In this case, the filter selects a single entity, so the `Single` method is called to convert the collection into a single `Instructor` entity. The `Instructor` entity provides access to the `Course` navigation property.
223225

224226
The <xref:System.Linq.Enumerable.Single%2A> method is used on a collection when the collection has only one item. The `Single` method throws an exception if the collection is empty or if there's more than one item. An alternative is <xref:System.Linq.Enumerable.SingleOrDefault%2A>, which returns a default value if the collection is empty. For this query, `null` in the default returned.
225227

@@ -302,7 +304,7 @@ The following illustrations show the completed pages for this tutorial:
302304

303305
## Eager, explicit, and lazy loading
304306

305-
There are several ways that EF Core can load related data into the navigation properties of an entity:
307+
EF Core can load related data into the navigation properties of an entity in several ways:
306308

307309
* [Eager loading](/ef/core/querying/related-data#eager-loading). Eager loading is when a query for one type of entity also loads related entities. When an entity is read, its related data is retrieved. This typically results in a single join query that retrieves all of the data that's needed. EF Core will issue multiple queries for some types of eager loading. Issuing multiple queries can be more efficient than a giant single query. Eager loading is specified with the `Include` and `ThenInclude` methods.
308310

@@ -313,13 +315,13 @@ There are several ways that EF Core can load related data into the navigation pr
313315
* One query for the main query
314316
* One query for each collection "edge" in the load tree.
315317

316-
* Separate queries with `Load`: The data can be retrieved in separate queries, and EF Core "fixes up" the navigation properties. "Fixes up" means that EF Core automatically populates the navigation properties. Separate queries with `Load` is more like explicit loading than eager loading.
318+
* Separate queries with `Load`: You can retrieve the data in separate queries, and EF Core "fixes up" the navigation properties. "Fixes up" means that EF Core automatically populates the navigation properties. Separate queries with `Load` is more like explicit loading than eager loading.
317319

318320
![Separate queries example](read-related-data/_static/separate-queries.png)
319321

320-
**Note:** EF Core automatically fixes up navigation properties to any other entities that were previously loaded into the context instance. Even if the data for a navigation property is *not* explicitly included, the property may still be populated if some or all of the related entities were previously loaded.
322+
**Note:** EF Core automatically fixes up navigation properties to any other entities that it previously loaded into the context instance. Even if you don't explicitly include the data for a navigation property, the property might still be populated if some or all of the related entities were previously loaded.
321323

322-
* [Explicit loading](/ef/core/querying/related-data#explicit-loading). When the entity is first read, related data isn't retrieved. Code must be written to retrieve the related data when it's needed. Explicit loading with separate queries results in multiple queries sent to the database. With explicit loading, the code specifies the navigation properties to be loaded. Use the `Load` method to do explicit loading. For example:
324+
* [Explicit loading](/ef/core/querying/related-data#explicit-loading). When you first read the entity, EF Core doesn't retrieve related data. You must write code to retrieve the related data when it's needed. Explicit loading with separate queries results in multiple queries sent to the database. With explicit loading, you specify the navigation properties to load. Use the `Load` method to do explicit loading. For example:
323325

324326
![Explicit loading example](read-related-data/_static/explicit-loading.png)
325327

@@ -615,7 +617,7 @@ The following illustrations show the completed pages for this tutorial:
615617

616618
## Eager, explicit, and lazy Loading of related data
617619

618-
There are several ways that EF Core can load related data into the navigation properties of an entity:
620+
EF Core can load related data into the navigation properties of an entity in several ways:
619621

620622
* [Eager loading](/ef/core/querying/related-data#eager-loading). Eager loading is when a query for one type of entity also loads related entities. When the entity is read, its related data is retrieved. This typically results in a single join query that retrieves all of the data that's needed. EF Core will issue multiple queries for some types of eager loading. Issuing multiple queries can be more efficient than was the case for some queries in EF6 where there was a single query. Eager loading is specified with the `Include` and `ThenInclude` methods.
621623

0 commit comments

Comments
 (0)