MetaPrimitiveMember
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 MetaPrimitiveMember class describes members that are of value type. It exposes the following properties:
- Column - gets the MetaColumn instance that is mapped to the current member. It could be null.
- IsIdentity - gets whether the current member represents the owner's type identity.
- IsVersion - gets whether the current member represents the owner's version in cases of 'version' concurrency mechanism.
- IsSerializedToBlob - gets whether the data in the current field is serialized to a blob column.
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
The following example shows a PersistentType element with two primary key Property elements:
<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:class>