Refresh([Progress: IMetabaseUpdateProgress = Null]);
Progress - the object, implementing events that arise when synchronizing. Non-mandatory parameter, value by default is Null.
The Refresh method synchronizes updating with the repository.
Executing the example requires the update file Update.pef in the root of disk C.
Sub Main;
Var
MB: IMetabase;
Update: IMetabaseUpdate;
Progress: MyUpdateProgress;
Begin
MB := MetabaseClass.Active;
Update := Mb.CreateUpdate;
Update.LoadFromFile("C:\Update.pef");
Progress := New MyUpdateProgress.Create;
Update.Refresh(Progress);
Update.SaveToFileNF("C:\Update.pefx");
End Sub Main;
Class MyUpdateProgress: UpdateProgress
Sub OnProgress(Data: IMetabaseUpdateProgressData);
Begin
Select Case Data.Stage
Case MetabaseUpdateProgressStage.LoadPrepare: Debug.WriteLine("Preparing for synchronization");
Case MetabaseUpdateProgressStage.LoadApply: Debug.WriteLine("Objects synchronizing...");
Case MetabaseUpdateProgressStage.LoadFinish: Debug.WriteLine("Synchronization completed...");
End Select;
End Sub OnProgress;
Sub OnError(Data: IMetabaseUpdateProgressData; Var Ignore: Boolean);
Begin
Debug.WriteLine("Error of the update object synchronization'" + Data.Node.Label + "'");
Debug.WriteLine("Error text: " + Data.Error.Message);
If Data.Object <> Null Then
Debug.WriteLine("Error source: " + Data.Object.Id);
Debug.WriteLine("Object key: " + Data.Object.Key.ToString);
End If;
Debug.WriteLine("Object will be skipped");
Ignore := True;
End Sub OnError;
End Class MyUpdateProgress;
After executing the example the objects, contained in the update, are synchronized with their corresponding repository objects. Synchronization status is displayed in the development environment console. If an error occurs while synchronizing any objects, the information about the error is also displayed in the development environment console. The objects with errors are skipped.
See also: