Actually, I'm pretty sure the patch in the other thread doesn't apply here.
There've been many revisions to EntityProviderBaseCore.cst since the
patch was created. Some of them seem to be directed at fixing the
problem the patch was meant to correct in the first place.
After further investigation, my problem doesn't even seem to have to do
with the deepHandles dictionary in EntityProviderBaseCore.cst, but
rather with the "existingCopies" dictionary passed to each entity's Copy method.
I experience the exact same issue when using DeepLoad. When I try to DeepLoad one of my entities -- depending on how the child data is structured -- I get the same error message.
The problem with DeepLoad (mostly) goes away if I turn off the useEntityTracking attribute in my web.config. If I turn off useEntityTracking, the exception no longer gets thrown,
a) It doesn't actually load all the child entities. For example, one entity has a collection of children (call this Collection A), each of which has its own collection of children (call these Collection B). Some collection B get loaded, some don't. There's no particular pattern to it.
b) if you turn off use entityTracking, the code does some really insane stuff. For example, if I have entity A which owns a B which in turn owns a collection of C, the code to DeepLoad C will call DataRepository.BProvider.GetXxx for EVERY SINGLE C. Extremely inefficient!
So, all that said, I'm still having a problem. I'm able to work around it, for now, by manually doing all the work I was hoping DeepSave and DeepLoad would do.
I think this, again, boils down to netTiers really not understanding 1:1 relationships very well. I don't know enough about the guts of it, as yet, to know where to look for a solution.