Factoid: business object properties are all read-only

greenspun.com : LUSENET : OCI Best Practices : One Thread

When implementing your TOCIObject subclass remember that its public properties will probably all be read-only. This is only true in the literal sense -- of course your form updates your business object, but its properties are themselves objects such as TStringObject and TIntegerObject. When referencing an property you get a reference to an object. You then update the object's properties.

For example, TProducerObject has a SSN property of type TStringObject. The property is defined:

property SSN: TStringObject read GetSSN;

A reference to the property within the form might read:

ProducerObject.SSN.Value := EditSSN.Text;

The token "ProducerObject.SSN" is read-only because you can only read the value and cannot assign a new TStringObject value to it. However you can still update the SSN by referencing the properties of the TStringObject, such as Value.

-- Anonymous, September 04, 1998


Moderation questions? read the FAQ