I am using EF6 (DB first) that connects to Oracle 11G.
I have an entity with child-entity (the PK in father is FK in child).
Now, I need to duplicate my entity along with its children.
In order to do so, I need to get an existing entity, detach it (using AsNoTracking() ), set a new ID to the entity, and set this new ID to the child entities too.
I am able to do it using an sequence and manually update the entity and the child entities.
I wonder if there is an easy way to do it?
Is there a way that I can update the ID in father entity, and the FK in the child will get updated automatically?
Thanks.