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
Name | Type | Description |
---|---|---|
fieldName | string | Field name Null or an empty string cannot be specified. |
className | string | class name Specify the name of the class or the fully qualified name. Null or an empty string cannot be specified. |
fuzzy | bool | className 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
Name | Exception Class | Description |
---|---|---|
Invalid argument | ExtensionArgumentException | When null or empty string is specified for fieldName or className |
Field not found | ExtensionFieldNotFoundException | If the specified field is not found in the metaclass of this instance |
Specified field invalid | ExtensionInvalidTypeException | When 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 found | ExtensionTypeNotFoundException | If the specified class cannot be found |
Illegal operation | ExtensionInvalidOperationException | If 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 |