Skip to main content

IModel.MoveTo method

Namespace: NextDesign.Core

Description

Moves this instance to be a child 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 upper multiplicity constraint of the destination field is violated.

argument

NameTypeDescription
newOwnerIModelDestination (new parent model)
You cannot specify null.
fieldNamestringField name
You cannot specify null or an empty string.
directionstringAdditional direction at destination
- "first" : beginning
- "last" : end
- "before" : before
- "after" : after
indexintAdditional reference position
Specifies the index with 0 as the starting position.
If the direction specification is "first", it moves to the beginning regardless of the index value.
If the specified direction is "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 it is "after", move the instance to the next position after the specified position.

Return value

  • void

Exceptions

NameException ClassDescription
Invalid argumentExtensionArgumentExceptionWhen null is specified for newOwner
When null or an empty string is specified for fieldName
When 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 rangeExtensionOutOfRangeExceptionWhen a negative number is specified for index
or when a value greater than the number of elements in the target field is specified for index
Specified field is invalidExtensionInvalidTypeExceptionThe specified field is not an owned field, or the specified field's data type is incompatible with the metaclass of this instance
Illegal operationExtensionInvalidOperationExceptionIf the model itself has been deleted or is a temporary proxy
If an inoperable field is specified in the field name
- Product line feature assignment field
- System Fields tagged with .Core
Circular referenceExtensionCircularReferenceExceptionIf newOwner specifies the invocation target of this method or its descendants
Invalid model specifiedExtensionInvalidModelExceptionIf a deleted model or a temporary proxy is specified as the destination model
The object itself is the base point of a project or unit, and the parent element has not been loaded. For models