Defines the object identity model of a type. The identity of the objects is determined by the value of certain selected properties of the type.
The <PrimaryKey> element defines the object identity model for the whole type family of the type. The identity of the objects in the type family is determined by the value of the properties specified. Database fields corresponding to properties are also known as the primary key fields of the type. This model corresponds to the primary key paradigm used in relational databases.
Property can be stored if one or more database fields in the underlying relational database system and the PrimaryKey object identity can be composed of one or more properties. For this reason, the identity of the object is stored in one or more database fields.
The properties specified for the primary key are also known as the identity fields of the type. Each property has to be declared on the type and mapped using <PersistentField> or <NearObjectReference> elements. The value of the properties has to be set by the developer in the constructor of every type in the type family. The identity fields' values cannot be changed after they have been established.
The <PrimaryKey> Element has to be defined on the root type of every type family in the schema.
The identity of the Employee class is defined by its Id property mapped to the
database field EmployeeID.
<Type name="Employee">
<RootInheritance />
<PrimaryKey>
<Key>Id</Key>
</PrimaryKey>
...
<Member name="Id" PersistentField="EmployeeID" />
</Type>
EmployeeTerritory represents a typical many-to-many association between Employee and
Territory classes. The identity of EmployeeTerritory is composed of the two references
Employee and Territory.
<Type name="EmployeeTerritory">
<RootInheritance />
<PrimaryKey>
<Key>Employee</Key>
<Key>Territory</Key>
</PrimaryKey>
...
<Member name="Employee">
<NearObjectReference />
</Member>
<Member name="Territory">
<NearObjectReference />
</Member>
</Type>
Type: TechTalk.Genome.Mapping.PrimaryKeyXmlData
Assembly: TechTalk.Genome.dll
Version: 4.2.4
Editions: Professional, Evaluation, Express
Database Platforms: Microsoft SQL Server 2000, Microsoft SQL Server 2005, Oracle 9i Release 2, Oracle 10g Release 2