Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override List <TableInfo> GetTableInfos()
        {
            SqlTableManager.InitializeTables();
            SqlColumnManager.InitializeColumns();
            SqlUniqueKeyManager.InitializeUniqueKeys();
            SqlPrimaryKeyManager.InitializePrimaryKeys();
            SqlForeignKeyManager.InitializeForeignKeys();

            var sqlTables = SqlTableManager.GetTables();

            _tableInfos = sqlTables.Select(ConvertToTableInfo).ToList();
            _tableInfos.ForEach(FillForeignKeyInfos);

            return(_tableInfos);
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="table"></param>
        /// <param name="sqlTable"></param>
        /// <returns></returns>
        private PrimaryKeyInfo GetPrimaryKeyInfo(TableInfo table, SqlTable sqlTable)
        {
            var sqlPrimaryKey = SqlPrimaryKeyManager.GetPrimaryKey(sqlTable);

            if (sqlPrimaryKey == null)
            {
                return(null);
            }

            var primaryKey = new PrimaryKeyInfo();

            primaryKey.Name          = sqlPrimaryKey.ConstraintName;
            primaryKey.Table         = table;
            primaryKey.PrimaryColumn = table.GetColumn(sqlPrimaryKey.ColumnName);
            return(primaryKey);
        }