1
I’m trying to map between these two classes, where in championship I have a list of all stages related to the championship
Follows the classes,
[Table("ETAPA")]
public class Etapa
{
[Key]
public int Id { get; set; }
[Column("ETAPA_NUMERO")]
public int EtapaNumero { get; set; }
[Column("DATA_EVENTO")]
public DateTime DataEvento { get; set; }
[Column("CIDADE")]
public string Cidade { get; set; }
[Column("STATUS")]
public int Status { get; set; }
[Column("FKID_CAMP")] //minha FK**
public int IdCamp { get; set; }
[ForeignKey("IdCamp")]
public virtual Campeonato Campeonato { get; set; }
}
and the
[Table("CAMPEONATO")]
public class Campeonato
{
public Campeonato()
{
Etapas = new HashSet<Etapa>();
}
[Key]
[Column("ID")]
public int Id { get; set; }
[Column("DESCRICAO")]
public string Descricao { get; set; }
[Column("ANO")]
public int Ano { get; set; }
public virtual ICollection<Etapa> Etapas { get; set; }
}
I need to know how to make this relationship using EF 6.0
The relationship is already done. There is something that is not working properly?
– Leonel Sanches da Silva
The 'Steps' property is coming null, but there is data in the database
– Luciano Azevedo
What code are you using to get Stages? And Championships?
– Leonel Sanches da Silva
Sorry man !!! , was missing the include on the call, Thank you
– Luciano Azevedo