[英]UpdateGraph with self referencing entity
我正在使用带有EF的GraphDiff来更新从REST服务获取的断开连接对象的状态。
从现在开始,它运行良好,但我遇到了自引用实体的问题。
实体:
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调用:
DataContext.UpdateGraph(entity, map => map
.OwnedCollection(e => e.Bars,
with => with.OwnedCollection(b => b.Children)
)
);
好吧,这最后一个图调用仅更新1级递归。 我将如何不加更新地更新递归的深度?
GraphDiff当前不支持通过流畅的API映射非预定深度的递归关系。 同样,基于圆形的新基于属性的映射也会引发异常。 因此,恐怕您现在无法对此进行映射,但是我已经提出了一个问题 ,请看看是否可以添加对此的支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.