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

MetaTable

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 MetaTable class represents a table in the underlying database. During runtime, you could access all tables that are available in the current container instance via the Tables collection property of the MetadataContainer.

The MetaTable class exposes the following properties:

  • Columns - a collection of MetaColumn objects that describe the columns for this table.
  • Constraints - a collection of MetaConstraint objects that describe the constraints related to this table.
  • Indexes - a collection of MetaIndex objects that describe the indexes available for the current table.
  • FullName - the full name of the table in the following format: 'SchemaName'.'TableName'. If the schema is the default database schema (e.g. 'dbo') then this property returns only the table name.
  • IsJoinTable - indicates whether the table is a join table in the database.
  • PKConstraintName - the name of the primary key constraint in the database.
  • InsertStoredProcedure - the MetaStoredProcedure associated with all insert operations.
  • UpdateStoredProcedure - the MetaStoredProcedure associated with all update operations.
  • DeleteStoredProcedure - the MetaStoredProcedure associated with all delete operations.

The following example shows you how to extract information about the tables in your database:

private string GetTables(Telerik.OpenAccess.Metadata.MetadataContainer container)
{
   StringBuilder sb = new StringBuilder();
   foreach (MetaTable table in container.Tables)
   {
       sb.AppendFormat("\nTable: {0}", table.Name);
   }
   return sb.ToString();
}
Private Function GetTables(ByVal container As Telerik.OpenAccess.Metadata.MetadataContainer) _
    As String
 Dim sb As New StringBuilder()
 For Each table As MetaTable In container.Tables
  sb.AppendFormat(vbLf & "Table: {0}", table.Name)
 Next table
 Return sb.ToString()
End Function

The following example shows a sample XML representation of a MetaTable element with two MetaColumn elements:

<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="Resume" sql-type="xml" nullable="true" length="0" scale="0" 
    ado-type="LongVarchar" />
</orm:table>