Skip to main content

IModel.CanRelate method

Namespace: NextDesign.Core

Description

Checks if the specified field of this instance can be associated with the given model. Returns True if it can be associated. This method evaluates not only the field type, but also the following field constraints: [Constraints to evaluate]

  • Path constraint
  • Type constraints
  • Multiplicity upper limit

If the model itself or the associated model is a deleted model or a temporary proxy, False is returned. It also returns False if the following fields are specified:

  • Product line feature assignment field
  • Field with System.Core tag
  • Owned field

argument

NameTypeDescription
fieldNamestringField name
Null or an empty string cannot be specified.
oppositeIModelAssociate model
Null cannot be specified.

Return value

  • bool

Exception

NameException ClassDescription
Invalid argumentExtensionArgumentExceptionWhen null is specified for opposite
When null or an empty string is specified for fieldName
Field not foundExtensionFieldNotFoundExceptionIf the specified field is not found in the metaclass of this instance