IModule.Assembly

Syntax

Assembly: IAssembly;

Description

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

Comments

This property returns parameters of assembly within that compiling separate modules/forms of repository is performed. If module/form is included in any repository assembly it is necessary to 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 module";
    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 this example a new module is created within the Assembly_1 assembly. A template for the Main procedure is contained in the text of a module.

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 module";
    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;

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

See also:

IModule