Entity Framework API 사용 많은 관계를 많은 관계로 매핑하는 다음 두 가지 방법을 계속 사용하고 있습니까? 나는 두 번째 옵션을 사용한 적이 없다 ... 차이점은 무엇인가?Entity Framework에서 Fluent API를 사용하여 Many To Many Relationship 만들기
옵션 1 :
modelBuilder.Entity<Student>()
.HasMany(p => p.Lessons)
.WithMany()
.Map(m =>
{
m.MapLeftKey("Id");
m.MapRightKey("Id");
m.ToTable("StudentAndLessons");
});
정확히 MapLeftKey
및 MapRightKey
는 무엇입니까 : 2
modelBuilder.Entity<Student>()
.HasMany(p => p.Lessons)
.WithMany();
옵션? 언제 그것을 사용하고 어떤 이점이 있습니까?