company logo

TypeContext :: oldInstance - Old instance property handle

In order to validate or compare old and new instance values, i.e. modifications that have been made to the instance, the "old instance" will be provided in this property. The property handle is available for read, only, within doAfterModify() or doBeforeStore() event handlers.

int32  MyContext::doBeforeStore() {

  Property    old_inst = oldInstance();

  Property   &cur_inst = property();

  

// deny increase of income, when the new income increases by more than 500 Euro

  return ( cur_inst.value("income").toInteger() >

           old_inst.value("income").toInteger() + 500 );

}

Notes:

GetOldProperty

Return value:  Old instance property ( odaba::Property  )

The "old instance property" is a property that provides the instance state before being modified. References and relationships in an "old instance property" are not accessible.

Implementation details

odaba::Property TypeContext  :: oldInstance (  )