public List<Index> GetIndexes( Microsoft.SqlServer.Management.Smo.Table table )
{
var indexes = new List<Index>();
foreach (Microsoft.SqlServer.Management.Smo.Index index in table.Indexes)
{
var indexType = index.IndexKeyType;
bool isRegularIndex = indexType != IndexKeyType.DriPrimaryKey && indexType != IndexKeyType.DriUniqueKey;
if (isRegularIndex)
{
var columns = index.IndexedColumns.Cast<IndexedColumn>()
.Select( indexedColumn => new Column {ColumnName = indexedColumn.Name} )
.ToList();
var bimlIndex = new Index
{
Name = index.Name,
Columns = columns,
};
indexes.Add( bimlIndex );
}
}
return indexes;
}