IForeSerializerLoader.LoadAssembly

Fore Syntax

LoadAssembly: IAssembly;

Fore.NET Syntax

LoadAssembly: Prognoz.Platform.Interop.Metabase.IAssembly;

Description

The LoadAssembly method loads and saves the assembly into repository.

Comments

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

Fore Example

Executing the example requires the c:\Assembly_1.ppassembly file that contains a saved platform assembly.

Sub UserProc;
Var
    MB: IMetabase;
    Fs: IForeSerializer;
    Loader: IForeSerializerLoader;
    Id: String;
Begin
    MB := MetabaseClass.Active;
    Fs := New ForeSerializer.Create;
    Loader := Fs.CreateLoaderFromFile("c:\Assembly_1.ppassembly", 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.LoadAssembly;
End Sub UserProc;

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

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.KeFore;

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:\Assembly_1.ppassembly", 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.LoadAssembly();
End Sub;

See also:

IForeSerializerLoader