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