IForeSerializerLoader.LoadModule

Fore Syntax

LoadModule: IModule;

Fore.NET Syntax

LoadModule: Prognoz.Platform.Interop.Metabase.IModule;

Description

The LoadModule method loads and saves the module into repository.

Comments

The method saves the module in accordance with the parameters specified in the CreateInfo property. If there is an object in repository that has the same identifier with the module being loaded, the exception is generated.

Fore Example

Executing the example requires the C:\Module_1.ppmodule file containing the saved module of Prognoz Platform 9.

Sub UserProc;
Var
    MB: IMetabase;
    Fs: IForeSerializer;
    Loader: IForeSerializerLoader;
    Id: String;
Begin
    MB := MetabaseClass.Active;
    Fs := New ForeSerializer.Create;
    Loader := Fs.CreateLoaderFromFile("c:\Module_1.ppmodule", MB);
    Id := Loader.CreateInfo.Id;
    If MB.ItemById(Id) <> Null Then
        Loader.CreateInfo.Id := MB.GenerateId(Id);
        Loader.CreateInfo.Name := Loader.CreateInfo.Name + "_Copy";
    End If;
    Loader.CreateInfo.Parent := MB.Root;
    Loader.LoadModule;
End Sub UserProc;

The module is loaded from the specified file during example execution. The module is saved in the repository root. If there is an object in repository that has the same identifier with the module being loaded, the module identifier is changed before the loading.

Fore.NET Example

The requirements and result of the Fore.NET Example execution match with those in the Fore Example.

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Fs: IForeSerializer = New  ForeSerializerClass();
    Loader: IForeSerializerLoader;
    Id: String;
Begin
    MB := Params.Metabase;
    Loader := Fs.CreateLoaderFromFile("c:\Module_1.ppmodule", MB);
    Id := Loader.CreateInfo.Id;
    If MB.ItemById[Id] <> Null Then
        Loader.CreateInfo.Id := MB.GenerateId(Id, 0);
        Loader.CreateInfo.Name := Loader.CreateInfo.Name + "_Copy";
    End If;
    Loader.CreateInfo.Parent := MB.Root;
    Loader.LoadModule();
End Sub;

See also:

IForeSerializerLoader