IMetabaseUpdate.Refresh

Syntax

Refresh([Progress: IMetabaseUpdateProgress = Null]);

Parameters

Progress. Object implementing events occurring on synchronization.

Description

The Refresh method synchronizes update with the repository.

Comments

The Progress parameter is optional for Fore and by default is set to Null.

Example

Executing the example requires the C:\Update.pef update file.

Add a link to the Metabase system assembly.

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("Prepare to synchronize");
            Case MetabaseUpdateProgressStage.LoadApply: Debug.WriteLine("Synchronizing objects...");
            Case MetabaseUpdateProgressStage.LoadFinish: Debug.WriteLine("Synchronization complete");
        End Select;
    End Sub OnProgress;
 
    Sub OnError(Data: IMetabaseUpdateProgressData; Var Ignore: Boolean);
    Begin
        Debug.WriteLine("Update object synchronization error '" + 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:

IMetabaseUpdate