IModel.AddNewModel method

Namespace: NextDesign.Core

Description

Adds an instance of the specified class to the specified field of this instance as the field value. The instance will be added as the last element of the field. Instantiation is allowed even if the specified class is an abstract class, and it is added as the last element of the corresponding field. The specified field must be owned by the class type. No exception is thrown if the multiplicity upper bound constraint for a field with a multiplicity of 2 or more is violated.

Also, the specified class name must be compatible with the data type of the field. If there are multiple matching classes when fuzzy matching is performed, the first instance of the type compatible class found will be added.

argument

Name Type Description
fieldName string Field name
Null or empty string cannot be specified.
className string Class Name
Specify the class name or fully qualified name.
Null or empty string cannot be specified.
fuzzy bool className argument as the name of the class instead of the fully qualified name.
If False, evaluates as the class whose fully qualified name matches className.
If True, evaluate as if the class whose class name matches className is specified.

The default value is True.

Return value

Exception

Name Exception Class Description
Invalid argument ExtensionArgumentException If you specify null or an empty string for fieldName or className
Field not found ExtensionFieldNotFoundException If the specified field is not found in this instance's metaclass
Specified field is invalid ExtensionInvalidTypeException If a value that cannot be set is specified for the specified field
-The specified field is not a owned field
-The data type of the specified field is not a class type
-The specified field type is incompatible with the specified class
Class not found ExtensionTypeNotFoundException If the specified class is not found
Illegal operation ExtensionInvalidOperationException When the model itself is a deleted model or temporary proxy
When an inoperable field is specified in the field name
-Feature assignment field of the product line
-System.Core tag Assigned field