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
| Name | Type | Description |
|---|---|---|
| fieldName | string | Field Name Cannot be null or an empty string. It must also be an owned field of a class type. |
| className | string | Class 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. |
| fuzzy | bool | Fuzzy 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
| Name | Exception Class | Description |
|---|---|---|
| Invalid Argument | ExtensionArgumentException | When null or an empty string is specified for fieldName or className |
| Field Not Found | ExtensionFieldNotFoundException | When the specified field is not found in the metaclass of this instance |
| Invalid Specified Field | ExtensionInvalidTypeException | When 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 Found | ExtensionTypeNotFoundException | When the specified class is not found |
| Invalid Operation | ExtensionInvalidOperationException | When 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 |