SetModuleResult SetModule(OdId tObject, SetModuleArg tArg)
tObject. Unit moniker.
tArg. Operation execution parameters.
The SetModule operation is used to set up unit and start algorithms implemented in the unit.
To execute the operation, in the tObject parameter specify moniker of the repository object that is unit. The object moniker can be obtained on executing the GetObjects operation. In the tArg.meta parameter specify new unit metadata that should be applied. The operation changes the list of links to other assemblies. Changes are saved on executing the operation. The tArg.run parameter enables the user to start entry point that should be implemented in the unit.
The operation results in the list of messages that can be displayed by the executed code in the console, including compiler messages.
Below is the example of using the SetModule operation to start the unit for execution. The request contains moniker of unit in the repository. The response contains text of messages displayed in the console on execution. The C# example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example.
{
"SetModule" :
{
"tObject" :
{
"id" : "S1!M!172002"
},
"tArg" :
{
"dontCompile" : "true",
"run" : "true"
}
}
}
{
"SetModuleResult" :
{
"consoleOutput" : "The main procedure is running. The object is created. "
}
}
public static SetModuleResult RunModule(MbId mb, string modId)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetModule()
{
tArg = new SetModuleArg()
{
dontCompile = true,
run = true
},
//Create object moniker
tObject = new OdId() { id = mb.id + "!" + FindObjectById(mb, modId).k }
};
//Start unit
var result = somClient.SetModule(tSet);
return result;
}
See also: