سلام
دوتا کلاس زیر را داریم
public class City
{
public City()
{
}
public int CityId { get; set; }
public string Name { get; set; }
public int CityTypeId { get; set; }
[ForeignKey(nameof(CityTypeId))]
public virtual CityType CityType { get; set; }
public int ParentId { get; set; }
}
public class CityType
{
public CityType()
{
}
public int CityTypeId { get; set; }
public string Name { get; set; }
public virtual ICollection<City> Cities { get; set; }
}
که
public int ParentId { get; set; }
که id خود جدول می باشد
چگونه می توانم تعریف کنم که ارجاع از خود id همین جدول است
برنامه در mvccore است