Пример #1
0
        public override SqlColumnValuePair Add(string name, object value)
        {
            var pair = base.Add(name, value);

            pair.Field.Primary  = PrimaryKeys != null && PrimaryKeys.Contains(name);
            pair.Field.Identity = IdentityKeys != null && IdentityKeys.Contains(name);

            return(pair);
        }
Пример #2
0
        public DataTableDpoClass(DataTable table)
        {
            DatabaseName dname = new DatabaseName(ConnectionProviderManager.DefaultProvider, "MEM");

            this.table = table;

            this.tableName = new ClassTableName(new TableName(dname, TableName.dbo, table.TableName));

            this._columns = new ColumnCollection(this);
            foreach (DataColumn c in table.Columns)
            {
                this._columns.Add(new DtColumn(c));
            }

            this._identity = new IdentityKeys(this._columns);
            this._computedColumns = new ComputedColumns(this._columns);

            this._columns.UpdatePrimary(this.PrimaryKeys);
            this._columns.UpdateForeign(this.ForeignKeys);
        }
Пример #3
0
        protected virtual void LoadSchema()
        {
            DataTable schema = InformationSchema.TableSchema(tableName);

            this._columns = new ColumnCollection(this);

            foreach (DataRow row in schema.Rows)
            {
                this._columns.Add(new MetaColumn(row));
            }

            this._identity = new IdentityKeys(this._columns);
            this._computedColumns = new ComputedColumns(this._columns);

            this._columns.UpdatePrimary(this.PrimaryKeys);
            this._columns.UpdateForeign(this.ForeignKeys);
        }
Пример #4
0
 public static DataColumn[] IdentityKeys(this DataTable dt, IdentityKeys keys)
 {
     return(GetDataColumns(dt, keys.ColumnNames));
 }