First of all, I'm using GenPro v3.5 with the adapter model and gen pro runtime framework.
A little background:
In my application I'm integrating with another (3rd Party) application using entities that are populated by reading from the 3rd party database but the Adds/Updates must occur via external web services. So I can use FetchEntityCollection(), prefetches, filters and all that good stuff to get the data/entites I need but when modifying data I need to use the updated values on the entity to generate a web service request to perform the change.
The web services have a 1:1 mapping to the entites.
So if I had a contact entity with child phone entites then I would start off by mapping the contact (parent) entity (only) to an "AddContact" web service request. I would get back an ID for the new contact and then proceed to call the "AddContactPhone" method for the child phone entites. Because I'm not using the entity to save, the entity fields remain Dirty and without PK/FK values. I'm manually updating the IsDirty/IsChanges flag within the Entity graph to indicate what has been saved or not.
Here is the question:
After adding the contact I want to update the Contact.ID field value (PK) and have that propogate down to all child entites. So that when I pass the ContactPhone child entity to the "AddContactPhone" WebService method it has the contact ID that was just added.
If I set the contact id value, I lose the child entites (dereferenced). The documentation states "Changing PK fields is not recommended and changed PK fields are not propagated to related entities fetched in memory"... but in my case I'd like to.
Is it possible to make this happen (update all FKs withinthe graph when a PK is updated on the parent entity)? Or if I need to iterate through the graph and update all child entity FKs, how would I do that?
Thanks,
Ryan