IModel.MoveTo method

Namespace: NextDesign.Core

Description

Moves this instance to be a child element of the specified model. If the destination parent element and field are the same as the current parent element and field, change the order of the elements in the specified field. Note that no exception is thrown even if the multiplicity upper limit constraint of the destination field is violated.

argument

Name Type Description
newOwner IModel Destination (new parent model)
null cannot be specified.
fieldName string Field name
Null or empty string cannot be specified.
direction string Additional direction to move to
-"first": first
-"last": last
-"before": before
-"after": after
index int Additional reference position
Specify the index with 0 as the start position.
When the direction is specified as "first", it moves to the beginning regardless of the index value.
When the direction is specified as "last", it moves to the end regardless of the index value.
If the direction is "before", move the instance to the specified position, and if "after", move the instance to the next position after the specified position.

Return value

  • void

Exception

Name Exception Class Description
Invalid argument ExtensionArgumentException When null is specified for newOwner
When null is specified for fieldName or when an empty string is specified
When a character string other than the default character string is specified for direction
Field not found ExtensionFieldNotFoundException If the specified field is not found in the metaclass of the destination instance
Incorrect index range ExtensionOutOfRangeException If a negative number is specified for index
or if a value greater than the number of elements in the corresponding field at the move destination is specified for index
Specified field is invalid ExtensionInvalidTypeException The specified field is not an owned field or the data type of the specified field is incompatible with the metaclass of this instance
Illegal operation ExtensionInvalidOperationException If the model itself is a deleted model or temporary proxy
If an inoperable field is specified in the field name
-Product line feature assignment field
-System.Core tag Assigned field
Circular reference When ExtensionCircularReferenceException newOwner is specified as the invocation target of this method or its descendants
When an invalid model is specified ExtensionInvalidModelException When a deleted model or temporary proxy is specified as the destination model