RegisterIdChange(ClassId: Integer; OldId: String; NewId: String; newObject: IMetabaseObject);
RegisterIdChange(ClassId: integer; OldId: string; NewId: string; newObject: Prognoz.Platform.Interop.Metabase.IMetabaseObject);
ClassId. The identifier of the consumer repository class, to which the update object refers.
OldId. The identifier of the consumer repository object on which the object refers before updating.
NewId. The identifier of the consumer repository object, to which the object refers after update.
newObject. The consumer repository object on which the object refers after updating.
The RegisterIdChange method overrides the identifier of the object to which the update object refers.
The RegisterIdChange method overrides the object on which the update object refers, by replacing identifiers.
If you specify the non-existent identifier or object as the NewId or newObject parameter, the repository object is updated without links reconfiguration.
One of available values of the MetabaseObjectClass is specified as the value of the ClassId parameter.
Executing the example requires the C:\Update.pefx update file and the object with the BD2 identifier in the repository. The reference to Metabase system assembly should be added.
Sub UserProc;
Var
MB: IMetabase;
Update: IMetabaseUpdate;
UpdateCxt: IMetabaseUpdateContext;
NewObject: IMetabaseObject;
Begin
MB := MetabaseClass.Active;
Update := MB.CreateUpdate;
Update.LoadFromFileNF("C:\Update.pefx");
UpdateCxt := Update.CreateUpdateContext;
NewObject := Mb.ItemById("BD2").Bind As IMetabaseObject;
UpdateCxt.RegisterIdChange(NewObject.ClassId, "BD1", "BD2", NewObject);
Update.ApplyEx(Null, UpdateCxt);
End Sub UserProc;
After executing the example the consumer repository objects update, loaded from the C:\Update.pef file, is executed. The link of the updated object will be redetermined to the object of the consumer repository with the BD2 identifier.
Executing the example requires the C:\Update.pefx update file and the object with the BD2 identifier in the repository. The specified procedure is an entry point for the .NET assembly.
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Update: IMetabaseUpdate;
UpdateCxt: IMetabaseUpdateContext;
NewObject: IMetabaseObject;
Begin
MB := Params.Metabase;
Update := MB.CreateUpdate();
Update.LoadFromFileNF("C:\Update.pefx", UpdateLoadMode.ulmReplace);
NewObject := MB.ItemById["BD2"].Bind() As IMetabaseObject;
UpdateCxt := Update.CreateUpdateContext();
UpdateCxt.RegisterIdChange(NewObject.ClassId, "BD1", "BD2", NewObject);
Update.ApplyEx(Null, UpdateCxt);
End Sub;
After executing the example the consumer repository objects update, loaded from the C:\Update.pef file, is executed. The link of the updated object will be redetermined to the object of the consumer repository with the BD2 identifier.
See also: