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 is added as the last element in the field. Even if the specified class is an abstract class, it allows instantiation and is added as the last element of the corresponding field. The field you specify must be a class-owned field. No exception is thrown if the multiplicity upper bound constraint for a field with a multiplicity of 2 or greater is violated.

Also, the class name you specify must be a type that is compatible with the data type of the field. If there are multiple matching classes when making an ambiguous match, add the instance of the type-compatible class found first.

argument

NameTypeDescription
fieldNamestringField name
Null or an empty string cannot be specified.
classNamestringclass name
Specify the name of the class or the fully qualified name.
Null or an empty string cannot be specified.
fuzzyboolclassName Whether to treat the argument as a class name rather than a fully qualified name.
If False, evaluate as specifying a class whose fully qualified name matches className.
If True, evaluate as specifying a class whose class name matches className.

The default value is True.

Return value

Exception

NameException ClassDescription
Invalid argumentExtensionArgumentExceptionWhen null or empty string is specified for fieldName or className
Field not foundExtensionFieldNotFoundExceptionIf the specified field is not found in the metaclass of this instance
Specified field invalidExtensionInvalidTypeExceptionWhen a value that cannot be set for the specified field is specified
-The specified field is not a owned field
-The data type of the specified field is not a class type
br/>-The specified field type and the specified class are incompatible
Class not foundExtensionTypeNotFoundExceptionIf the specified class cannot be found
Illegal operationExtensionInvalidOperationExceptionIf it is a deleted model or temporary proxy
If an inoperable field is specified in the field name
-Product line feature assignment field
-System. Fields with Core tags