есть ли кто-нибудь, кто мог бы сказать мне, как я могу выполнить соответствующее сопоставление таблиц с сущностью. Вот мой столEntity framework 4.1 отношение к таблице itselft
я пытался это сделать, но без какого-либо успеха.
[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();
}
}
благодарит заранее.