Tenho as seguintes classes:
[Table("Area_Cursos_Turma")]
public class Turma
{
public int TurmaID { get; set; }
public virtual ICollection<Aluno> Alunos { get; set; }
}
[Table("Area_Cursos_Aluno")]
public class Aluno
{
public int AlunoID { get; set; }
public virtual ICollection<Turma> Turmas { get; set; }
}
Utilizando o Migration
, ele cria para mim a tabela no banco: TurmaAluno
, e gostaria que ele criasse Area_Cursos_TurmaAluno
.
Tentei o seguinte:
modelBuilder.Entity<Aluno>()
.HasMany(t=>t.Turmas)
.WithMany(a => a.Alunos)
.Map(m => m.MapLeftKey("Turma_TurmaID")
.MapRightKey("Aluno_AlunoID")
.ToTable("Area_Cursos_TurmaAluno"));
Aparentemente deu certo. Está certo isso?