Published on InterSystems Developer Community (https://community.intersystems.com)

Home > Passing IRISObject into function as parameter

Question
ilya andreyev · Dec 21, 2020

Passing IRISObject into function as parameter


 We are using Native .NET API from IRISProviderCore21 package, inside .NET Core app, and having issue when trying to call function that takes instance of the class as parameter. The server is IRIS 2020.1.0.217.1

 In a nutshell, the code looks like this:

            // Create instance of the parameter class, proxy object

            var paramObject = iris.ClassMethodObject("MyParameterClass", "%New") as IRISObject;

           paramObject.Set("property", "value");

           var irisResult = iris.FunctionObject("MyFunction", "MyRoutine", paramObject);

  at last line, we are getting exception 
 
 'Unsupported type: InterSystems.Data.IRISClient.ADO.IRISObject'

   at InterSystems.Data.IRISClient.ADO.IRIS.setReference(Object topRef1, String topRef2, Boolean bLimitTypes, Boolean honorByReference, Boolean includeArgumentCount, Object[] subRefs)
   at InterSystems.Data.IRISClient.ADO.IRIS.setClassMethodReference(String className, String methodName, Object[] arguments)
   at InterSystems.Data.IRISClient.ADO.IRIS.RoutineCommon(String labelName, String routineName, String returnType, Object[] args)
   at InterSystems.Data.IRISClient.ADO.IRIS.FunctionObject(String functionName, String routineName, Object[] args)

 

The calls with regular strings / numbers parameters are working just fine, with proper returned IRISObject with data.

    var irisResult = iris.FunctionObject("MyFunction", "MyRoutine", "parameter1", 2);

Need a help. New to .NET + Cache combo

#Caché #InterSystems IRIS
Product version: IRIS 2020.1

Source URL:https://community.intersystems.com/post/passing-irisobject-function-parameter