Tutorials Entity Framework Core Tutorial
Navigation Properties in EF Core
Navigation Properties in EF Core: free step-by-step lesson with examples, common mistakes, and interview tips — part of Entity Framework Core Tutorial on Toolliyo Academy.
On this page
Entity Framework Core Tutorial · Lesson 44 of 100
Navigation Properties in EF Core
Beginner ✓ → Intermediate ✓ → Advanced → Professional
Advanced · 3 — Production skills · ~6 min · Module 5: Relationships
What is this?
Navigation properties are object references connecting related entities — Product.Category, Order.Customer, Order.Items — enabling graph traversal in LINQ.
Why should you care?
ShopNest code reads order.Customer.Email instead of manual join keys — navigations express business relationships in C#.
See it live — copy this example
Paste into a .NET project with EF Core packages, then run with LocalDB/SQL Server (dotnet ef / dotnet run).
var emails = await _context.Orders
.Where(o => o.OrderDate >= DateTime.UtcNow.AddDays(-7))
.Select(o => new
{
o.Id,
Email = o.Customer!.Email,
Lines = o.Items.Count
})
.ToListAsync();
What happened?
- o.Customer.Email translates to JOIN Customers on CustomerId.
- Items.Count becomes subquery or join COUNT — EF picks SQL shape.
Practice next
- Define FK scalar + navigation on both ends when possible.
- Use null-forgiving or required keyword for non-nullable navigations.
- Prefer Select through navigations over Include when shaping DTOs.
- Make Customer navigation optional on Order for guest checkout modeling.
- Navigate Product.Category.Name in filter without Include.
Remember
Navigations represent relationships in C#. Pair with FK properties for clarity. Use in Select for typed joins.
ShopNest weekly order digest
Job projects customer email via Order.Customer navigation in one LINQ query.
Outcome: Clean C# expressing business path Customer ← Order.
Interview prep for this lesson
Practice these questions aloud after reading—each links to a full structured answer.
Sign in to ask a question or upvote helpful answers.
No questions yet — be the first to ask!