1
Consider the following classes:
public class Pessoa
{
public int Id { get; set; }
public string Nome { get; set; }
public Telefone Telefone { get; set; }
}
public class Telefone
{
public string Numero { get; set; }
public string Descricao { get; set; }
public Operadora Operadora { get; set; }
}
public class Operadora
{
public string Descricao { get; set; }
public string Codigo { get; set; }
}
In the database (SQL Server) I want to have the following table:
+-------------------------------------------------------------------------+
| PessoaDados |
+----+------+--------+-----------+---------------------+------------------+
| Id | Nome | Numero | Descricao | Operadora_Descricao | Operadora_Codigo |
+----+------+--------+-----------+---------------------+------------------+
I’m using Entity Framework 6 Migrations, but when running the update command, Entity complains that the Phone class does not have Id.
I searched for Dataannotations, but I couldn’t find anything that would help.
Using Codefirst, it is possible to plan tables the way I am trying?
version is 6 or Core?
– novic
@Virgilionovic updated the question with the version. It would be the same EF 6.
– Jedaias Rodrigues
And then friend tested the answer???
– novic