Data Access has been discontinued. Please refer to this page for more information.


This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.

The MetaConstraint class represents a foreign key constraint in the underlying database. The source and destination tables are specified by the Source and Destination properties. Columns that participate in the constraint are referenced with the SourceColumns collection property.

The following examples shows you how to get information about the constraints in the relational part of your domain model:

private string GetConstraints(Telerik.OpenAccess.Metadata.MetadataContainer container)
   StringBuilder sb = new StringBuilder();
   foreach (MetaConstraint constraint in container.Constraints)
       sb.AppendFormat("\nDestinationTable: {0}", constraint.DestinationTable.Name);
       sb.AppendFormat("\nSourceTable: {0}", constraint.SourceTable.Name);
   return sb.ToString();
Private Function GetConstraints(ByVal container As Telerik.OpenAccess.Metadata.MetadataContainer) As String
 Dim sb As New StringBuilder()
 For Each constraint As MetaConstraint In container.Constraints
  sb.AppendFormat(vbLf & "DestinationTable: {0}", constraint.DestinationTable.Name)
  sb.AppendFormat(vbLf & "SourceTable: {0}", constraint.SourceTable.Name)
 Next constraint
 Return sb.ToString()
End Function

The following example shows a sample XML representation of a MetaTable element that uses a MetaConstraint to specify the columns that participate in a foreign key association:

<orm:table name="JobCandidate" schema="HumanResources">
 <orm:column name="JobCandidateID" sql-type="int" nullable="false" length="0" scale="0" 
    primary-key="true" backend-calculated="true" ado-type="Int32" />
 <orm:column name="EmployeeID" sql-type="int" nullable="true" length="0" scale="0" 
    ado-type="Int32" />
 <orm:column name="Resume" sql-type="xml" nullable="true" length="0" scale="0"
    ado-type="LongVarchar" />
 <orm:constraint name="FK_JobCandidate_Employee_EmployeeID" schema="HumanResources" 
   <orm:column name="EmployeeID" sql-type="int" nullable="true" length="0" scale="0" 
        ado-type="Int32" />