Skip to main content

IModel.RelateAt method

Namespace: NextDesign.Core

Description

Returns the added related instance, associating the given model with the specified additional position in the specified field of this instance.

argument

NameTypeDescription
fieldNamestringField name
Null or an empty string cannot be specified.
oppositeIModelAssociate model
Null cannot be specified.
directionstringAddition direction in the associated field
-"first": First
-"last": Last
-"before": Before
-"after": After
indexintAdditional reference position
Specify the index with the start position as 0.
If the direction is specified as "first", it will be associated at the beginning regardless of the index value.
If the direction is specified as "last", it will be associated at the end regardless of the index value.
If the direction specification is "before", the instance is associated with the specified position, and if it is "after", the instance is associated with the position next to the specified position.

Return value

Exception

NameException ClassDescription
Invalid argumentExtensionArgumentExceptionWhen null is specified for opposite
When null or an empty string is specified for fieldName
When a character string other than the default character 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 or equal to the number of elements in the corresponding field is specified for index
Illegal operationExtensionInvalidOperationExceptionIf it is a deleted model or temporary proxy
If an inoperable field is specified in the field name
-Product line feature assignment field
-System. Fields with Core tags
-Owned fields
Constraint violationExtensionIllegalFieldAccessExceptionWhen the associated model is incompatible with the specified field data type
When the association violates the field multiplicity constraint
The association violates the field path constraint. If
Invalid model specifiedExtensionInvalidModelExceptionWhen a deleted model or temporary proxy is specified for the associated model