public virtual void Reset() { // first we remove all ForeignKeyConstraints (if we will not do that // we will get an exception when clearing the tables). for (int i = 0; i < Tables.Count; i++) { ConstraintCollection cc = Tables[i].Constraints; for (int j = 0; j < cc.Count; j++) { if (cc[j] is ForeignKeyConstraint) { cc.Remove(cc[j]); } } } Clear(); Relations.Clear(); Tables.Clear(); }