TEntity.Compare Method

The method is designed for comparing the entity key with the specified key.




function Compare(Key: TCustomKey): Integer;

The key to be compared with the entity key.
Return Value
When the entity key value is null, the result is 0 if the key value is also null, 1 otherwise. When the entity key value is not null, the result is -1 if the key value is null or is greater, 1 if the key value is less, and 0 when the values are equal.


The method compares the entity key value with the specified key value. The specified key has to be of the same meta-type as the entity. Otherwise, the exception will be raised. When the entity key is complex and consists of several entity attributes, each entity key attribute is compared with the corresponding key attribute. When all attributes are equal, the method returns zero. Otherwise, the method returns the result of the comparison of the first non-equal attribute pair.

© 1997-2018 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback