-
If you create an entity called A and assign it to an entity called B, when saving B - entity A will be saved through
NestedPersistent - you can create an entity that is a property of another entity. Then when saving the main entity, the entity created as the property of it will be saved as well.
Example 1
CS
Appointments property of the Contact instance created and then save the Contact:
CS
Example 2
Below is an example of how we may use theAddNew method available in the Appointments property of the Contact class to create a new appointment.
CS
Appointment to be added to the Appointments collection and by indexing through the collection we have assigned the desired values for the specific appointment as shown below.
CS
Appointment created will be saved when saving the Contact entity with the use of its Save method.
When adding an appointment by indexing through the Appointment collection of any entity, you should take caution to identify and add to the newly created
Appointment, without updating an earlier Appointment.For instance, in example 2 if there was an appointment already existing in Appointment[0] location when you assigned values to properties what actually would happen is an update instead of an insert since the values that already exist in the 0th location will be modified.