BindToAssembly(AssamblyName: String): IForeAssembly;
BindToAssembly(AssamblyName: String): Prognoz.Platform.Interop.Fore.IForeAssembly;
AssamblyName. It is required to get access to this assembly constructions.
The BindToAssembly method provides access to assembly constructions.
Before working with assembly constructions, assembly must be loaded to execution environment using the LoadAssembly method.
Set name of development environment system assembly (ABAC, Adhoc and others) or identifier of assembly/form/unit in repository as the AssamblyName parameter value. If repository assembly is implemented inside the container, then the following value is specified in the AssamblyName parameter: <container identifier>.<assembly identifier>.
Executing the example requires that repository contains an assembly with the ASSM_TEST identifier.
Add a link to the Fore, Metabase system assembly.
Sub UserProc;
Var
ForeService: IForeServices;
Runtime: IForeRuntime;
Assm: IForeAssembly;
FClass: IForeClass;
FSub: IForeSub;
i, j: Integer;
Begin
ForeService := MetabaseClass.Active As IForeServices;
Runtime := ForeService.GetRuntime;
//Load assembly
Runtime.LoadAssembly("ASSM_TEST");
Assm := Runtime.BindToAssembly("ASSM_TEST");
//Get information about interfaces, classes, enumerations
j := Assm.ClassesCount - 1;
For i := 0 To j Do
FClass := Assm.ClassItem(i);
Select Case FClass.ClassType
Case ForeClassType.Class_: Debug.Write("Class: ");
Case ForeClassType.Interface_: Debug.Write("Interface: ");
Case ForeClassType.Enum_: Debug.Write("Enumeration: ");
End Select;
Debug.WriteLine(FClass.Name);
End For;
//Get information about procedures/functions implemented in global assembly namespace
j := Assm.SubsCount - 1;
For i := 0 To j Do
FSub := Assm.SubItem(i);
If FSub.IsResult Then
Debug.Write("Function: ");
Else
Debug.Write("Procedure: ");
End If;
Debug.WriteLine(FSub.Name);
End For;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Fore;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
ForeService: IForeServices;
Runtime: IForeRuntime;
Assm: IForeAssembly;
FClass: IForeClass;
FSub: IForeSub;
i, j: Integer;
Begin
ForeService := Params.Metabase As IForeServices;
Runtime := ForeService.GetRuntime();
//Load assembly
Runtime.LoadAssembly("ASSM_TEST");
Assm := Runtime.BindToAssembly("ASSM_TEST");
System.Diagnostics.Debug.WriteLine(Assm.ClassesCount());
System.Diagnostics.Debug.WriteLine(Assm.SubsCount());
//Get information about interfaces, classes, enumerations
j := Assm.ClassesCount() - 1;
For i := 0 To j Do
FClass := Assm.ClassItem(i);
Select Case FClass.ClassType
Case ForeClassType.fctClass: System.Diagnostics.Debug.Write("Class: ");
Case ForeClassType.fctInterface: System.Diagnostics.Debug.Write("Interface: ");
Case ForeClassType.fctEnum: System.Diagnostics.Debug.Write("Enumeration: ");
End Select;
System.Diagnostics.Debug.WriteLine(FClass.Name);
End For;
//Get information about procedures/functions implemented in global assembly namespace
j := Assm.SubsCount() - 1;
For i := 0 To j Do
FSub := Assm.SubItem(i);
If FSub.IsResult Then
System.Diagnostics.Debug.Write("Function: ");
Else
System.Diagnostics.Debug.Write("Procedure: ");
End If;
System.Diagnostics.Debug.WriteLine(FSub.Name);
End For;
End Sub;
On executing the example, the repository assembly with the specified identifier will be loaded to the execution environment. The list of constructions that are implemented in assembly will be displayed to development environment console.
See also: