IModel.MoveTo Method
Namespace: NextDesign.Core
Description
Moves this instance to become a child element of the specified model.
If the parent element and field of the destination are the same as the current parent element and field, the order of elements in the specified field will be changed.
Note that no exception will be thrown even if the upper multiplicity constraint of the destination field is violated.
Arguments
Name | Type | Description |
---|---|---|
newOwner | IModel | Destination (new parent model) null cannot be specified. |
fieldName | string | Field name null or an empty string cannot be specified. |
direction | string | Direction of addition at destination - "first" : Beginning - "last" : End - "before" : Before - "after" : After |
index | int | Reference position for addition Specify an index with the first position being 0. If "direction" is specified as "first", it will move to the beginning regardless of the index value. If "direction" is specified as "last", it will move to the end regardless of the index value. If "before" is specified as "direction", the instance will move to the specified position, and if "after", it will move to the position next to the specified position. |
Return value
- void
Exception
Name | Exception class | Description |
---|---|---|
Invalid argument | ExtensionArgumentException | If null is specified for newOwner If null or an empty string is specified for fieldName If a string other than the default string is specified for direction |
Field not found | ExtensionFieldNotFoundException | If the specified field is not found in the metaclass of the destination instance |
Invalid index range | ExtensionOutOfRangeException | If a negative number is specified for index Or, index is specified as a value greater than the number of elements in the destination field. |
Invalid specified field | ExtensionInvalidTypeException | The specified field is not an owned field, or the data type of the specified field is not compatible with the metaclass of this instance. |
Invalid operation | ExtensionInvalidOperationException | If the model itself is a deleted model or a temporary proxy. If an inoperable field is specified for the field name. - Feature assignment field of a product line - Field with the System.Core tag If an invalid field is specified. |
Circular reference | ExtensionCircularReferenceException | If the target of this method call or its descendants is specified for newOwner. |
An invalid model is specified. | ExtensionInvalidModelException | If a deleted model or a temporary proxy is specified for the destination model. If the model itself is the base point in a project or unit, and the parent element is not loaded. |