xpfDotNetInvoke

FUNCTION xpfDotNetInvoke (objecthandle                : INTEGER;
                          methodName                  : STRING;
                          arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8     : GENERIC)
                          returnValue                 : GENERIC;
                

This method executes a .Net method with name methodName. The method must be defined in the class of the object referred to by objecthandle. The two methodName and objecthandle  parameters are mandatory.

The different types of input parameters are treated as follows:

  • sdaiINTEGER and sdaiLOGICAL are translated to int.
  • sdaiREAL is translated to double.
  • sdaiBOOLEAN is translated to bool.
  • sdaiSTRING, sdaiBINARY and sdaiENUMERATION is translated to string.
  • For objects the object id in the EDM database or EDM virtual machine is translated to int.
  • Aggregate of sdaiINTEGER, sdaiBOOLEAN or sdaiLOGICAL is translated to List<int>.
  • Aggregate of sdaiREAL is translated to List<double>.
  • Aggregate of sdaiSTRING, sdaiBINARY or sdaiENUMERATION is translated to List<string>.
  • For aggregate of objects the object id in the EDM database or EDM virtual machine of the objects is translated to List<int>.

 

The return value from the .Net method is treated as follows:

  • If the result is of type int a sdiINTEGER value is returned to the EDMexpressX method.
  • If the result is of type double or Double a sdiREAL value is returned.
  • If the result is of type bool or Boolean a sdiBOOLEAN value is returned.
  • If the result is of type string a sdiSTRING value is returned.
  • If the result is of type string a sdiSTRING value is returned.
  • If the result is either List<string>, List<int> or List<double>, a list of the corresponding primitive types are created in EDM virtual machine memory.
  • If the result is an object or an aggregate in the EDM database or in the EDM virtual machine memory, the object or aggregate id is returned to the EDMexpressX method.

 

Arguments


1TypeNameComment
2INTEGERobjecthandleMandatory - handle to the .NET object
3STRINGmethodNameMandatory - method name within the .NET object
4GENERICarg(n)Optional, input parameters to the .Net method.

Return Value


 

TypeNameComment
GENERICreturnValuereturned value from the .NET method

Options


 

Example


public class Class1
{
  public Class1() 
  {
  }
  public List<string> returnListOfString(List<int> intList)
  {
      List<string> returnValue = new List<string>();
      foreach (int i in intList) {
          returnValue.Add(i.ToString());
      }
      return returnValue;
  }
   public string returnString(string s)
   {
      return s;
   }
}


and the EDMexpressX method that executes the two methods in Class 1:

QUERY_FUNCTION testDotNetPlugin_1() : STRING;
   LOCAL
                               object          : INTEGER;
      resultString    : STRING;
      input           : LIST OF INTEGER;
      resultList      : LIST OF STRING;
                END_LOCAL;

   input ++ 1; input ++ 2; input ++ 3;
   object := xpfCreateDotNetObject('GuruTest.Class1');
   dotnetResult := xpfDotNetInvoke(object, 'returnListOfString', input);
   -- dotnetResult is a list of string contating 3 strings with values '1', '2' and '3'.
   result := xpfDotNetInvoke(object, 'returnString', 'Hello EPMT');
   -- result contains the string 'Hello EPMT'
   return (result);
END_QUERY_FUNCTION;

 

See also

Filter by label

There are no items with the selected labels at this time.

Â