private Column CreateColumn(ColumnViewModel column)
        {
            string type = GetType(column.SqlType);

            return(new Column()
            {
                Name = column.Name,
                Type = type,
            });
        }
        private static TableViewModel GetTable(DbConnection connection, DataRow row)
        {
            string name   = row[2].ToString();
            string schema = row[1].ToString();
            var    t      = new TableViewModel(schema, name);

            t.PrimaryKeyColumnName = GetPrimaryKeyColumnName(connection, name);

            if (t.PrimaryKeyColumnName == null)
            {
                return(null);
            }

            var c = connection.CreateCommand();

            string sql = string.Format(@"SELECT 
	COLUMN_NAME, 
	IS_NULLABLE, --NO/YES 
	DATA_TYPE, --int/datetime/varchar 
	CHARACTER_MAXIMUM_LENGTH, --for varchar: -1 = MAX
	NUMERIC_PRECISION, -- for numeric
	NUMERIC_SCALE -- for numeric
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = N'{0}'", t.Name);

            c.CommandText = sql;
            var reader = c.ExecuteReader();

            while (reader.Read())
            {
                string clName   = reader.GetValue(0).ToString();
                var    nullable = reader.GetValue(1).ToString().Equals("YES");
                string dataType = reader.GetValue(2).ToString();

                var col = new ColumnViewModel()
                {
                    Name     = clName,
                    Nullable = nullable,
                    SqlType  = dataType //TODO: include additional info
                };
                t.Columns.Add(col);
            }

            reader.Close();

            return(t);
        }
 private void CheckForChanges(Column existingColumn, ColumnViewModel column)
 {
     //TODO: Implement
 }