Principal Element (SSDL)
The Principal element in store schema definition language (SSDL) is a child element to the ReferentialConstraint element that defines the principal end of a foreign key constraint (also called a referential constraint). The Principal element specifies the primary key column (or columns) in a table that is referenced by another column (or columns). PropertyRef elements specify which columns are referenced. The Dependent element specifies columns that reference the primary key columns that are specified in the Principal element.
The Principal element can have the following child elements (in the order listed):
PropertyRef (one or more)
Annotation elements (zero or more)
Applicable Attributes
The following table describes the attributes that can be applied to the Principal element.
Attribute Name | Is Required | Value |
---|---|---|
Role |
Yes |
The same value as the Role attribute (if used) of the corresponding End element; otherwise, the name of the table that contains the referenced column. |
Note
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 an Association element that uses a ReferentialConstraint element to specify the columns that participate in the FK_CustomerOrders foreign key constraint. The Principal element specifies the CustomerId column of the Customer table as the principal end of the constraint.
<Association Name="FK_CustomerOrders">
<End Role="Customers"
Type="ExampleModel.Store.Customers" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<End Role="Orders"
Type="ExampleModel.Store.Orders" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="Customers">
<PropertyRef Name="CustomerId" />
</Principal>
<Dependent Role="Orders">
<PropertyRef Name="CustomerId" />
</Dependent>
</ReferentialConstraint>
</Association>
See Also
Concepts
Entity Framework Overview
SSDL Specification
Other Resources
CSDL, SSDL, and MSL Specifications
ADO.NET Entity Data Model Tools