IForeNETAssembly.Run

Syntax

Run;

Description

The Run method executes the .NET assembly.

NOTE. Before it starts running, the assembly is compiled. If any errors arise during compilation, the exception will be generated.

Example

Executing this example requires that the repository contains a .NET assembly with the NETAssembly_1 identifier.

Sub UserProc;
Var
    MB: IMetabase;
    NETAssembly: IForeNETAssembly;
    Arg: IForeNETMakeArgs;
    s: String;
Begin
    MB := MetabaseClass.Active;
    NETAssembly := MB.ItemById("NETAssembly_1").Bind As IForeNETAssembly;
    Arg := NETAssembly.CreateMakeArgs;
    Arg.Messages := New StringList.Create;
    If NETAssembly.IsUpToDate(TrueThen
        NETAssembly.Run;
    Elseif NETAssembly.MakeUpToDate(Arg) Then
        NETAssembly.Run;
    Else
        For Each s In Arg.Messages Do
            Debug.WriteLine(s);
        End For;
    End If;
End Sub UserProc;

After executing this example it is checked if cache contains assemblies of the last compiled version of specified .NET assembly. If the latest version is present, the assembly is run from assemblies cache. If the latest version is absent, the compilation of .NET assembly and all assemblies associated with it is performed. If the compilation was successful the assembly is run, otherwise information about compilation errors is displayed in the development environment console.

See also:

IForeNETAssembly