LoadAssembly: IForeNETAssembly;
The LoadAssembly method loads and saves the .NET assembly to the repository.
Method loads and saves the .NET assembly according to parameters, specified in the CreateInfo property. If the loaded assembly is already present the exception is generated.
Executing this example requires the NETAssembly_1.ppnassembly file in the root directory of disk C. The file contains the saved .NET assembly of the platform. The current repository contains the folder with the ASSEMBLY_FOLDER identifier.
Sub UserProc;
Var
MB: IMetabase;
Fs: IForeNETSerializer;
Fsl: IForeNETSerializerLoader;
Id: String;
NETAsm: IForeNETAssembly;
MObj: IMetabaseObject;
Begin
MB := MetabaseClass.Active;
Fs := New ForeNETSerializer.Create;
Fsl := Fs.CreateLoaderFromFile("c:\NETAssembly_1.ppnassembly", MB);
Id := Fsl.CreateInfo.Id;
If MB.ItemById(Id) <> Null Then
Fsl.CreateInfo.Id := MB.GenerateId(Id);
Fsl.CreateInfo.Name := Fsl.CreateInfo.Name + "_Copy";
End If;
Fsl.CreateInfo.Parent := MB.ItemById("ASSEMBLY_FOLDER");
Fsl.LoadAssembly;
End Sub UserProc;
On executing the example, the .NET assembly is loaded into the current repository from the specified file. The .NET assembly is saved in the specified folder of repository. If there is an object in repository that has the same identifier with the .NET assembly being loaded, the .NET assembly identifier is changed before the loading.
See also: