IForeSerializerLoader.LoadModule

Syntax

LoadModule: IModule;

Description

The LoadModule method loads and saves the unit into repository.

Comments

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

Example

Executing the example requires the c:\Module_1.ppmodule file containing the saved platform unit.

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 unit is loaded from the specified file during example execution. The unit is saved in the repository root. If there is an object in the repository that has the same identifier with the unit being loaded, the unit identifier is changed before the loading.

See also:

IForeSerializerLoader