Principal Element (CSDL)

The Principal element in conceptual schema definition language (CSDL) is a child element to the ReferentialConstraint element that defines the principal end of a referential constraint. A ReferentialConstraint element defines functionality that is similar to a referential integrity constraint in a relational database. In the same way that a column (or columns) from a database table can reference the primary key of another table, a property (or properties) of an entity type can reference the entity key of another entity type. The entity type that is referenced is called the principal end of the constraint. The entity type that references the principal end is called the dependent end of the constraint. PropertyRef elements are used to specify which keys are referenced by the dependent end.

The Principal element can have the following child elements (in the order listed):

Applicable Attributes

The table below describes the attributes that can be applied to the Principal element.

Attribute Name Is Required Value

Role

Yes

The name of the entity type on the principal end of the association.

Ee473441.note(en-us,VS.100).gifNote:
Any number of annotation attributes (custom XML attributes) may be applied to the Principal element. However, custom attributes may not belong to any XML namespace that is reserved for CSDL. The fully-qualified names for any two custom attributes cannot be the same.

Example

The following example shows a ReferentialConstraint element that is part of the definition of the PublishedBy association. The Id property of the Publisher entity type makes up the principal end of the referential constraint.

<Association Name="PublishedBy">
  <End Type="BooksModel.Book" Role="Book" Multiplicity="*" >
  </End>
  <End Type="BooksModel.Publisher" Role="Publisher" Multiplicity="1" />
  <ReferentialConstraint>
    <Principal Role="Publisher">
      <PropertyRef Name="Id" />
    </Principal>
    <Dependent Role="Book">
      <PropertyRef Name="PublisherId" />
    </Dependent>
  </ReferentialConstraint>
</Association>

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft