IModel.AddNewModelAt method
Namespace: NextDesign.Core
Description
Adds an instance of the specified class at the specified add position as a field value to the specified field of this instance.
Allows instantiation even if the specified class is an abstract class, and adds it as a field value at the specified position.
The specified field must be an owning field of the class type.
Note that no exception is thrown even if the upper multiplicity constraint of a field with a multiplicity of 2 or greater is violated.
The class name you specify must specify a type that is compatible with the data type of the field.
Also, when doing a fuzzy match, if there are multiple matching classes, add the instance of the first type-compatible class found.
argument
Name | Type | Description |
---|---|---|
fieldName | string | Field name You cannot specify null or an empty string. |
className | string | Class Name Specify the name or fully qualified name of the class. Null or empty string cannot be specified. |
direction | string | Additional direction - "first" : beginning - "last" : end - "before" : before - "after" : after |
index | int | Additional reference position Specifies the index with 0 as the starting position. If direction is specified as "first", it will be added to the beginning regardless of the index value. If the direction is "last", it will be added to the end regardless of the index value. If the direction is "before", add the instance at the specified position, and if it is "after", add the instance at the next position after the specified position. |
Whether to treat the | fuzzy | bool |
Return value
Exceptions
Name | Exception Class | Description |
---|---|---|
Invalid argument | ExtensionArgumentException | If null or an empty string is specified for fieldName or className If a string other than the default string is specified for direction |
Field not found | ExtensionFieldNotFoundException | If the specified field is not found in this instance's metaclass |
Illegal field access | ExtensionIllegalFieldAccessException | If this method is executed for a field with a maximum multiplicity of 1 |
Invalid index range | ExtensionOutOfRangeException | When 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 |
Specified field is invalid | ExtensionInvalidTypeException | If a value that cannot be set in the specified field is specified - The specified field is not an owned field - The data type of the specified field is not a class type< br/>- the type of the specified field and the specified class are incompatible |
Class not found | ExtensionTypeNotFoundException | If the specified class is not found |
Illegal operation | ExtensionInvalidOperationException | If 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. Fields tagged with Core |