Persistate

Persistent utility methods

Hide Navigation Pane

Persistent utility methods

Previous topic Next topic No directory for this topic  

Persistent utility methods

Previous topic Next topic Topic directory requires JavaScript JavaScript is required for the print function Mail us feedback on this topic!  

The Persistent class is thew base class of all objects in the persistent tree.  As such, it holds methods which are used by the Persistate run-time, often overridden in generated code.  There are also methods which, as well as being used by Persistate, are of general utility.  These methods are listed here - see the API documentation for full usage details.

Class { get; }.  This property, overridden in generated code, returns the ObjectClass object which represents the class of this object.
ClassFlags { get; }.  This property, overridden in generated code, returns a FlagSet which contains various flags indicating the class category functions implemented by this object, as well as the Singleton flag as appropriate.  
Parent { get; }.  This obtains the object which contains this one in the persistent tree.
ParentReference { get; }.  This obtains a Reference to the object which contains this one in the persistent tree.
VersionNumber { get; }.  This gets the version number of this object.  This is incremented by 1 every time the object is modified in an operation execution.  It is used to check for update conflicts when synchronising the object to persistent storage.
PreviousVersion { get; }.  If this object implements the class category CloneOnMutate function, this this gets the clone which was made when this object was modified in an operation execution.
ToReference().  Obtains a Reference to this object.
Database { get; }.  Gets the Database object representing the database in which this object is stored.
ObjectNumber { get; }.  Gets a long holding a number for this object which is unique for its class within the database in which it is stored.
Validate().  Override this to implement a validation method for instances of this class.
Traverse(string navigationPath).  This traverses the persistent object graph (graph as associations are included) using a period delimited path make up of property names.  May start with The.  There is also a static method called TraverseFrom which performs the same function.
Refresh().  This method refreshes the contents of this object from persistent storage.
RefreshAndLock().  This method refreshes the contents of this object from persistent storage, and attempts to put a database lock on the object, which will remain in force until the end of the operation execution or the next call to Session.Commit().
RefreshTree().  This method refreshes the entire persistent tree under this object from persistent storage.
RestoreUnmodified(bool noRefreshFromDatabase).  This method restores this object to its state before the object was modified in this operation execution.
Move(string currentMemberName, Persistent newParent, string newMemberName).  Moves this object to a new location in the persistent tree.  See Moving objects for details.
IsModified { get; }.  True if this object has been modified in the current operation execution.
IsDistributedFrom(Persistent obj).  True if this object is held in a different database to another object.
IsInvalid { get; }.  True if the value of this object cannot be used.
IsPersisted { get; }.  True if this object has been written to persistent storage.
IsProvisional { get; }.  True if this object has not yet been written to persistent storage.
IsAttached { get; }.  True if this object has been attached to the persistent tree.  The object may not yet have been written to persistent storage, but does have an assigned ancestor.
CallTree(CallTreeData callTreeData).  This method performs a recursive descent of the persistent tree from this object, calling a delegate for each node in the tree.  This is a very flexible method, and requires some study of the API documentation to use.
AssociatorCount().  Gets the number of objects which have associations to this one.  This works only if this object implements the class category function LogAssociations.
GetAssociators().  Gets an IndexedList of all objects which have associations to this one.  This works only if this object implements the class category function LogAssociations.
CopyFrom(Persistent from).  Copies the field values from another object to this one.  This copies only the generated fields using GetFieldValue and SetFieldValue.  If you need to copy your own field data, override the CopyTransientFrom method which this method calls.
NominativeText { get; }. This property, overridden in generated code, returns a string containing the concatenated values of its Nominative members.
DiscriminativeText { get; }. This property, overridden in generated code, returns a string containing the concatenated values of its Discriminative members.
TitleText { get; }. This property returns a title for the object.  This is in general longer than NominativeText and includes the class name.
AnnotationSeparator { get; }.  Used to separate member values in NominativeText and DiscriminativeText.  By default, this is a space, and can be overridden.
WriteTestData(Persistent parent, int index, CreateTestDataParameterSet parameters).  Together with the WriteTestAssociations method, this method provides a scheme for creating text data using the Create Test Data operation.  (see Generator only operations for a description).  This operation uses these methods to create a persistent tree, according to parameters you set in a dialogue box when you execute the operation.  You can override these methods in your own classes to create more meaningful test data.
WriteTestAssociations(IClassified target, int slot, CreateTestDataParameterSet parameters).   See above.