Below is the example of using the OpenMs operation to open a modeling container for edit. The request contains the container moniker and whether the container must be opened for edit. The response contains moniker of opened modeling container instance. Any additional data is not extracted.
{ "OpenMs" : { "tOb" : { "id" : "DHBHAJPMANJBFOAEDNFOJNMAGMDOKOGEAIHDMOJANENOLHHL!M!1581" }, "tArg" : { "args" : { "openForEdit" : "true" } } } }
{ "OpenMsResult" : { "id" : { "id" : "DHBHAJPMANJBFOAEDNFOJNMAGMDOKOGEAIHDMOJANENOLHHL!M!S!CLBDENJANANJBFOAEOCBBCCNEGGPHIFMEPJKAOHFLAPDLCCEC" }, "readOnly" : "0" } }
The OpenMsEdit function opens modeling container for edit and returns a container instance. The repository connection moniker and container identifier are passed as input parameters. The example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example.
public static MsId OpenMsEdit(MbId mb, string msId) { // Get modeling container key ulong msKey = FindObjectById(mb, msId).k; // Set operation execution parameters var tMsOp = new OpenMs(); tMsOp.tArg = new OpenMsArg() { // Set container open parameters args = new MsOpenArgs() { openForEdit = true } }; tMsOp.tOb = new OdId(); // Form modeling container moniker tMsOp.tOb.id = mb.id + "!" + msKey.ToString(); // Create proxy object for operation execution var somClient = new SomPortTypeClient(); // Open modeling container for edit OpenMsResult tResult = somClient.OpenMs(tMsOp); return tResult.id; }
See also: