Junior EF Core

What is projection (Select) and why is it useful?

  • Projection transforms entities into custom shapes, e.g., DTOs.

var projected = context.Products

.Select(p => new { p.Name, p.Price });

  • Useful for:
  • Reducing data load.
  • Returning only needed fields.
  • Mapping to custom types.

More from Entity Framework Core Tutorial

All questions for this course