title: Many to many relationships in EF5 Code First, how can I specify table name?
body: <p>I'm quite new to EF, and I'm not really sure how to do this.</p>
  
  <p>I have a many-to-many relationship, exactly like this:</p>
  
  <p><img src="https://i.stack.imgur.com/HNb3M.png" alt="enter image description here"></p>
  
  <p>When I try to add a resource (Recurso) to a profile (Perfil), I get the following error:</p>
  
  <p><code>Invalid object name 'dbo.RecursoPerfils</code></p>
  
  <p>Where the hell did <code>RecursoPerfils</code> come from?</p>
  
  <p>How can I specify (preferably through attribute annotation) the table name for this relationship?</p>
  
  <p>See the models below:</p>
  
  <pre><code>[Table("Perfil")]
  public class Perfil
  {
      public Perfil()
      {
          this.Usuarios = new List&lt;Usuario&gt;();
          this.Recursos = new List&lt;Recurso&gt;();
      }
  
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      [Key]
      public int IdPerfil { get; set; }
      [Required]
      public string Descricao { get; set; }
  
      public virtual ICollection&lt;Usuario&gt; Usuarios { get; set; }
      public virtual ICollection&lt;Recurso&gt; Recursos { get; set; }
  }
  
  [Table("Recurso")]
  public class Recurso
  {
      public Recurso()
      {
          this.Perfis = new List&lt;Perfil&gt;();
      }
  
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      [Key]
      public int IdRecurso { get; set; }
      [Required]       
      public string NomeRecurso { get; set; }
      [Required]
      public string Descricao { get; set; }
      public virtual ICollection&lt;Perfil&gt; Perfis { get; set; }
  }
  </code></pre>