4
I have the following 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; }
}
Using the Migration
, he creates for me the table in the bank: TurmaAluno
, and I would like him to create Area_Cursos_TurmaAluno
.
I tried the following:
modelBuilder.Entity<Aluno>()
.HasMany(t=>t.Turmas)
.WithMany(a => a.Alunos)
.Map(m => m.MapLeftKey("Turma_TurmaID")
.MapRightKey("Aluno_AlunoID")
.ToTable("Area_Cursos_TurmaAluno"));
Apparently it worked. That’s right?
This is called Fluent API?
– Diego Zanardo
@Exact Diegozanardo. http://msdn.microsoft.com/en-us/data/jj591617.aspx
– Leonel Sanches da Silva