Below is the example of using the ForeExec operation to execute a method implemented in the Fore.NET assembly. The request contains name of the method to be executed and moniker of the development environment object that contains method's implementation. The response contains method execution result.
{ "ForeExec" : { "tFore" : { "id" : "S1!M!7383" }, "tArg" : { "methodName" : "Program.Sum", "args" : { "it" : [ { "k" : "1", "value" : "100" }, { "k" : "2", "value" : "200" } ] } } } }
{ "ForeExecResult" : { "result" : "300.000000" } }
public static ForeExecResult ExecMethod(MbId mb, string assmId, string methodName, OdArg[] methodArgs)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tExec = new ForeExec()
{
tArg = new ForeExecArg()
{
methodName = methodName,
args = methodArgs
},
//Moniker of development environment object with method implementation
tFore = new ForeId()
{
id = mb.id + "!" + FindObjectById(mb, assmId).k
}
};
//Execute method
var result = somClient.ForeExec(tExec);
return result;
}
See also: