[ROOT] / doc / toc / ARCCore / Class / IK


IK = Interface Key / Index key. Key used to lookup 'inside' an instance of IP.

TODO: Consider renaming into IIK (Interface index key).

Imlementing classes in StandardAgoRapideCode are:
IKString: Index key for any general id, like primary-key,
IKLong: A more memory efficient alternative to IKString,
IKType: Used when storing a collection of a given type,
IIKII: Related to PII, property for storing individual items,
PK: PK = AgoRapide PropertyKey. Describes properties related to an object (an entity),
NewKey: (In ARCQuery), A function creating new keys (new fields).

The key is what describes the different elements in a PropertyStreamLine line.

Example for how different implementing classes are chosen for a specific PropertyStreamLine like
'dt/Customer/42/PhoneNumber = 90534333':

'dt' would correspond to dt (data). Parsed as IKString
(if the data storage is implicitly storing only data then this prefix will often have been removed before parsing the rest of the keys).

'Customer' would be a IKType, that is a key pointing to a collection of all objects of type 'Customer'.
(in RDBMS-terms pointing to a table called Customers)

'42' would be a IKLong (IKString if it had not been an integer), that is, a general identifier for a specific entity.
(in RDBMS-terms a primary key)

'PhoneNumber' would be a PK, describing this specific field, and how the value '90534333' should be validated and parsed.
(in RDBMS-terms the Field in the schema for the Table)

Instances implementing this interface is suitable for use as key in hierarchical object stores like PRich.

See TryParse for details about about how the different sub-classes of IK are utilizied for a given PropertyStreamLine.


All implementations are supposed to be immutable.

Some notes about IEquatable<IK>:

Note how IEquatable<IK> must be implemented in the different implementing classes
(like Equals, Equals and Equals).

Equality is always based on the string representation (ToString) because IKString may be used instead of IKType or PK (for instance depending on whether we have StandardAgoRapideCode or ApplicationSpecificCode).
(in other words, a IKString must be seen as equal to a IKType or even PK.)

Note how GetHashCode is also essential to implement. If not then dictionaries with this class as key will simply not work
(see -GetHashCode-, -GetHashCode-, and -GetHashCode-).

Like Equality, GetHashCode is also based on the string representation (ToString). Same reason as above.

Note that default implementation of Equals(IK other) and GetHashCode() in this interface is not possible (because these methods are implemented for any class anyway (as Equals / -GetHashCode-), so that would take precedence over a default interface method).

Note that although this interface does not specify any maximum length of the string representation of the key (especially IKString) keys should be kept reasonable short in order to be practical in URL's and as file and folder names when storing on disk.
See IKCoded which specifies a maximum of 250 characters in an encoded string representation of a key.


Details

Generated 2024-03-28 17:53:33.695 UTC