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

MetaPersistentType

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 MetaPersistentType represents a class containing the metadata for the persistent classes used by Telerik Data Access (e.g.: Product, Category, Order, etc.). It represents the structure of a top-level concept, such as a product or category, in a conceptual model. The MetaPersistentType is one of the most important types in the Telerik Data Access metadata. It derives from MetaType class and exposes the following properties:

  • Table - gets the MetaTable instance that is mapped to the current type. It could be null.
  • BaseType - gets the type from which the current type directly inherits.
  • DerivedTypes - gets a list of types that have the current type as their base type.
  • InheritanceStrategy - gets the inheritance strategy for the current type. It could be Default, Flat, Vertical or Horizontal.
  • KeyGeneratorName - gets the name of the used key generator. It could be Default, Autoinc, Guid and HighLow. Currently no custom key generators are allowed, only those provided with Telerik Data Access.
  • DiscriminatorValue - the database class id used to distinguish a particular instance when loaded.
  • DiscriminatorColumn - gets the column that holds the discriminator value.
  • ClassId - the in-memory id used to distinguish a particular instance.
  • OptimisticConcurrencyControlStrategy - gets the concurrency control strategy used during write time. It could be Default, None, Version, Timestamp, Changed, Backend, All.
  • ShouldUpdateSchema - gets a value indicating whether the relational store definition for the current type requires modification.
  • IsArtificial - gets whether this field is marked as artificial.
  • IdentityType - gets the identity type of the current type. It could be Default, Internal, SingleField, MultipleField.
  • DataAccessKind - gets the type of access to user data for the current type. It could be ReadWrite, InsertOnly, ReadOnly.

The following examples shows you how to get information about the persistent types in your domain model:

private string GetPersistentTypes(Telerik.OpenAccess.Metadata.MetadataContainer container)
{
   StringBuilder sb = new StringBuilder();
   foreach (MetaPersistentType persistenType in container.PersistentTypes)
   {
       sb.AppendFormat("\nPersistentTypeName: {0}", persistenType.Name);
   }
   return sb.ToString();
}
Private Function GetPersistentTypes(ByVal container As Telerik.OpenAccess.Metadata.MetadataContainer) As String
 Dim sb As New StringBuilder()
 For Each persistenType As MetaPersistentType In container.PersistentTypes
  sb.AppendFormat(vbLf & "PersistentTypeName: {0}", persistenType.Name)
 Next persistenType
 Return sb.ToString()
End Function

The following example shows a PersistentType element with two primary key Property elements and one NavigationProperty element:

<orm:class name="EmployeeAddress" behavior="readwrite" 
    uniqueId="0648fddd-bf9e-43a7-9aff-ab1673485ef4">
 <orm:table name="EmployeeAddress" schema="HumanResources" />
 <orm:identity>
   <orm:multiple-field>
     <orm:single-field field-name="_employeeID" />
     <orm:single-field field-name="_addressID" />
   </orm:multiple-field>
 </orm:identity>
 <orm:field name="_employeeID" property="EmployeeID" behavior="readwrite" 
    uniqueId="288c68b5-286c-4cac-826a-b0e1c6ae2b98" type="System.Int32">
   <orm:column name="EmployeeID" sql-type="int" nullable="false" length="0" scale="0" 
    primary-key="true" ado-type="Int32" />
 </orm:field>
 <orm:field name="_addressID" property="AddressID" behavior="readwrite" 
    uniqueId="1a9cb666-b30a-4a50-837d-be7fa7ddd13e" type="System.Int32">
   <orm:column name="AddressID" sql-type="int" nullable="false" length="0" scale="0" 
    primary-key="true" ado-type="Int32" />
 </orm:field>
 <orm:field name="_employee" property="Employee" behavior="readwrite" 
    uniqueId="80ac9586-a8c8-433f-97c7-50ee7a7a0e41" type="MetadataDemo.Employee">
   <orm:reference uniqueId="61942b3c-e748-46d0-afa8-f8160c754c9d">
     <orm:sharedfield name="_employeeID" target-class="MetadataDemo.Employee" 
        target-field="_employeeID" />
     <orm:constraint name="FK_EmployeeAddress_Employee_EmployeeID" 
        schema="HumanResources" destination-table="Employee" />
   </orm:reference>
 </orm:field>
</orm:class>