SetAssemblyResult SetAssembly(OdId tObject, SetAssemblyArg tArg)
tObject. Assembly moniker.
tArg. Operation execution parameters.
The SetAssembly operation is used to set up assembly and start algorithms implemented in the assembly.
To execute the operation, in the tObject parameter specify moniker of repository object that is assembly. The object moniker can be obtained on executing the GetObjects operation. In the tArg.meta parameter specify assembly 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 assembly.
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 SetAssembly operation to start assembly for execution. The request contains moniker of assembly 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.
{
"SetAssembly" :
{
"tObject" :
{
"id" : "S1!M!172000"
},
"tArg" :
{
"run" : "true"
}
}
}
{
"SetAssemblyResult" :
{
"consoleOutput" : "Hello World!!! Current date: August 11 2020 Current time: 11:42:12. Current repository: Warehouse "
}
}
public static SetAssemblyResult RunAssembly(MbId mb, string assmId)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetAssembly()
{
tArg = new SetAssemblyArg()
{
run = true
},
//Create object moniker
tObject = new OdId() { id = mb.id + "!" + FindObjectById(mb, assmId).k }
};
//Start assembly
var result = somClient.SetAssembly(tSet);
return result;
}
See also: