Below is the example of using the ForeExec operation to execute method with passing repository objects as parameter values. The request contains name of the executed method and moniker of the development environment object containing method implementation. Parameter values contain repository connection monikers and a repository object. The executed method has the following syntax:
The C# example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example.
{ "ForeExec" : { "tFore" : { "id" : "S1!M!7360" }, "tArg" : { "methodName" : "WorkWithObject", "args" : { "it" : [ { "k" : "1", "value" : "S1!M" }, { "k" : "2", "value" : "S1!M!S!E1" } ] } } } }
{ "ForeExecResult" : { "result" : "" } }
public static ForeExecResult ExecMethodWithObject(MbId mb, string assmId, string methodName, string objMoniker)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tExec = new ForeExec()
{
tArg = new ForeExecArg()
{
methodName = methodName,
//Monikers as parameters values
args = new OdArg[2]
{
new OdArg(){ k = 1, value = mb.id },
new OdArg(){ k = 2, value = objMoniker }
}
},
//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: