Skip to main content

IModel.AddNewModel method

Namespace: NextDesign.Core

Description

Adds an instance of the specified class as a field value to the specified field of this instance.
The instance will be added as a trailing element in that field.
Even if the specified class is an abstract class, instantiation is allowed and it will be added as an element at the end of the corresponding field.
The specified field must be an owning field of the class type.
Violation of the upper multiplicity constraint for fields with multiplicity greater than or equal to 2 does not throw an exception.

Also, the class name you specify must specify a type that is compatible with the data type of the field.
Note that if there are multiple matching classes when performing a fuzzy match, the instance of the first type-compatible class that is found is added.

argument

NameTypeDescription
fieldNamestringField name
You cannot specify null or an empty string.
classNamestringClass Name
Specify the name or fully qualified name of the class.
Null or empty string cannot be specified.
Whether to treat thefuzzybool

Return value

Exceptions

NameException ClassDescription
Invalid argumentExtensionArgumentExceptionIf null or an empty string is specified for fieldName or className
Field not foundExtensionFieldNotFoundExceptionIf the specified field is not found in this instance's metaclass
Specified field is invalidExtensionInvalidTypeExceptionIf 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 foundExtensionTypeNotFoundExceptionIf the specified class is not found
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. Fields tagged with Core