LoadAssembly(AssamblyName: String): IForeAssemblyBinary;
LoadAssembly(AssamblyName: String): Prognoz.Platform.Interop.Fore.IForeAssemblyBinary;
AssamblyName. Assembly that must be loaded in execution environment.
The LoadAssembly method loads repository assembly to the execution environment and returns its metadata.
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;
AssmBin: IForeAssemblyBinary;
Begin
ForeService := MetabaseClass.Active As IForeServices;
Runtime := ForeService.GetRuntime;
//Load assembly
AssmBin := Runtime.LoadAssembly("ASSM_TEST");
//View assembly metadata
Debug.WriteLine("System assembly: " + AssmBin.Builtin.ToString);
Debug.WriteLine("Loaded: " + AssmBin.IsLoaded.ToString);
Debug.WriteLine("Assembly name: " + AssmBin.Name);
Debug.WriteLine("Namespace: " + AssmBin.Namespace_);
Debug.WriteLine("Source object/file: " + AssmBin.ObjectName);
Debug.WriteLine("Links to other assemblies: " + AssmBin.References);
Debug.WriteLine("Date and time of the last launch: " + AssmBin.TimeStamp.ToString);
Debug.WriteLine("Version: " + AssmBin.Version.ToString);
End Sub UserProc;
Imports Prognoz.Platform.Interop.Fore;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
ForeService: IForeServices;
Runtime: IForeRuntime;
AssmBin: IForeAssemblyBinary;
Begin
ForeService := Params.Metabase As IForeServices;
Runtime := ForeService.GetRuntime();
//Load assembly
AssmBin := Runtime.LoadAssembly("ASSM_TEST");
//View assembly metadata
System.Diagnostics.Debug.WriteLine("System assembly: " + AssmBin.Builtin.ToString());
System.Diagnostics.Debug.WriteLine("Loaded: " + AssmBin.IsLoaded.ToString());
System.Diagnostics.Debug.WriteLine("Assembly name: " + AssmBin.Name);
System.Diagnostics.Debug.WriteLine("Namespace: " + AssmBin.@Namespace);
System.Diagnostics.Debug.WriteLine("Source object/file: " + AssmBin.ObjectName);
System.Diagnostics.Debug.WriteLine("Links to other assemblies: " + AssmBin.References);
System.Diagnostics.Debug.WriteLine("Data and time of the last launch: " + AssmBin.TimeStamp.ToString());
System.Diagnostics.Debug.WriteLine("Version: " + AssmBin.Version.ToString());
End Sub;
On executing the example, the repository assembly with the specified identifier will be loaded to the execution environment. Assembly metadata will be displayed to the development environment console.
See also: