/// <summary> /// Copy constructor. /// </summary> /// <param name="from">The data table to copy the structure from.</param> public DataTable(DataTable from) : this((DataColumnCollection)from._dataColumns.Clone(), (DataColumnCollection)from._propertyColumns.Clone()) { this._parent = null; // do not clone the parent this._name = from._name; this._tableScript = null == from._tableScript ? null : (TableScript)from._tableScript.Clone(); this._creationTime = this._lastChangeTime = DateTime.UtcNow; ChildCopyToMember(ref _notes, from._notes); // Clone also the table properties (deep copy) if (from._tableProperties != null && from._tableProperties.Count > 0) { PropertyBagNotNull.CopyFrom(from._tableProperties); } else { this._tableProperties = null; } ChildCopyToMember(ref _tableDataSource, from._tableDataSource); }
protected override IEnumerable<Main.DocumentNodeAndName> GetDocumentNodeChildrenWithName() { if (null != _dataColumns) yield return new Main.DocumentNodeAndName(_dataColumns, () => _dataColumns = null, "DataCols"); if (null != _propertyColumns) yield return new Main.DocumentNodeAndName(_propertyColumns, () => _propertyColumns = null, "PropCols"); if (null != DataSource) yield return new Main.DocumentNodeAndName(_tableDataSource, () => _tableDataSource = null, "DataSource"); if (null != PropertyBag) yield return new Main.DocumentNodeAndName(_tableProperties, () => _tableProperties = null, "PropertyBag"); if (null != _tableScript) yield return new Main.DocumentNodeAndName(_tableScript, () => _tableScript = null, "TableScript"); if (null != _notes) yield return new Main.DocumentNodeAndName(_notes, () => _notes = null, "Notes"); if (null != _dataColumns && null != _dataColumns.ColumnScripts) yield return new Main.DocumentNodeAndName(_dataColumns.ColumnScripts, "DataColumnScripts"); if (null != _propertyColumns && null != _propertyColumns.ColumnScripts) yield return new Main.DocumentNodeAndName(_propertyColumns.ColumnScripts, "PropertyColumnScripts"); }