RdsMergeCallback.OnBeforeProcess

Syntax

OnBeforeProcess(Var Cancel: Boolean);

Parameters

Cancel. Parameter that determines whether further elements synchronization is executed. If the parameter is set to True, synchronization is cancelled. Values of all elements remain unchanged. If it is set to False, further synchronization is executed. The OnConflictResolve event is generated for all elements that have different values.

Description

The OnBeforeProcess method implements an event that occurs after comparing elements and before synchronization of elements that have different attributes values.

Example

Executing the example requires an MDM repository with the NSI_1 identifier. Data of synchronized dictionaries is stored in the file Sinc.rpl.

Public Class MyCallback: RdsMergeCallback

Public Sub OnProgress(Current: Integer; Total: Integer);

Begin

Debug.WriteLine(Made: + Progress.ToString + from + Total.ToString);

End Sub OnProgress;


Public Sub
OnConflict(LoadElement: IRdsDictionaryElement; CurrentElement: IRdsDictionaryElement);

Begin

Debug.Write("Conflict: ");

Debug.Write(LoadElement.Name);

Debug.Write(" | ");

Debug.WriteLine(CurrentElement.Name);

End Sub OnConflict;


Public Sub
OnBeforeProcess(Var Cancel: Boolean);

Begin

Cancel := False;

End Sub OnBeforeProcess;


Public Sub
OnConflictResolve(LoadElement: Integer; CurrentElement: Integer; Var Ignor: Boolean);

Begin

Ignor := True;

End Sub OnConflictResolve;

End Class MyCallback;


Sub
Main;

Var

MB: IMetabase;

MObj: IMetabaseObject;

NSI: IRdsDatabase;

NSIInst: IRdsDatabaseInstance;

Trans: IConnectionTransaction;

CallBack: RdsMergeCallback;

Replic: IRdsReplicator;

Begin

MB := MetabaseClass.Active;

MObj := MB.ItemById("NSI_1").Bind;

NSI := MObj As IRdsDatabase;

NSIInst := NSI.Open(Null);

Trans := NSIInst.DatabaseInstance.Connection.StartTransaction(False);

CallBack := New MyCallback.Create;

Replic := NSIInst.CreateReplicator;

Replic.LoadFromFile("c:\Sinc.rpl");

Replic.Merge(CallBack);

Trans.Commit;

End Sub Main;

After executing the example dictionaries are synchronized in the NSI_1 repository. The MyCallback custom class is used to control synchronization process. During the execution, common status of a process and also elements names with different values in a dictionary and loaded file are displayed in the console.

See also:

RdsMergeCallback