PropertyRef 要素 (SSDL)
ストア スキーマ定義言語 (SSDL) の PropertyRef 要素は、EntityType 要素に定義されたプロパティを参照して、そのプロパティが次の役割のいずれかを果たすことを示します。
EntityType が表すテーブルの主キーの一部になる。PropertyRef 要素を 1 つ以上使用して、主キーを定義することができます。詳細については、「Key 要素」を参照してください。
参照に関する制約の依存 End またはプリンシパル End になる。詳細については、「ReferentialConstraint 要素」を参照してください。
PropertyRef 要素には、次の子要素のみを含めることができます。
Documentation (0 個または 1 個)
適用可能な属性
PropertyRef 要素に適用できる属性を次の表に示します。
属性名 |
必須 |
値 |
---|---|---|
Name |
はい |
参照されているプロパティの名前。 |
注意
PropertyRef 要素には、任意の数の annotation 属性 (カスタム XML 属性) を適用できます。ただし、カスタム属性は CSDL 用に予約されたどの XML 名前空間にも属さない場合があります。カスタム属性の完全修飾名は一意である必要があります。
例
次の例は、EntityType 要素に定義されたプロパティを参照して主キーを定義するときに使用する PropertyRef 要素を示します。
<EntityType Name="Customers">
<Documentation>
<Summary>Summary here.</Summary>
<LongDescription>Long description here.</LongDescription>
</Documentation>
<Key>
<PropertyRef Name="CustomerId" />
</Key>
<Property Name="CustomerId" Type="int" Nullable="false" />
<Property Name="Name" Type="nvarchar(max)" Nullable="false" />
</EntityType>
<EntityType Name="Customers">
<Documentation>
<Summary>Summary here.</Summary>
<LongDescription>Long description here.</LongDescription>
</Documentation>
<Key>
<PropertyRef Name="CustomerId" />
</Key>
<Property Name="CustomerId" Type="int" Nullable="false" />
<Property Name="Name" Type="nvarchar(max)" Nullable="false" />
</EntityType>
<EntityType Name="Customers">
<Documentation>
<Summary>Summary here.</Summary>
<LongDescription>Long description here.</LongDescription>
</Documentation>
<Key>
<PropertyRef Name="CustomerId" />
</Key>
<Property Name="CustomerId" Type="int" Nullable="false" />
<Property Name="Name" Type="nvarchar(max)" Nullable="false" />
</EntityType>