I am successfully using a self referencing table in entity framework. But I can't figure out how to get the records of the desired depth ?
What should be the logic for this ?
Model :
public class FamilyLabel
{
public FamilyLabel()
{
this.Children = new Collection<FamilyLabel>();
this.Families = new Collection<Family>();
}
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int FamilyLabelId { get; set; }
public string FamilyLabelName { get; set; }
public virtual FamilyLabel Parent { get; set; }
public int JamaatId { get; set; }
public virtual Jamaat Jamaat { get; set; }
public virtual ICollection<Family> Families { get; set; }
public virtual ICollection<FamilyLabel> Children { get; set; }
}