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); }
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); }