IMetabaseObjectCopyInfo.NoSave

Syntax

NoSave: Boolean;

NoSave: boolean;

Description

The NoSave property determines whether copy of an object is saved after copying.

Comments

Default property value is False, in this case a copy is saved at once. If the property value is True, a copy is not saved after copying. The copy opened for edit will be available in the IMetabaseObjectCopyInfo.Destination property. It is used if after copying it is necessary to perform any additional changes in a copy to avoid double saving.

Example

Executing the example requires that repository contains a database with the BD_1 identifier.

Add links to the Db and Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    CInfo: IMetabaseObjectCopyInfo;
    MObj: IMetabaseObject;
    BD: IDatabase;
Begin
    MB := MetabaseClass.Active;
    CInfo := MB.CreateCopyInfo;
    CInfo.Id := "BD_2";
    CInfo.Name := "Database 2";
    CInfo.Destination := MB.Root;
    CInfo.Source := MB.ItemById("BD_1");
    CInfo.NoSave := True;
    MB.CopyObject(CInfo);
    MObj := CInfo.Destination As IMetabaseObject;
    BD := MObj As IDatabase;
    BD.LogonData.ParamValue("SCHEME") := "TestShema_1";
    MObj.Save;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Db;
 
Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    CInfo: IMetabaseObjectCopyInfo;
    MObj: IMetabaseObject;
    BD: IDatabase;
Begin
    MB := Params.Metabase;
    CInfo := MB.CreateCopyInfo();
    CInfo.Id := 
"BD_2";
    CInfo.Name := 
"Database 2";
    CInfo.Destination := MB.Root;
    CInfo.Source := MB.ItemById[
"BD_1"];
    CInfo.NoSave := 
True;
    MB.CopyObject(CInfo);
    MObj := CInfo.Destination 
As IMetabaseObject;
    BD := MObj 
As IDatabase;
    BD.LogonData.ParamValue[
"SCHEME"] := "TestShema_1";
    MObj.Save();
End Sub;

 

After executing this example database is copied in a repository root. The name of a scheme to that a connection is performed is changed in the received copy of a database before saving.

See also:

IMetabaseObjectCopyInfo