I'm using GraphDiff with EF to update state of disconnected objects acquired from a REST Service.
It's working rather well from now but I got a problem with self referencing entities.
Entities :
public class Foo {
[Key]
public int Id { get; set; }
public virtual ICollection<Bar> Bars { get; set; }
public Foo() {
Bars = new HashSet<Bar>();
}
}
public class Bar {
[Key]
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<Bar> Children { get; set; }
public Bar() {
Children = new HashSet<Bar>();
}
}
UpdateGraph call :
DataContext.UpdateGraph(entity, map => map
.OwnedCollection(e => e.Bars,
with => with.OwnedCollection(b => b.Children)
)
);
Well this last graph call only updates 1 level of recursivity. How would I go to update no mater how deep the recursion is ?