What are navigation properties and how do they relate to foreign keys?
Ask by ICSM Computer
Updated 15 Jun 2025
Basic Example
Relationship:
Enrollment.StudentIdis a foreign key.Enrollment.Studentis a navigation property to the relatedStudent.Student.Enrollmentsis a collection navigation property (one-to-many).How Navigation Properties Relate to Foreign Keys
StudentId)Example Usage
Types of Navigation Properties
Enrollment.StudentStudent.EnrollmentsHow EF Handles Relationships
EF can infer relationships using:
modelBuilder) or Data AnnotationsBenefits of Navigation Properties
Include,SelectMany, etc.Summary
Let me know if you'd like: