Skip to main content

IModel.AddNewModel Method

Namespace: NextDesign.Core

Description​

This method adds an instance of the specified class as a field value to the end of the specified field in this instance.
However, if the specified field has a multiplicity limit of 1 and already has an instance in that field, it replaces the first instance.

It adds an instance even if the specified class is an abstract class.

Argument​

NameTypeDescription
fieldNamestringField Name
Cannot be null or an empty string.
It must also be an owned field of a class type.
classNamestringClass Name
Specify the name or fully qualified name of the class.
Cannot be null or an empty string.
Also, it must be of a type compatible with the field's data type.
fuzzyboolFuzzy Match Option
Whether to treat the className argument as the name of a class rather than its fully qualified name.
If False, it is evaluated as specifying a class whose fully qualified name matches className.
If True, it is evaluated as specifying a class whose class name matches className.
Also, if there are multiple matching classes, it adds the first type-compatible class found.

The default value is True.

Return value​

Exception​

NameException ClassDescription
Invalid ArgumentExtensionArgumentExceptionWhen null or an empty string is specified for fieldName or className
Field Not FoundExtensionFieldNotFoundExceptionWhen the specified field is not found in the metaclass of this instance
Invalid Specified FieldExtensionInvalidTypeExceptionWhen an invalid value is specified for the specified field
- The specified field is not an owned field
- The data type of the specified field is not a class type
- The type of the specified field and the specified class are incompatible
Class Not FoundExtensionTypeNotFoundExceptionWhen the specified class is not found
Invalid OperationExtensionInvalidOperationExceptionWhen the model itself is deleted or a temporary proxy
When an unoperable field is specified as the field name
- Product line feature assignment fields
- Fields tagged with System.Core
If an invalid field is specified