MetaPrimitiveType
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 MetaPrimitiveType represents a primitive type in Telerik Data Access metadata model (such as boolean, int, string). It provides information about:
- ClrType - gets the CLR Type representation of this primitive type.
- IsEnum - gets whether this primitive type is an enum type.
- IsNullable - gets whether this primitive type is a nullable type.
- FullName - the full name of the CLR type.
The following example shows you how to access all primitive properties of a persistent type:
private static string GetPrimitiveProperties(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)
{
MetaPrimitiveMember primitiveMember = member as MetaPrimitiveMember;
if (primitiveMember != null)
{
sb.AppendFormat("\n\tPrimitiveType: {0}",
(primitiveMember.MemberType as MetaPrimitiveType).FullName);
}
}
}
return sb.ToString();
}
Private Shared Function GetPrimitiveProperties(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 primitiveMember As MetaPrimitiveMember = TryCast(member, MetaPrimitiveMember)
If primitiveMember IsNot Nothing Then
sb.AppendFormat(vbLf & vbTab & "PrimitiveType: {0}",
(TryCast(primitiveMember.MemberType, MetaPrimitiveType)).FullName)
End If
Next member
Next persistenType
Return sb.ToString()
End Function