Skip to main content

IModel.RelateAt Method

Namespace: NextDesign.Core

Description

Relates the specified model to the specified field of this instance by specifying the addition position, and returns the added related instance.

Arguments

NameTypeDescription
fieldNamestringField name
Null or an empty string cannot be specified.
oppositeIModelModel to associate
Null cannot be specified.
directionstringAddition direction in the association field
- "first" : Beginning
- "last" : End
- "before" : Before
- "after" : After
indexintAddition reference position
Specify an index with the first position being 0.
If "direction" is specified as "first", the association will be made at the beginning regardless of the index value.
If "direction" is specified as "last", the association will be made at the end regardless of the index value.
If "before" is specified as "direction", the instance will be associated at the specified position, and if "after", the instance will be associated at the position following the specified position.

Return value

Exception

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 rangeExtensionOutOfRangeExceptionIf a negative number is specified for index
Or if a value greater than the number of elements in the corresponding field is specified for index
Invalid operationExtensionInvalidOperationExceptionIf the model itself is a deleted model or a temporary proxy
If an inoperable field is specified for the field name
- Product line feature assignment fields
- Fields tagged with System.Core
- Owned fields
If an invalid field is specified
Constraint violationExtensionIllegalFieldAccessExceptionIf the model to be associated is not compatible with the data type of the specified field
If the association violates the multiplicity constraint of the field
If the association violates the path constraint of the field
An invalid model is specifiedExtensionInvalidModelExceptionIf a deleted model or temporary proxy is specified as the model to be associated