Y at-il quelqu'un qui pourrait me dire comment puis-je faire le mappage de table correspondant avec le code de l'infrastructure d'abord. Voici ma tableEntity framework 4.1 relation à la table itselft
j'ai essayé de le faire, mais sans succès.
[Table("Matiere")]
public class Matiere
{
[Key]
public Int32 Id { get; set; }
public Int32? IdParent { get; set; }
[Column("NomMatiere")]
public String Nom { get; set; }
public virtual Matiere Parent { get; set; }
public virtual ICollection<Matiere> Childs { get; set; }
}
public class MatiereConfiguration : EntityTypeConfiguration<Matiere>
{
public MatiereConfiguration()
{
this.HasOptional(m => m.Parent).WithMany(m => m.Childs).HasForeignKey(m => m.IdParent);
this.HasOptional(m => m.Childs).WithRequired();
}
}
merci d'avance.