Наследование: ContextualizedObject
Пример #1
0
        public DbColumn(MetaContext context, DbTableName table, DataRow row)
            : base(context)
        {
            BaseColumnRef = new DbColumnName(context)
            {
                Name = row.GetValue<string>("BaseColumnName"),
                TableRef = new DbTableName(context)
                {
                    Catalog = row.GetValue<string>("BaseCatalogName"),
                    Name = row.GetValue<string>("BaseTableName"),
                    Schema = row.GetValue<string>("BaseSchemaName")
                }
            };

            Name = row.GetValue<string>("ColumnName");
            TableRef = table;

            AllowDBNull = row.GetValue<bool>("AllowDBNull");
            ColumnOrdinal = row.GetValue<int>("ColumnOrdinal");
            ColumnSize = row.GetValue<int>("ColumnSize");
            DataType = row.GetValue<Type>("DataType");
            IsAutoIncrement = row.GetValue<bool>("IsAutoIncrement");
            IsKey = row.GetValue<bool>("IsKey");
            IsLong = row.GetValue<bool>("IsLong");
            IsHidden = row.GetValue<bool>("IsHidden");
            IsReadOnly = row.GetValue<bool>("IsReadOnly");
            IsRowVersion = row.GetValue<bool>("IsRowVersion");
            IsUnique = row.GetValue<bool>("IsUnique");
            NumericPrecision = row.GetValue<int>("NumericPrecision");
            NumericScale = row.GetValue<int>("NumericScale");
            ProviderType = row.GetValue<string>("ProviderType");
            DataTypeName = row.GetValue<string>("DataTypeName");
        }
Пример #2
0
 public string NameFor(DbTableName table)
 {
     return table.Name.CleanUp();
 }
Пример #3
0
 public override string QualifiedTableName(DbTableName table)
 {
     if (!string.IsNullOrEmpty(table.Schema))
         return string.Format("{0}.{1}", DoubleQuoteIfNeeded(table.Schema), DoubleQuoteIfNeeded(table.Name));
     else
         return string.Format("{0}", DoubleQuoteIfNeeded(table.Name));
 }
Пример #4
0
        public override IEnumerable<DbColumn> GetColumns(DbTableName table)
        {
            var columns = base.GetColumns(table).ToList();

            var table2 = GetConnection().GetSchema("Columns", new[] { table.Schema, table.Name })
                .Rows.OfType<DataRow>().ToDictionary(x => (string)x["COLUMN_NAME"]);

            foreach (var column in columns)
            {
                column.DataTypeName = table2[column.Name].GetValue<string>("DATATYPE");
            }

            return columns;
        }