Skip to content

Commit f5dcda4

Browse files
authored
Merge pull request #37392 from dotnet/main
Merge to Live
2 parents 400be0d + 2b377ee commit f5dcda4

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

aspnetcore/data/ef-rp/complex-data-model.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ The `Enrollment` join entity defines its own PK, so duplicates of this sort are
501501

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

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

506506
<!-- TODO review -->
507507
The preceding code adds the new entities and configures the many-to-many relationship between the `Instructor` and `Course` entities.

aspnetcore/data/ef-rp/intro/samples/cu50/Data/SchoolContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
2424
.HasMany(c => c.Instructors)
2525
.WithMany(i => i.Courses);
2626
modelBuilder.Entity<Student>().ToTable(nameof(Student));
27+
modelBuilder.Entity<Enrollment>().ToTable("Enrollment");
2728
modelBuilder.Entity<Instructor>().ToTable(nameof(Instructor));
2829
modelBuilder.Entity<Department>()
2930
.Property(d => d.ConcurrencyToken)
@@ -58,6 +59,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
5859
.HasMany(c => c.Instructors)
5960
.WithMany(i => i.Courses);
6061
modelBuilder.Entity<Student>().ToTable(nameof(Student));
62+
modelBuilder.Entity<Enrollment>().ToTable("Enrollment");
6163
modelBuilder.Entity<Instructor>().ToTable(nameof(Instructor));
6264
}
6365
}

0 commit comments

Comments
 (0)