The PIGlobalRestorer object is used to restore objects persisted using the IPIPersist interface. It is an independently createable object that has two methods: RestoreObject, and RestoreServers.
The RestoreObject method uses Restorer Objects that implement the IPIRestorer interface.
The RestoreServers method is provided to assist programs in determining which servers are required to restore the object or objects in the persistence string. If those servers are not yet configured, the application can prompt the user to configure them.
You must have a PISDK object instantiated in your program to restore PISDK objects like PIPoint's, PIModule's, etc. You can obtain a PIGlobalRestorer object directly from the PISDK object itself using the IPIGlobalRestorer interface. This is a secondary interface that has one method: Restorer. This method returns a PIGlobalRestorer object. The example below shows how to do this.
You can pass context parameters to the PIGlobalRestorer object to assist it in restoring the object.
For example, an application may want to restore a PIPoint object preferentially by tag name rather than by ID (which is the default). In this case a PreferName context variable set to True will cause the PIPointRestorer object to use the name first when trying to retrieve the point from the server.
Another example is when an application wants to restore a specific value of a PIModule (rather than the current value which is the default). In this case the caller can pass a QueryDate as a context parameter. The PIModule value at or before that QueryDate will be returned.