Many applications need a way to store PI-SDK objects and lists of objects in a file and retrieve them the next time the program runs. Examples are ProcessBook, DataLink, and ProfileView.
To support this need, we provide the IPIPersist interface. This is a secondary COM interface implemented by the following PI-SDK objects:
IPIPersist is a generic interface that any developer can implement. With that and a corresponding restorer object that supports the IPIRestorer interface, objects can be persisted and restored.
The interface has one method, Persist, which allows the caller to obtain a persistence string that can be used to restore the same object later. To restore the object, you pass the string is passed to a PIGlobalRestorer object, which restores the object and returns it.
Objects that support IPIPersist can be saved as the Value property of a PIProperty object. When the PIProperty is saved, the persistence string for the object is saved. When the Value of the PIProperty is retrieved later, the object will be restored and returned in the value.
For PI-SDK objects, the persistence string only contains enough information to ask the database for the object. It doesn't contain a copy of the data within the object. For example the persistence string for a PIModule object contains information about the Server and the UniqueID of the module.