MetaIndex
The MetaIndex class represents an index in the underlying table. During runtime, you could access all indexes that are available in the current container instance via the Indexes collection property of the MetadataContainer.
The MetaIndex class exposes the following properties:
- Clustered - gets a value that indicates whether the index is clustered.
- Unique - gets a value that indicates whether the index is unique.
- Table - gets the MetaTable object that represents the table to which the index belongs.
-
Columns - gets a list of MetaIndexColumnMapping objects that describe the columns included in the index. The MetaIndexColumnMapping class represents an index column mapping in the Telerik Data Access meta model. It gives you information about:
- Column - the column that this mapping is used for.
- Position - the position in the index for this column.
- SortOrder - whether the column order is ascending or descending.
The following examples shows you how to get information about the indexes in your model:
private string GetIndexes(Telerik.OpenAccess.Metadata.MetadataContainer container)
{
StringBuilder sb = new StringBuilder();
foreach (MetaIndex index in container.Indexes)
{
sb.AppendFormat("\nName: {0}", index.Name);
sb.AppendLine("Columns:");
foreach (MetaIndexColumnMapping mapping in index.Columns)
{
sb.AppendFormat("\tColumnName: {0}", mapping.Column.Name);
}
}
return sb.ToString();
}
Private Function GetIndexes(ByVal container As Telerik.OpenAccess.Metadata.MetadataContainer) _
As String
Dim sb As New StringBuilder()
For Each index As MetaIndex In container.Indexes
sb.AppendFormat(vbLf & "Name: {0}", index.Name)
sb.AppendLine("Columns:")
For Each mapping As MetaIndexColumnMapping In index.Columns
sb.AppendFormat(vbTab & "ColumnName: {0}", mapping.Column.Name)
Next mapping
Next index
Return sb.ToString()
End Function