// if any of the constraints is violated then this is no op public virtual bool AddRow(DataRow row) { if (checkConstraints(row)) { updateConstraints(row); this.rows.Add (row); return true; } return false; }
public virtual bool validate(DataRow row) { return !values.Contains(row[Column]); }
public virtual bool addRow(DataRow row) { return values.Add (row[Column]); }
private void updateConstraints(DataRow row) { this.constraints.ForEach((x)=>x.addRow(row)); }
private bool checkConstraints(DataRow row) { return this.constraints.TrueForAll((x)=>x.validate(row)); }
public virtual DataRow CreateRow() { DataRow row = new DataRow() {Table = this}; return row; }
public bool validate(DataRow row) { return !rows.Contains(row); }
public bool addRow(DataRow row) { return rows.Add (row); }