예제 #1
0
        public static List<ClassDefinition> ReadSchema(IDataBase driver)
        {
            List<ClassDefinition> tables = new List<ClassDefinition>();
            using (IDbConnection connection = driver.getConnection())
            {
                if (connection.State == ConnectionState.Broken ||
                    connection.State == ConnectionState.Closed)
                    connection.Open();
                DataTable tableList = driver.getSchema("Tables", new string[] { });
                tableList.DefaultView.RowFilter = "(table_schema <> 'information_schema') AND (table_schema <> 'pg_catalog')";
                foreach (DataRow row in tableList.DefaultView.ToTable().Rows)
                    tables.Add(new ClassDefinition(row["TABLE_NAME"].ToString()));
            }

            return tables;
        }