Update read-related-data.md (#17773)
* Update read-related-data.md Add an explanation of why AsNoTracking method was not used. Fix #17764 * Update read-related-data.md * Update read-related-data.md Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>pull/17781/head
parent
a97478f0a3
commit
2239b40568
|
@ -132,6 +132,8 @@ The following code loads related data with the `Select` method:
|
||||||
|
|
||||||
[!code-csharp[](intro/samples/cu30snapshots/6-related/Pages/Courses/IndexSelect.cshtml.cs?name=snippet_RevisedIndexMethod&highlight=6)]
|
[!code-csharp[](intro/samples/cu30snapshots/6-related/Pages/Courses/IndexSelect.cshtml.cs?name=snippet_RevisedIndexMethod&highlight=6)]
|
||||||
|
|
||||||
|
The preceding code doesn't return any entity types, therefore no tracking is done. For more information about the EF tracking, see [Tracking vs. No-Tracking Queries](/ef/core/querying/tracking).
|
||||||
|
|
||||||
The `CourseViewModel`:
|
The `CourseViewModel`:
|
||||||
|
|
||||||
[!code-csharp[](intro/samples/cu30snapshots/6-related/Models/SchoolViewModels/CourseViewModel.cs?name=snippet)]
|
[!code-csharp[](intro/samples/cu30snapshots/6-related/Models/SchoolViewModels/CourseViewModel.cs?name=snippet)]
|
||||||
|
|
Loading…
Reference in New Issue