Simple Code
Simple Code

Reputation: 2574

How to update self-reference graph using GraphDiff?

I am using GraphDiff to update entity framework graphs and when I am trying to update self-referenced graph like this way:

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

updatedStorageRequest is model which contains PhysicalObjects which are self-referenced data.

It will persist only the first PhysicalObject and it deletes all SubPhysicalObjects(the updatedStorageRequest it contains correct data with SubPhysicalObjects for each level in the hierarchy).

How can I update graph using GraphDiff when there is self-referenced model?

Upvotes: 0

Views: 106

Answers (1)

Simple Code
Simple Code

Reputation: 2574

I have ended up with the fact that GraphDiff currently doesn't support mapping of recursive relationships of non-predetermined depth via the fluent API.

Upvotes: 0

Related Questions