IModel.AddNewModelTo 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 |
target | IModel | Additional reference model Additional positions are determined based on the model position specified here. If direction is specified as "first", it will be added to the top regardless of the base model. If the direction is "last", it will be added to the end regardless of the reference model. If the direction specification is "before", add the instance at the position of the specified model, and if it is "after", add the instance at the next position of the specified model. |
Whether to treat the | fuzzy | bool |
Return value
Exceptions
Name | Exception Class | Description |
---|---|---|
Argument invalid | 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 Specified as the standard for the addition position If the model is not in the field value |
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 |
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 |