company logo

Property :: appendReference - Append persistent instance

The function supports appending an instance to an unordered collection. The function appends an instance selected in another property handle to the collection of the current property handle, but does not create a copy from the instance.

Both property handles must have the same type or the same base type (when the source is weak-typed or has a shared base type, which corresponds to the property handle type). The function can be called for unordered collections, only, that do not own the instances. Usually the function is used for filling temporary or transient collections with instances, which have been selected for special purposes.

Source and target property handle have to be defined for the same database. The target property handles must not be a property handle in the parent hierarchy of the source property handle. It is not possible to add an instance by reference from a server database to a local database or reverse. It is also not possible to add references from operation path nodes, which are usually not persistent.

When the property defines a weak-typed collection and the instance to be added inherits from shared base instances, the smallest shared base instance inheriting from the collection type will be added as reference.

In the source property, an instance must be selected. Otherwise, the function throws an exception.

After adding the instance to the property handle the added instance is the currently selected one.

Events are generated as being described for insert().


Notes:

When a filter has been set for the collection, no instance will be selected in the property handle, when the instance created does not match the filter condition.

Instead of appendReference(), insertReference() could be used passing the instance count as preferred position. Since append throws an exception when the collection is ordered, calling the function may fail when changing the object model (from unordered to ordered). Hence, it is suggested using insertReference() rather than appendReference().

Return value:  Property reference ( odaba::Property & )

A property handle refers to a (usually) opened property. Invalid properties may cause an exception.

Implementation details

odaba::Property & Property  :: appendReference ( odaba::Property &cSourceProperty )
  • cSourceProperty - Source property handle

    The source property handle is a reference to an opened Property. Invalid or not opened property handles may cause an exception.