MetaNavigationMember
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