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

MetaNavigationMember

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 MetaNavigationMember class represents a navigation property in Telerik Data Access metadata model (such as product.Category). It provides information about:

  • Association - gets the MetaAssociation that manages the 'end' represented by the current type.
  • Multiplicity - gets the multiplicity information about the relationship's end represented by the current type. The values for this property are predefined in the Multiplicity enumeration, which exposes the following fields:
    • ZeroOrOne - a lower bound is zero and an upper bound is one.
    • One - a lower bound is one and an upper bound is one.
    • Many - a lower bound is zero and an upper bound is N (one or more).
  • IsManaged - gets whether association's end integrity is managed by Telerik Data Access. It is important that one-to-many and many-to-many relationships are consistent in your model. If one side of the relationship is out of sync with the other side then either the database will not be updated properly or stale data will be left in the 2nd level cache. If you are using managed relationships then this is usually taken care of by Telerik Data Access. If you are using unmanaged relationships then you must handle this in your code.
  • IsDependent - gets whether the state of association's end that the current member represents is dependent on the operations applied on the corresponding end of the association. It allows operations like cascading deletes to be executed. Cascading deletes are disabled by default and are only enabled for references specified as dependent, by adding the [OpenAccess.Depend] attribute to the referenced persistent class.
  • OrderBy - gets the 'OrderBy' expression used in the SQL query when obtaining the records that are part of a collection.
  • KeyType - gets the key type of the member if this member represents a dictionary field.

The following example shows you how to access all navigation properties of a persistent type:

private static string GetNavigationProperties(Telerik.OpenAccess.Metadata
    .MetadataContainer container)
{
   StringBuilder sb = new StringBuilder();
   foreach (MetaPersistentType persistenType in container.PersistentTypes)
   {
       sb.AppendFormat("\nPersistentTypeName: {0}", persistenType.Name);
       foreach (MetaMember member in persistenType.Members)
       {
           MetaNavigationMember navigationMember = member as MetaNavigationMember;
           if (navigationMember != null)
           {
               sb.AppendFormat("\n\tNavigationMemberName: {0}", navigationMember.Name);
           }
       }
   }
   return sb.ToString();
}
Private Shared Function GetNavigationProperties(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)
  For Each member As MetaMember In persistenType.Members
   Dim navigationMember As MetaNavigationMember = TryCast(member, MetaNavigationMember)
   If navigationMember IsNot Nothing Then
    sb.AppendFormat(vbLf & vbTab & "NavigationMemberName: {0}", navigationMember.Name)
   End If
  Next member
 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>