Imagine this graph:
Device 1..* OperatingEnvironment 1..* NetworkEndpoint
If I construct a detached entity graph in-memory and the Device at the root of the graph is new while the OperatingEnvironment exists and the NetworkEndpoint exists but is assigned to a different OperatingEnvironment, will EF figure all this out?
When I say 'figure this out', its simply a case of walking the graph and doing (IfExist ? MergeValues : AddNew) Because the entities all have foreign keys, relationships should effectively get reassigned automatically during the property merge.
Is this how EF works or will I have to walk my own graph and apply this logic? If I do this, then my in-memory graph will have to be weakly linked, i.e. avoid linking via navigation properties and instead use the foreign key values, otherwise the whole graph will be added as as soon as I add one entity since EF will crawl the navigation properties.
Thanks - hope that's clear as mud.