IModule.Assembly

Syntax

Assembly: IAssembly;

Description

The Assembly property returns parameters of the temporary assembly that corresponds to this object.

Comments

This property returns parameters of assembly, within which separate repository units or forms are compiled. If a unit or form are included in any repository assembly, use the ParentAssembly property to get parameters of this assembly.

Example #1

Executing the example requires that the repository contains an assembly with the Assembly_1 identifier.

Sub Main;
Var
    MB: IMetabase;
    Assembly: IMetabaseObjectDescriptor;
    CrInfo: IMetabaseObjectCreateInfo;
    Modul: IModule;
Begin
    MB := MetabaseClass.Active;
    Assembly := MB.ItemById("Assembly_1");
    CrInfo := MB.CreateCreateInfo;
    CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_MODULE;
    CrInfo.Id := "NewModule";
    CrInfo.Name := "New unit";
    CrInfo.Parent := Assembly;
    Modul := MB.CreateObject(CrInfo).Edit As IModule;
    Modul.Text :=
        "Sub Main;" + #13 + #10 +
        "Begin" + #13 + #10 +
        "End Sub Main;";
    If Modul.Modified Then
        (Modul As IMetabaseObject).Save;
    End If;
End Sub Main;

After executing the example a new unit is created within the Assembly_1 assembly. A template for the Main procedure is contained in the unit text.

Example #2

Sub Main;
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    Modul: IModule;
Begin
    MB := MetabaseClass.Active;
    CrInfo := MB.CreateCreateInfo;
    CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_MODULE;
    CrInfo.Id := "NewModule";
    CrInfo.Name := "New unit";
    CrInfo.Parent := MB.Root;
    Modul := MB.CreateObject(CrInfo).Edit As IModule;
    Modul.Assembly.References := "Metabase;Db";
    Modul.Text :=
        "Sub Main;" + #13 + #10 +
        "Begin" + #13 + #10 +
        "End Sub Main;";
    If Modul.Modified Then
        (Modul As IMetabaseObject).Save;
    End If;
End Sub Main;

After executing the example a new unit is created in the repository root. This unit implements temporary assembly. The Metabase and Db system assemblies are connected to it. A template for the Main procedure is contained in the unit text.

See also:

IModule