DotNetLoadObject Function

Action

Loads a .NET Assembly and creates an instance of a .NET type. A handle to this created object will be returned. When creating the object, the default constructor will be called. If you want to call a constructor that takes parameters you have to set these parameters with the DotNetSetXX functions prior to the call to DotNetLoadObject.

Include file

DotNetAPI.bdh

Syntax

DotNetLoadObject( in sAssemblyFile : string,
                  in sTypeName     : string,
                  in sTimer        : string optional ): number;

Return value

  • object handle if successful

  • 0 otherwise

Parameter Description
sAssemblyFile Path to the assembly file that contains the specified type. The path can be either absolute or relative.

If the path is relative, it is either relative to the project or the data directory.

sTypeName Full qualified type name (Namespace + TypeName) of the type that should be instantiated.
sTimer

(optional)

If defined – a custom timer will be generated to measure the creation time of the object.

Example

dcltrans
  transaction TMain
  var
    hObject : number;
begin
  hObject := DotNetLoadObject("bin\\Release\\MyDotNet.dll", "MyDotNet.TestClass");
  DotNetCallMethod(hObject,"TestMethod");
  DotNetFreeObject(hObject);
end TMain;