Skip to main content

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

NameTypeDescription
newOwnerIModelDestination (new parent model)
null cannot be specified.
fieldNamestringField name
null or an empty string cannot be specified.
directionstringDirection of addition at destination
- "first" : Beginning
- "last" : End
- "before" : Before
- "after" : After
indexintReference 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

NameException classDescription
Invalid argumentExtensionArgumentExceptionIf 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 foundExtensionFieldNotFoundExceptionIf the specified field is not found in the metaclass of the destination instance
Invalid index rangeExtensionOutOfRangeExceptionIf 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 fieldExtensionInvalidTypeExceptionThe 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 operationExtensionInvalidOperationExceptionIf 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 referenceExtensionCircularReferenceExceptionIf the target of this method call or its descendants is specified for newOwner.
An invalid model is specified.ExtensionInvalidModelExceptionIf 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.