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
Name | Type | Description |
---|---|---|
newOwner | IModel | Destination (new parent model) You cannot specify null. |
fieldName | string | Field name You cannot specify null or an empty string. |
direction | string | Additional direction at destination - "first" : beginning - "last" : end - "before" : before - "after" : after |
index | int | Additional 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
Name | Exception Class | Description |
---|---|---|
Invalid argument | ExtensionArgumentException | When 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 found | ExtensionFieldNotFoundException | If the specified field is not found in the metaclass of the destination instance |
Invalid index range | ExtensionOutOfRangeException | When 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 invalid | ExtensionInvalidTypeException | The specified field is not an owned field, or the specified field's data type is incompatible with the metaclass of this instance |
Illegal operation | ExtensionInvalidOperationException | If 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 reference | ExtensionCircularReferenceException | If newOwner specifies the invocation target of this method or its descendants |
Invalid model specified | ExtensionInvalidModelException | If 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 |