tsc_CustomEntity

Available in SC version 2.10 and higher.

This class represents one custom entity that has been read from the database.  It is generally obtained from a tsc_CustomEntityList.

An introduction to the subject of custom data can be found on the page Adding custom data to the job database.

Public constructors

tsc_CustomEntity (const tsc_Entity& jobObject);
Construction from a generic object. The object must be a custom entity.

Public methods

bool IsDeleted() const;
Returns true if the custom entity has been deleted.  Deletion is simply a boolean flag which can be set and unset using tsc_JobCustomEntities::Delete and Undelete.

bool IsType (tsc_DatabaseCustomType& type);
Tests if the custom entity is of the same type as type. The comparison is by name and GUID.  Types with the same name and GUID but different versions are considered equal.  Only the Name and GUID are referenced in type; it is irrelevant what other data it may contain.

void Read (tsc_DatabaseCustomType& deSerializeInto);
Reads the XML of the entity from the database and passes it to the type's DeSerialize method. The original type (including the version of the type used to write the record) is also passed to DeSerialize.  After the Read has completed, the supplied deSerializeInto should have been updated with the record's contents, although what actually occurs is dependent on the type's overridden DeSerialize method.

tsc_String Key ();
Returns the key of this item.

int Version () const;
The version of the custom entity.  This is the version number from the type that was supplied when the record was written, and may differ from the version in the Type information which reflects the first record of the type ever written in this database.

int RecordId () const;
Returns the database record ID of this entity.  This ID may be used to uniquely identify the entity, or to read it.  Do not permanently store this ID after the database has been closed, since record IDs may change (for instance, if the job upgrade tool is run on the job).

static bool IsCustom (const tsc_Entity& jobObject);
Returns true if the supplied object is a custom entity.