コード例 #1
0
        /// <summary>
        /// Gets the views.
        /// </summary>
        /// <param name="connection">The connection.</param>
        /// <returns></returns>
        public override List <View> GetViews(DbConnection connection)
        {
            List <View> views           = new List <View>();
            DataTable   viewsCollection = GetViewsCollection(connection);

            DataRow[] rows = viewsCollection.Select("", "table_schema, table_name ASC");

            foreach (DataRow view in rows)
            {
                string viewName = SqlServerTranslatorHelper.GetObjectName(view["table_schema"].ToString(), NamingHelper.EscapeObjectName(view["table_name"].ToString()));

                views.Add(
                    SqlServerViewTranslator.SqlServerViewCollectionToView(
                        view,
                        GetViewColumnsCollection(connection, viewName)));
            }

            return(views);
        }
コード例 #2
0
        /// <summary>
        /// Gets the tables.
        /// </summary>
        /// <param name="connection">The connection.</param>
        /// <returns></returns>
        public override List <Table> GetTables(DbConnection connection)
        {
            List <Table> tables           = new List <Table>();
            DataTable    tablesCollection = GetTablesCollection(connection);

            DataRow[] rows = tablesCollection.Select("", "table_schema, table_name ASC");

            foreach (DataRow table in rows)
            {
                string tableName = SqlServerTranslatorHelper.GetObjectName(table["table_schema"].ToString(), NamingHelper.EscapeObjectName(table["table_name"].ToString()));

                tables.Add(
                    SqlServerTableTranslator.SqlServerTableCollectionToTable(
                        table,
                        GetTableColumnsCollection(connection, tableName, true),
                        GetTableForeignKeysCollection(connection, table["table_schema"].ToString(), table["table_name"].ToString())));
            }

            return(tables);
        }