Notifies Genome to create and handle foreign keys between tables in the database.
or
or
or
<CheckIntegrity enabled="true" />.
Genome naturally ensures referential integrity as a simple consequence of the strongly typed object model. Please note that referential integrity might be temporarily violated during the transaction, although it is not violated at the end of the entire transaction. Setting CheckIntegrity notifies Genome that there might be a foreigh key constraint in the database that must not be violated during the transaction, either. Please note that setting CheckIntegrity for references causes a performance penalty. In this case, commands of the transaction have to be ordered in an appropriate way so that the foreign key constraints are not even temporally violated.
When applied on a NearObjectReference element, the foreign key is created such that it points from the referring field on the persistent type's table to the primary key fields of the referred type's table.
When applied on a JoinedInhertance element, the foreign key is created such that it points from the primary key on the persistent type's table to the primary key fields of the base type's table.
If the CheckIntegrity element is omitted, the default CheckIntegrity value of the parent element
is false, as if <NearObjectReference checkIntegrity="false"
/>, or <JoinedInheritance checkIntegrity="false" />
had been specified.
Order.cs
public abstract class Shipper : Persistent {
...
public abstract int Id { get; set; }
}
public abstract class Order : Persistent {
...
public abstract Shipper ShipVia { get; set; }
}
NorthwindSchema.xml
<Mapping xmlns="urn:TechTalk:TT.OODAL.XmlMapping">
...
<Type name="Shipper">
...
<PrimaryKey><Key>Id</Key></PrimaryKey>
<Member name="Id" PersistentField="SNr" />
</Type>
<Type name="Order">
...
<!-- the ShipVia reference will be enforced, using foreign key "Order.ShipVia" -->
<Member name="ShipVia">
<NearObjectReference CheckIntegrity="true"/>
</Member>
- or -
<!-- the ShipVia reference will be enforced, using foreign key "FK_ShipVia_Shipper" -->
<Member name="ShipVia">
<NearObjectReference>
<CheckIntegrity enabled="true" constraintName="FK_ShipVia_Shipper" />
</NearObjectReference>
</Member>
- or -
<!-- CheckIntegrity attribute is omitted, the ShipVia reference won't be enforced -->
<Member name="ShipVia">
<NearObjectReference />
</Member>
</Type>
</Mapping>
Type: TechTalk.Genome.Mapping.CheckIntegrityXmlData
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
<NearObjectReference> Element | <JoinedInheritance> Element