Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aspnetcore/data/ef-rp/complex-data-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ The `Enrollment` join entity defines its own PK, so duplicates of this sort are

Update `Data/SchoolContext.cs` with the following code:

[!code-csharp[](intro/samples/cu50/Data/SchoolContext.cs?name=snippet_SS&highlight=15-17,21-28)]
[!code-csharp[](intro/samples/cu50/Data/SchoolContext.cs?name=snippet_SS&highlight=15-17,21-29)]

<!-- TODO review -->
The preceding code adds the new entities and configures the many-to-many relationship between the `Instructor` and `Course` entities.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasMany(c => c.Instructors)
.WithMany(i => i.Courses);
modelBuilder.Entity<Student>().ToTable(nameof(Student));
modelBuilder.Entity<Enrollment>().ToTable("Enrollment");
modelBuilder.Entity<Instructor>().ToTable(nameof(Instructor));
modelBuilder.Entity<Department>()
.Property(d => d.ConcurrencyToken)
Expand Down Expand Up @@ -58,6 +59,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasMany(c => c.Instructors)
.WithMany(i => i.Courses);
modelBuilder.Entity<Student>().ToTable(nameof(Student));
modelBuilder.Entity<Enrollment>().ToTable("Enrollment");
modelBuilder.Entity<Instructor>().ToTable(nameof(Instructor));
}
}
Expand Down
Loading