Skip to main content

IModel.RelateAt method

Namespace: NextDesign.Core

Description

Returns an added associated instance that associates the given model with the specified add position on the specified field of this instance.

argument

NameTypeDescription
fieldNamestringField name
You cannot specify null or an empty string.
oppositeIModelThe associated model
Cannot be null.
directionstringAddition direction in association field
- "first" : beginning
- "last" : end
- "before" : before
- "after" : after
indexintAdditional reference position
Specifies the index with 0 as the starting position.
If direction is specified as "first", it will be associated at the beginning regardless of the index value.
If direction is specified as "last", it will be associated at the end regardless of the index value.
If the direction is specified as "before", the instance will be associated with the specified position, and if it is "after", the instance will be associated with the position next to the specified position.

Return value

Exceptions

NameException ClassDescription
Invalid argumentExtensionArgumentExceptionIf null is specified for opposite
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 rangeExtensionOutOfRangeExceptionWhen a negative number is specified for index
or when a value greater than the number of elements in the corresponding field is specified for index
Illegal operationExtensionInvalidOperationExceptionIf the model itself is a deleted model or a temporary proxy
If an inoperable field is specified in the field name
- Product line feature assignment field
- System. Core tagged fields
- owning fields
Constraint ViolationExtensionIllegalFieldAccessExceptionIf the associated model is incompatible with the data type of the specified field
If the association violates the multiplicity constraint of the field
The association violates the path constraint of the field case
ExtensionInvalidModelException with an invalid model