Answer the question
In order to leave comments, you need to log in
Is it possible to cascade data using Entity Framework?
There are two classes: "ancestor" and "heirs". The class "ancestor" has a collection of heirs. It is possible to insert data cascadingly without doing a breadth or depth traversal (keep the ancestor, get the id, update the object, and then insert all descendants):
Predok nas = new Predok{Name = "Вася"}
db.Predok.add(nas);
db.SafeChange();
//взять id, обновить вставленного предка и вставлять всех наследников
List<Naslednik> Nasled = new <Naslednik>();
//заполняем List<Naslednik>
var PredokIn = new Predok {Name = "Вася", Nasledniki = Nasled}
db.Predok.add(PredokIn);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question