Associative entity EF mapping with Fluent API [closed]

3

I would like to know how to do a mapping without using ICollection , or it might even be using, but I would not want the bank to create a class, just to link the two classes.

class Pessoa
{
   public Guid IdPessoa { get; set; }
   public string Nome { get; set; }
}

class Telefone
{
   public Guid IdTelefone { get; set; }   
   public string Numero { get; set; }
   public virtual ICollection<Pessoa> PessoasList { get; set; }
}

In the mapping the system would create the Pessoa entity, the Telefone entity and would create a PessoaTelefone entity with only the Ids, and I would like to have only the Pessoa and Telefone a IdPessoa na as foreign key in the Telefone entity. I want EF to create the class without this weak entity.

Is there a way to do this, or do I have to map on the nail informing the id on the phone and at the time of persistence retrieve the recorded id and persist the other entity?

    
asked by anonymous 22.06.2015 / 17:24

0 answers