ObjectConstraint Complex Type Complex Type

ObjectConstraint Complex Type

Defines the elements used to define a constraint on one or both roles of a relationship. The constraint can be identified by name in case of failure. An object may contain nested relationship constraints or constraint members that will be evaluated if the roles match the instances participating in the relationship.

<xs:complexType name="ObjectConstraint"> <xs:complexContent> <xs:extension base="StructuralConstraint" > <xs:choice minOccurs="0" maxOccurs="unbounded" > <xs:element name="Constraint" type="ConstraintMember" />

  • Constraint
    List of constraint members that are nested in this constraint. They are evaluated against the primary object definition.

<xs:element name="RelationshipConstraint" type="RelationshipConstraint" />

  • RelationshipConstraint
    A nested relationship constraint. The relationship is evaluated as if it had been declared on the definition associated with the primary role.

<xs:element name="RelationshipConstraintGroup" type="RelationshipConstraintGroup" />

  • RelationshipConstraintGroup
    A nested relationship constraint group.

<xs:element name="ConstraintGroup" type="ConstraintGroup" />

  • ConstraintGroup
    A nested constraint group.

</xs:choice> <xs:attribute name="PrimaryRole" type="RolesList" use="required" />

  • PrimaryRole
    Name of the relationship role targeted by this constraint.

<xs:attribute name="PrimaryObjectDefinition" type="QualifiedName" use="required" />

  • PrimaryObjectDefinition
    Name of the object definition associated with the primary role.

<xs:attribute name="SecondaryRole" type="RolesList" use="optional" />

  • SecondaryRole
    Name of the other relationship role targeted by this constraint. This attribute is optional.

<xs:attribute name="SecondaryObjectDefinition" type="QualifiedName" use="optional" />

  • SecondaryObjectDefinition
    Name of the object definition associated with the secondary role on the relationship. This is required if a secondary role is specified.

<xs:attribute name="MinOccurs" type="MinOccurs" use="optional" />

  • MinOccurs
    Minimum number of times this constraint can match the objects on a relationship.

<xs:attribute name="MaxOccurs" type="MaxOccurs" use="optional" />

  • MaxOccurs
    Maximum number of times this constraint can match the objects on a relationship.

</xs:extension> </xs:complexContent> </xs:complexType>

  • ObjectConstraint
    Describes a constraint on one or both roles of a relationship.

Child Elements

Element Type Description
Constraint ConstraintMember

List of constraint members that are nested in this constraint. They are evaluated against the primary object definition.

ConstraintGroup ConstraintGroup

A nested constraint group.

RelationshipConstraint RelationshipConstraint

A nested relationship constraint. The relationship is evaluated as if it had been declared on the definition associated with the primary role.

RelationshipConstraintGroup RelationshipConstraintGroup

A nested relationship constraint group.

Attributes

Name Type Description
MaxOccurs MaxOccurs

Maximum number of times this constraint can match the objects on a relationship.

MinOccurs MinOccurs

Minimum number of times this constraint can match the objects on a relationship.

PrimaryObjectDefinition QualifiedName

Name of the object definition associated with the primary role.

PrimaryRole RolesList

Name of the relationship role targeted by this constraint.

SecondaryObjectDefinition QualifiedName

Name of the object definition associated with the secondary role on the relationship. This is required if a secondary role is specified.

SecondaryRole RolesList

Name of the other relationship role targeted by this constraint. This attribute is optional.

Remarks

The PrimaryRole and SecondaryRole attributes refer to the "end" of the relationship that contains the object constraint. In the following XML code from Microsoft.WebApplication.sdmdocument, the "Member" target role on the relationship constraint refers to the member in the WebAppContainsWebApplication relationship, which is the resource IIS:WebApplication. And the "Parent" primary role on the object constraint refers to the parent in the same relationship definition, which is the system definition WebApplication.

<RelationshipConstraint 
    Name="CheckWebContentTypeSupported" 
    RelationshipDefinition="WebAppContainsWebApplication" 
    TargetRole="Member" 
    RaiseError="false">
            
    <ObjectConstraint 
        Name="GoToWebApp" 
        PrimaryRole="Parent" 
        PrimaryObjectDefinition="WebApplication" 
        RaiseError="false">
    </ObjectConstraint>
</RelationshipConstraint>

There are two possibilities for the role you select in any given constraint, depending on the relationship.

  • If the relationship (the RelationshipDefinition attribute on the <RelationshipConstraint> element) is a HostingDefinition, the target role can only be either Host or Guest.
  • If the relationship is a ContainmentDefinition, the target role can only be either Parent or Member.
  • If the relationship is a DelegationDefinition, the target rolse can only be either Proxy or Delegate.
  • If the relationship is a CommunicationDefinition, the target role can only be either Client or Server.
  • If the relationship is a ReferenceDefinition, the target role can be either Source or Dependent.

See Also

SystemDefinitionModel Schema Complex Types

Send comments about this topic to Microsoft

Build date: 10/2/2007