I'm trying to sandbox my editing but I'm across a problem. If I try and assign an entity to the property of another entity I get the following error
Cannot assign entities from one entity manager to another unless the entity on one side or the other is detached.
I've managed to get around it for some static reference data by assigning it via primary keys rather than the related object. But how should this work for many to many relationships.
Another scenario.
Lets say I have a parent child relation e.g. "invoice" and "invoice detail" and invoice detail have an"item" property. If I sandboxed the invoice edit and then sandboxed the invoice detail edit would I end up with 3 versions of the "item" entity (1 in the main EM, one in the invoice sandbox and one in the invoice detail sandbox) in memory, is there a better way to handle this?
Or is the recommended way to sandbox the invoice from the main em and the invoice detail from the main em also instead of importing from the invoice sandbox, which would avoid the need for the invoice sandbox to contain the items for the invoice detail sandbox. If this is the better way how to I reflect the changes from the invoice detail sandbox in the invoice when the invoice detail sandbox closes.