public DataSetChangedEventArgs(DataSet sds, DataSetChangeAction action, object target, DataSetChangeset changes) { this.sds = sds; this.action = action; this.target = target; this.changes = changes; }
/// <summary> /// Initializes the instance of the class. /// </summary> /// <param name="sds">The committed data set.</param> /// <param name="changes">Committed changes.</param> /// <param name="committedSchema">DataSet schema after commit</param> internal DataSetCommittedEventArgs(DataSet sds, DataSetChangeset changes, DataSetSchema committedSchema) { this.sds = sds; this.changes = changes; this.committedSchema = committedSchema; }
protected override void OnPrecommit(DataSet.Changes changes) { if (!_IsInitialized) { return; } DataSetChangeset changeSet = changes.GetChangeset(); if (changeSet.AddedVariables != null && changeSet.AddedVariables.Length != 0) { throw new DataSetException(@"Addition of new variables isn't supported."); } foreach (var i in changeSet.UpdatedVariables) { if (i.ChangeType == Variable.ChangeTypes.MetadataUpdated) { throw new DataSetException(@"Metadata modification isn't supported."); } var _shape = this.variables[i.InitialSchema.Name].GetShape(); if (_shape.Length != i.Shape.Length) { throw new DataSetException(@"Shape modification isn't supported."); } for (int j = 0; j < _shape.Length; ++j) { if (_shape[j] != i.Shape[j]) { throw new DataSetException(@"Shape modification isn't supported."); } } var origin = i.AffectedRectangle.Origin; var shape = i.AffectedRectangle.Shape; if (origin.Length != _shape.Length || shape.Length != _shape.Length) { throw new DataSetException("Wrong number of dimensions."); } for (int j = 1; j < shape.Length; ++j) { if (_shape[j] != shape[j] || origin[j] != 0) { throw new DataSetException("Can only part data by its 1st dimension."); } } if (origin[0] + shape[0] > _shape[0]) { throw new DataSetException(@"Can't write more data than there is space reserved for."); } if (this.variables[i.InitialSchema.Name].Dimensions.Count == 1) { //(origin[0] != 0 || shape[0] != _shape[0])) throw new DataSetException(@"Can't part single-dimensional data"); int datalen = shape[0]; int datumSize = datumSizeDictionary[i.InitialSchema.Name]; int byteLen = datalen * datumSize; long byteOrigin = origin[0] * datumSize; if (byteOrigin % 512 != 0 || (origin[0] + datalen != _shape[0] && byteLen % 512 != 0)) { throw new ArgumentException(@"Can write only full 512 byte pages of single-dimensional data starting at a 512 bytes aligned position."); } } } base.OnPrecommit(changes); }