public List<Fact> GetFacts( Microsoft.SqlServer.Management.Smo.Database database )
{
var facts = new List<Fact>();
foreach( Microsoft.SqlServer.Management.Smo.Table table in database.Tables )
{
var tableName = table.Name.ToLower();
if( !tableName.StartsWith( "fact" ) )
continue;
var bimlTable = new Fact
{
Name = table.Name,
SchemaName = database.Name + "." + table.Schema,
Columns = GetColumns( table ),
Indexes = GetIndexes( table ),
Keys = GetKeys( table ),
};
var annotations = GetAnnotations( table.ExtendedProperties );
if( annotations.Any() )
bimlTable.Annotations = annotations;
facts.Add( bimlTable );
}
return facts;
}