How to update self-reference graph using GraphDiff?

c# entity-framework graphdiff

Question

I update entity framework graphs using GraphDiff, and when I want to update a self-referenced graph, I do it as follows:

 dbContext.UpdateGraph(updatedStorageRequest, storageRequestMap => storageRequestMap
                    .OwnedCollection(oc => oc.PhysicalObjects, physicalObjectMap => physicalObjectMap
                           .OwnedCollection(oc => oc.SubPhysicalObjects))
                );

A model called updatedStorageRequest has PhysicalObjects, which are self-referenced data.

Only the first PhysicalObject will be preserved, and all SubPhysicalObjects will be deleted (the updatedStorageRequest it contains correct data with SubPhysicalObjects for each level in the hierarchy).

How can I use GraphDiff to update the graph in the presence of a self-referenced model?

1
0
11/30/2017 1:34:38 PM

Popular Answer

I've come to the conclusion that the fluent API of GraphDiff does not presently enable mapping of recursive connections with non-predetermined depth.

0
12/3/2017 7:55:02 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow