Esempio n. 1
0
        public List<Table> GetTables( Microsoft.SqlServer.Management.Smo.Database database, bool splitFactsAndDimensions )
        {
            var tables = new List<Table>();
            foreach (Microsoft.SqlServer.Management.Smo.Table table in database.Tables)
            {
                if (splitFactsAndDimensions)
                {
                    var tableName = table.Name.ToLower();
                    if (tableName.StartsWith( "dim" ) || tableName.StartsWith( "fact" ))
                        continue;
                }

                var bimlTable = new Table
                    {
                        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;

                tables.Add( bimlTable );
            }
            return tables;
        }