Skip to main content

IModel.CanRelate Method

Namespace: NextDesign.Core

Description

Checks whether the specified field of this instance can be related to the specified model.
Returns True if the relationship is possible.
This method evaluates not only the field type but also the following field constraints.
[Constraints to evaluate]

  • Path constraint
  • Type constraint
  • Upper multiplicity limit

Note that if the model itself or the model to be related is a deleted model or a temporary proxy, False is returned.
Also, if the following fields are specified, False is returned.

  • Product line feature assignment fields
  • Fields tagged with System.Core
  • Owned fields
  • Invalid fields

Arguments

NameTypeDescription
fieldNamestringField name
Cannot be null or an empty string.
oppositeIModelAssociated model
Cannot be null.

Return value

  • bool

Exception

NameException classDescription
Invalid argumentExtensionArgumentExceptionIf null is specified for opposite
If null or an empty string is specified for fieldName
Field not foundExtensionFieldNotFoundExceptionIf the specified field is not found in the metaclass of this instance