document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.     public class MyEntities : DbContext
  2.     {
  3.         public DbSet<Pessoa> Pessoas { get; set; }
  4.         public DbSet<Endereco> Enderecos { get; set; }
  5.  
  6.         public MyEntities()
  7.             : base("Repositorio") { }
  8.  
  9.         protected override void OnModelCreating(DbModelBuilder mb)
  10.         {
  11.             mb.Entity<Pessoa>()
  12.                 .HasMany(p => p.Enderecos)
  13.                 .WithMany(e => e.Pessoas)
  14.                 .Map(m => m.MapLeftKey("EnderecoId")
  15.                     .MapRightKey("PessoaId")
  16.                     .ToTable("Enderecos_Pessoas"));
  17.  
  18.             base.OnModelCreating(mb);
  19.         }
  20.     }
  21.  
');