AFGlobalRestorer.RestoreObject Method
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
This method restores an object from the specified persistence string.
Namespace: OSIsoft.AF
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static Object RestoreObject( string persistenceData, Dictionary<string, Object> context )
Public Shared Function RestoreObject ( persistenceData As String, context As Dictionary(Of String, Object) ) As Object Dim persistenceData As String Dim context As Dictionary(Of String, Object) Dim returnValue As Object returnValue = AFGlobalRestorer.RestoreObject(persistenceData, context)
public: static Object^ RestoreObject( String^ persistenceData, Dictionary<String^, Object^>^ context )
static member RestoreObject : persistenceData : string * context : Dictionary<string, Object> -> Object
Parameters
- persistenceData
- Type: SystemString
The persistence string that was obtained from the original object using the IPIPersist interface.j - context
- Type: System.Collections.GenericDictionaryString, Object
A DictionaryTKey, TValue containing context variables. If you do not need to specify any context, then is allowed.
Return Value
Type: ObjectReturns the object restored from the persistence string.
Remarks
This method uses other objects that implement the IPIRestorer interface to restore the object from the specified persistence string.
The context parameter contains a dictionary of context variables to assist in restoring the object from the persistence string. The Key of each dictionary item in the collection is the context variable name. The Value is the context variable value. The following table lists the supported context variable names and their values:
| Name | Value |
|---|---|
| SDK | PI SDK object. You should pass this if you want to use a PI SDK object other than the one associated with your thread. |
| Server | PIServer object. You should pass this if you want to override the PIServer in the persistence string. |
| Systems | PISystems object. You should pass this if you want to use a PISystems collection other than the default collection associated with the current user identity. |
| System | PISystem object. You should pass this if you want to override the PISystem in the persistence string. |
| Database | AFDatabase object. You should pass this if you want to override the AFDatabase in the persistence string. |
| PreferName | Pass this with a value of if you want to prefer the name for objects (like PISystem, PIServer, AFElement, PIPoint, etc.) that have both the name and the ID stored in the persistence string. |
| QueryDate | Pass this to retrieve a specific version of an object. The version at or before the QueryDate will be returned. If this variable is not passed, the current version of the object will be restored. |