Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

note Select is used to project elements into a sequence

クローズ
#37,178 コメント 3 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@tdykstra がすでに取り組んでいます。

2026年5月21日 から。

評価

この issue はまだ評価されていません。

説明

aspnet-core/svc data-access/subsvc Source - Docs.ms
Description

In the section: Loading related data with Select,

I am not sure how the Select function really fits into the context of the differences between eager and lazy loading. (I've always been a little fuzzy here. I just always use eager loading when I need a nav prop filled)

But if this example should go here I would explain the fact that the Selection function being used here projects elements of a sequence into a new form be it a view model or a var variable capable of holding an anonymous type.

Your View Model projection example:

public IList CourseVM { get; set; }

public async Task OnGetAsync()
{
    CourseVM = await _context.Courses
    .Select(p => new CourseViewModel
    {
        CourseID = p.CourseID,
        Title = p.Title,
        Credits = p.Credits,
        DepartmentName = p.Department.Name
    }).ToListAsync();
}

My inline anonymous object example:

 var coursesProjected = await _context.Courses
 .Select(p => new 
 {
     CourseID = p.CourseID,
     Title = p.Title,
     Credits = p.Credits,
     DepartmentName = p.Department.Name
 }).ToListAsync();

coursesProjected has to be of type var here to work.

Page URL

https://learn.microsoft.com/en-us/aspnet/core/data/ef-rp/read-related-data?view=aspnetcore-10.0&tabs=visual-studio

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/data/ef-rp/read-related-data.md

Document ID

3cb264da-2ff1-1256-572f-aa4ebca6e255

Platform Id

5d8ba75a-678a-21ac-469c-05e8afe24128

Article author

@tdykstra

Metadata
  • ID: d0026f69-7e5d-0d3e-5586-16ecc0656ff0
  • PlatformId: 5d8ba75a-678a-21ac-469c-05e8afe24128
  • Service: aspnet-core
  • Sub-service: data-access

Related Issues

主要言語
C#
スター
13.1k
フォーク
24.5k
平均マージ
3日 6時間
マージ済み PR(30日)
210

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dotnet/AspNetCore.Docs のほかの issue

dotnet/AspNetCore.Docs の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。