}//_addConstraint()

        public void add(string ReferencingTableName, string ReferencingColumnName, string ReferencedTableName, string ReferencedColumnName, bool ApplyToDb)
        {
            CswTableConstraint CswTableConstraint = new CswTableConstraint();

            CswTableConstraint.ConstraintOpType      = CswEnumTableConstraintOpType.Create;
            CswTableConstraint.ReferencingTableName  = ReferencingTableName;
            CswTableConstraint.ReferencingColumnName = ReferencingColumnName;
            CswTableConstraint.ReferencedTableName   = ReferencedTableName;
            CswTableConstraint.ReferencedColumnName  = ReferencedColumnName;
            CswTableConstraint.ApplyToDb             = ApplyToDb;
            _addConstraint(CswTableConstraint);
        }//add()
        }//clear()

        private void _addToCosntraintsByTable(string ConstraintKey, CswTableConstraint IndexedConstraint)
        {
            if (!_ConstraintsByTable.ContainsKey(ConstraintKey))
            {
                _ConstraintsByTable.Add(ConstraintKey, new Dictionary <string, CswTableConstraint>());
            }
            else
            {
                if (_ConstraintsByTable[ConstraintKey].ContainsKey(IndexedConstraint.ReferencingColumnName))
                {
                    _ConstraintsByTable[ConstraintKey].Remove(IndexedConstraint.ReferencingColumnName);
                } //if-else the column already has a constraint
            }     //if-else the table is already defined

            _ConstraintsByTable[ConstraintKey].Add(IndexedConstraint.ReferencingColumnName, IndexedConstraint);
        }//_addToCosntraintsByTable()
        }//_addToCosntraintsByTable()

        private void _addConstraint(CswTableConstraint CswTableConstraint)
        {
            CswTableConstraint IndexedConstraint = null;

            if (!_ConstraintsByKey.ContainsKey(CswTableConstraint.ToString()))
            {
                _ConstraintsByKey.Add(CswTableConstraint.ToString(), CswTableConstraint);
                IndexedConstraint = CswTableConstraint;
            }
            else
            {
                IndexedConstraint = _ConstraintsByKey[CswTableConstraint.ToString()];
            }

            _addToCosntraintsByTable(CswTableConstraint.ReferencingTableName, IndexedConstraint);
            _addToCosntraintsByTable(CswTableConstraint.ReferencedTableName, IndexedConstraint);
        }//_addConstraint()
        }//markTableForRemoval()

        public void removeConstraint(string ReferencingTableName, string ReferencingColumnName, string ReferencedTableName, string ReferencedColumnName, string ConstraintName)
        {
            if (string.Empty == ReferencingTableName ||
                string.Empty == ReferencingColumnName ||
                string.Empty == ReferencedTableName ||
                string.Empty == ReferencedColumnName)
            {
                throw(new CswDniException("Referencing and referenced table and column names must be supplied"));
            }


            CswTableConstraint CswTableConstraint = new CswTableConstraint();

            CswTableConstraint.ConstraintOpType      = CswEnumTableConstraintOpType.Remove;
            CswTableConstraint.ReferencingTableName  = ReferencingTableName;
            CswTableConstraint.ReferencingColumnName = ReferencingColumnName;
            CswTableConstraint.ReferencedTableName   = ReferencedTableName;
            CswTableConstraint.ReferencedColumnName  = ReferencedColumnName;
            CswTableConstraint.ConstraintName        = string.Empty != ConstraintName ? ConstraintName : getConstraintName(ReferencingTableName, ReferencingColumnName, ReferencedTableName, ReferencedColumnName);
            CswTableConstraint.ApplyToDb             = true;
            _addConstraint(CswTableConstraint);
        }//removeConstraint()