Answer the question
In order to leave comments, you need to log in
Entity framework relationship parrent children in same table
table
ID
doc_number
parrent_doc_number
I didn't make the table, I can't change it to refer to id. how to connect them in the model?
so that you can access them
public virtual Payment ParentPayment { get; set; }
public virtual ICollection ChildPayments { get; set; }
Answer the question
In order to leave comments, you need to log in
What if you try like this?
public class Payment
{
[Key]
public int doc_number{ get; set; }
public int? parrent_doc_number{ get; set; }
public virtual Payment parrent { get; set; }
или
public virtual Payment parrent_ { get; set; }
public virtual ICollection ChildPayments { get; set; }
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question