I am trying to map between these two classes, where in championship I have a list of all steps related to the championship
Follow 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 a
[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